Skip to content Skip to sidebar Skip to footer

Networkx Bipartite Graphs: Nodes Of Different Sets With The Same Number

I encountered a major problem while constructing a bipartite graph with Networkx. I take the nodes from a 2-columns csv, say CODINV2;APPLN_ID 1;3 1;4 1;5 2;3 2;6 3;6 4;12 After

Solution 1:

The reason for this is that the graph stores the node by its name.

If it enters one node by name 3 and thinks bipartite=1, say and then later adds 3 again, it interprets that as the same node. If this time you tell it bipartite=0, it will overwrite the old entry. So now, node 3 has bipartite=0.

If you want to store two different node 3's, then they will have to have different names. You could try doing it as strings: '3a' and '3b'. Or any other names, but 3 and 3 will not work.

Post a Comment for "Networkx Bipartite Graphs: Nodes Of Different Sets With The Same Number"