Graphs.jl
Graphs.jl copied to clipboard
Create functions for constructing `SimpleGraph` and `SimpleDiGraph` from an `AbstractGraph`.
As mentioned in #88 , we should have some constructors that take an AbstractGraph and create a SimpleGraph or SimpleDiGraph from that. I.e. the functions that we need are:
SimpleGraph(g::AbstractGraph)
SimpleGraph{T}(g::AbstractGraph) where {T <: Integer}
SimpleDiGraph(g::AbstractGraph)
SimpleDiGraph{T}(g::AbstractGraph) where {T <: Integer}
It is not entirely clear what should happen if g is a directed graph and we try to construct an undirected graph from that, but to be consistent with what we already have in similar functions, we should probably add an edge between two vertices u and v if the input graph has an edge u -> v or an edge v -> u. Alternatively we could add a keyword argument
SimpleGraph(g::AbstractGraph; weakly_connected=true)
SimpleGraph{T}(g::AbstractGraph; weakly_connected=true) where {T <: Integer}
that would allow one to specify the expected behavior. Maybe there is also a better name than weakly_connected for that.