Reputation: 1029
I have been using networkx for all my network graphing application so far; however, this new project requires graphs with 10^8 nodes in the graph and networkx was not built to handle this number of nodes (it becomes incredibly slow), so I switched to graph-tool which seems like it will be much faster.
In using graph-tool I would like to label each vertex in the graph with a user defined systematic label; so that I may look them up by label and not by index. I have tried going over the documentation, but there doesn't seem to be any support for this; property maps map from vertex_indices -> values, but I want the reverse.
Is there actual support for this that I am missing? Otherwise is my best option just to create a python dictionary and map labels to vertex_indices that way?
Upvotes: 3
Views: 2247
Reputation: 5261
There is a find_vertex() function. However, it has a O(N) complexity. If you want O(1) lookups you have to construct your own dictionary, like you suggested.
Upvotes: 5