My goal is to create a process flow diagram in Networkx using some data file. The data file I am using is a CSV file and I want the program to read that file and create a process diagram.
This is what I am getting when I have it read my file:
I want my graph to look like this with arrows in between:
This is an image of the test file I have been using:
Your main issue is that you misunderstand what
.read_adjlist
does. It expects the graph to be described using adjacency lists. It sees a row starting with "Step 1", so it thinks it means "Step 1 is a node that is adjacent to all the other nodes on that row".At this point, you have two options:
Note that
.read_adjlist
is not the only way to create a graph. You can use for instance.add_edges_from
.A solution without modifying the datafile would be: