networkx.MultiDiGraph.new_edge_key

MultiDiGraph.new_edge_key(u, v)

Returns an unused key for edges between nodes u and v.

The nodes u and v do not need to be already in the graph.

Notes

In the standard MultiGraph class the new key is the number of existing edges between u and v (increased if necessary to ensure unused). The first edge will have key 0, then 1, etc. If an edge is removed further new_edge_keys may not be in this order.

Parameters

u, v (nodes)

Returns

key

Return type

int