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_edgescontract all parallel edges into simple edges.
Notes
This algorithm runs in time \(O(N + E)\) where \(N\) is the number of vertices and \(E\) is the final number of edges in the graph.
Parallel implementation.
If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.
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