'moving from tabular to graph representation of a given data
Suppose that I have the following data t:
| activity | teacher | group | students | duration | subject |
|---|---|---|---|---|---|
| One | A | a | 3 | 45 | Math |
| One | B | b | 2 | 45 | Math |
| two | A | c | 7 | 60 | P.E |
| One | D | a | 3 | 45 | Math |
| two | C | c | 7 | 60 | P.E |
I want to construct a graph data instead of this tabular data. I am actually interested in predicting the teacher by applying some kind of Graph ML. is there a way to transform the tabular data into graphical data ? maybe using networkX. I tried the following code
G = nx.from_pandas_edgelist(df, "subject", "teacher", edge_attr=True, create_using=nx.Graph())
nx.draw_networkx(G)
plt.show()
the output of this looks like a graph, but I don't understand how it works or how can I get the new data or what is the best way to identify the node and the edge.
thank you in advance for any help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
