expand_parallel_edges#
- graph_tool.generation.expand_parallel_edges(g, weight)[source]#
Expand edge multiplicities into parallel edges.
- Parameters:
- g
Graph
Graph to be modified.
- weight
EdgePropertyMap
Edge multiplicities.
- g
See also
contract_parallel_edges
contract all parallel edges into simple edges.
Notes
This algorithm runs in time \(O(N + E)\) where \(N\) is the number of nodes and \(E\) is the final number of edges in the graph.
Examples
>>> u = gt.collection.data["polblogs"].copy() >>> u.set_directed(False) >>> g = u.copy() >>> w = gt.contract_parallel_edges(g) >>> gt.expand_parallel_edges(g, w) >>> gt.similarity(g, u) 1.0