I was looking for a way to prevent adding of parallel edges in the graph
i.e. I would like to create a graph that is not a multigraph. Now I do that
manually but that is quite prone to bugs.
Is this possible to do this with graph tool in any way?
I was looking for a way to prevent adding of parallel edges in the graph
i.e. I would like to create a graph that is not a multigraph. Now I do that
manually but that is quite prone to bugs.
Is this possible to do this with graph tool in any way?
You can check for the existence of an edge with Graph.edge(), and you can
use Graph.edge(s, t, add_missing=True) to fetch edges or add missing ones if
they do not yet exist.
Alternatively, you can remove parallel edges a posteriori with the function
remove_parallel_edges().
Something like this would require changing the underlying graph data
structure in ways that would significantly degrade the performance of most
algorithms.