diff --git a/src/SMDGraphs.jl b/src/SMDGraphs.jl index 9e4c722..52b4ccd 100644 --- a/src/SMDGraphs.jl +++ b/src/SMDGraphs.jl @@ -22,6 +22,7 @@ import JSMDInterfaces.Graph: import Graphs: AbstractGraph, + SimpleEdge, SimpleGraph, SimpleDiGraph, dijkstra_shortest_paths, diff --git a/src/graphs/MappedGraphs.jl b/src/graphs/MappedGraphs.jl index c8ed175..8a99cdd 100644 --- a/src/graphs/MappedGraphs.jl +++ b/src/graphs/MappedGraphs.jl @@ -108,7 +108,7 @@ function has_edge(g::MappedNodeGraph, from::Int, to::Int) end function edges(g::MappedNodeGraph) - map(e->Graphs.SimpleEdge(get_outerid(g, e.src), get_outerid(g, e.dst)), edges(g.graph)) + map(e->SimpleEdge(get_outerid(g, e.src), get_outerid(g, e.dst)), edges(g.graph)) end edgetype(g::MappedNodeGraph) = edgetype(g.graph) diff --git a/test/runtests.jl b/test/runtests.jl index 8071144..4e475d2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,8 @@ using SMDGraphs using Test -using Graphs: Graphs, SimpleEdge +using Graphs +using Graphs: SimpleEdge import JSMDInterfaces.Errors: NotImplementedError import JSMDInterfaces.Graph as jGraph @@ -112,11 +113,19 @@ SMDGraphs.get_node_id(n::IntNode) = n.id @test !SMDGraphs.has_edge(graph, 7, 1) @test SMDGraphs.ne(graph) == 2 - @test SMDGraphs.edges(graph) == [Graphs.Simpl] + @test SMDGraphs.edges(graph) == [ + SimpleEdge(10, 7), + SimpleEdge(10, 1) + ] SMDGraphs.add_edge!(dgraph, 10, 7, 6) SMDGraphs.add_edge!(dgraph, 7, 1, 3) + @test SMDGraphs.edges(dgraph) == [ + SimpleEdge(10, 7), + SimpleEdge(7, 1) + ] + @test isempty(SMDGraphs.inneighbors(dgraph, 10)) @test SMDGraphs.inneighbors(dgraph, 7) == [10] @test SMDGraphs.outneighbors(dgraph, 10) == [7]