cfpq_data.graphs.utils.nodes_to_integers#
- nodes_to_integers(graph: MultiDiGraph) MultiDiGraph [source]#
Returns a graph with nodes converted to integers.
- Parameters:
graph (MultiDiGraph) -- Initial graph.
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'})]
- Returns:
g -- A graph whose vertices are integers.
- Return type:
MultiDiGraph