Skip to content

Commit b9f8ec0

Browse files
committed
correct forward and backward adjecency lists for add_adges)
1 parent 638ef5b commit b9f8ec0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/DaggerGraphs/src/adjlist.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,19 @@ function Graphs.add_edge!(adjlist::SimpleAdjListStorage{T,D}, edge) where {T,D}
8181
if D
8282
# Directed graphs have only forward edges
8383
push!(adjlist.fadjlist[src], dst)
84+
push!(adjlist.badjlist[dst], src)
85+
# Consider this behavior of using Graphs.jl
86+
# g = SimpleDiGraph(3,0); add_edge!(g,1,2)
87+
# println( "$(g.fadjlist) | $(g.badjlist)")
88+
# [[2], Int64[], Int64[]] | [Int64[], [1], Int64[]]
8489
else
8590
# Undirected graphs have both forward and backward edges
8691
push!(adjlist.fadjlist[src], dst)
87-
push!(adjlist.badjlist[dst], src)
92+
push!(adjlist.fadjlist[dst], src)
93+
# Consider this behavior of using Graphs.jl
94+
# g = SimpleGraph(3,0); add_edge!(g,1,2)
95+
# println(g.fadjlist)
96+
# [[2], [1], Int64[]]
8897
end
8998

9099
return true

0 commit comments

Comments
 (0)