Undirected to directed graph

I have an undirected graph. Is there a simple function or similar for converting it to a directed graph (where each edge is replaced by two edges, one in each direction)?

Does this work?

julia> g = CompleteGraph(3)
{3, 3} undirected simple Int64 graph

julia> dg = DiGraph(g)
{3, 6} directed simple Int64 graph
2 Likes

Brilliant! Much simpler than I thought. Loads of thanks :slight_smile: