cfpq_data.graphs.utils.nodes_to_integers#

nodes_to_integers(graph: MultiDiGraph) MultiDiGraph[source]#

Returns a graph with nodes converted to integers.

Parameters:
graphMultiDiGraph

Initial graph.

Returns:
gMultiDiGraph

A graph whose vertices are integers.

Examples

>>> from cfpq_data import *
>>> g = graph_from_text(["FROM LABEL TO"])
>>> list(g.edges(data=True))
[('FROM', 'TO', {'label': 'LABEL'})]
>>> new_g = nodes_to_integers(g)
>>> list(new_g.edges(data=True))
[(0, 1, {'label': 'LABEL'})]