Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create functions for constructing SimpleGraph and SimpleDiGraph from an AbstractGraph. #98

Closed
simonschoelly opened this issue Jan 29, 2022 · 0 comments · Fixed by #301
Closed
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@simonschoelly
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants