<=>
😀 but anyways. I am using the edges twice, in undirected and in directed would like to iterate over the undirected and add them to directed.
reverse
hint
1 => 2
is the same as 2 => 1
, but we guarantee lexicographical ordering when edges are iterated, and we only show one version of the undirected edge (that is, src less than or equal to dst).
<=>
is because edges themselves do not have directedness - only the graphs - so there’s no way to tell that a given edge is part of an undirected graph or a directed one.
julia> g = PathDiGraph(4)
{4, 3} directed simple Int64 graph
julia> add_edge!(g, 4, 3) # add a reverse edge to this directed graph
true
julia> collect(edges(g))
4-element Array{LightGraphs.SimpleGraphs.SimpleEdge{Int64},1}:
Edge 1 => 2
Edge 2 => 3
Edge 3 => 4
Edge 4 => 3
julia> h = Graph(g)
{4, 3} undirected simple Int64 graph
julia> collect(edges(h))
3-element Array{LightGraphs.SimpleGraphs.SimpleEdge{Int64},1}:
Edge 1 => 2
Edge 2 => 3
Edge 3 => 4