graph-walker icon indicating copy to clipboard operation
graph-walker copied to clipboard

Support non-integer node labels

Open hawkrobe opened this issue 2 years ago • 1 comments

In networkx, nodes can be any hashable object (e.g., a text string, an image, an XML object, another Graph, a customized node object, etc.). But my understanding is that graph-walker requires nodes to be integers.

Current behavior

if we run random_walks on a simple graph with strings as node labels, an error is thrown:

invalid literal for int() with base 10:

Desired behavior

Ideally, the graph-walker package could check for non-integer nodes during the preprocessing step and either return a more readable error message (e.g. "Nodes are required to be integers") or relabel the graph to use integer nodes and then convert these integers back to the original objects in output.

Possible solution

A current workaround is for the user to run convert_node_labels_to_integers(label_attribute = 'name') prior to running the random walk.

hawkrobe avatar Jun 30 '22 21:06 hawkrobe

I am also getting this issue. I second this

eszabo12 avatar Apr 05 '23 00:04 eszabo12