How to interpret a networkx graph

Viewed 351

I need help interpreting the graph generated from the python package networkx. The documentation is great at telling you how to create one but not so much on how to understand one.

i have a CSV file of data that looks like this after reading into a dataframe using pandas:

origin_id   destination_id  total_amount    created_at
0   32196   2299             1014.90    2017-06-01 00:10:08
1   33399   321              1000.00    2017-06-01 00:10:45
2   21879   2299             2092.95    2017-06-01 00:18:16
3   5155    2299             321.97     2017-06-01 00:22:46
4   32019   2299             2029.80    2017-06-01 00:23:15

I generate a directed graph from this:

G1 = nx.DiGraph()
nodes = list(set(df.origin_id + df.destination_id))[:100]
edges = zip(df.origin_id,df.destination_id,df.total_amount)[:100]
G1.add_nodes_from(nodes)
G1.add_weighted_edges_from(edges)
nx.draw(G1,node_size=20) 

The output looks like this: enter image description here

I need help to understand what this graph means.

  1. What does the thick black line from some of the nodes in the center mean ( since i set the weight to be traction value, does the thick width mean those are transactions with high value?)
  2. and what direction are the edges going in?

Also, I had to limit my number of data points (to olny 100) else the nodes will overlap and become unreadable. How can i overcome this?

Example below with more data points enter image description here

1 Answers

1) Those thick partial black lines are an attempt to represent arrows at the tips of directed edges. The documentation acknowledges that this isn't very pretty, but it's not easy to get right with arrows.

2) It's hard to visualize a large network. However, there is a relatively large collection of options for network layouts which may be useful. You can also interface with pygraphviz (same link). Some of these may be more helpful for being able to interpret the graph.

Related