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

Tests for various files with generic graph #278

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'master' into pr/simonschoelly/278
  • Loading branch information
gdalle committed Sep 14, 2023
commit c3a46ab4f7ebf610473d143e8cf0a0fda9661138
8 changes: 6 additions & 2 deletions src/Test/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct GenericGraph{T} <: Graphs.AbstractGraph{T}
end

function GenericGraph(elist::Vector{Graphs.SimpleGraphEdge{T}}) where {T<:Integer}
GenericGraph{T}(SimpleGraph(elist))
return GenericGraph{T}(SimpleGraph(elist))
end

"""
Expand All @@ -55,11 +55,15 @@ end

Return either a GenericGraph or GenericDiGraph that wraps a copy of g.
"""
function generic_graph(g::Union{SimpleGraph, SimpleDiGraph})
function generic_graph(g::Union{SimpleGraph,SimpleDiGraph})
g = copy(g)
return is_directed(g) ? GenericDiGraph(g) : GenericGraph(g)
end

function GenericDiGraph(elist::Vector{Graphs.SimpleDiGraphEdge{T}}) where {T<:Integer}
return GenericDiGraph{T}(SimpleDiGraph(elist))
end

Graphs.is_directed(::Type{<:GenericGraph}) = false
Graphs.is_directed(::Type{<:GenericDiGraph}) = true

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.