Skip to content

Commit 638ef5b

Browse files
committed
Add interface tests and add docs plus minor changes
1 parent 1552edc commit 638ef5b

File tree

4 files changed

+349
-17
lines changed

4 files changed

+349
-17
lines changed

lib/DaggerGraphs/src/adjlist.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end
6060
function Graphs.add_edge!(adjlist::SimpleAdjListStorage{T,D}, edge) where {T,D}
6161
src, dst = Tuple(edge)
6262
if !D
63-
src, dst = (min(src, dst), max(src, dst))
63+
src, dst = minmax(src, dst)
6464
end
6565

6666
has_edge(adjlist, edge) && return false
@@ -79,10 +79,12 @@ function Graphs.add_edge!(adjlist::SimpleAdjListStorage{T,D}, edge) where {T,D}
7979

8080
# Add edges
8181
if D
82+
# Directed graphs have only forward edges
8283
push!(adjlist.fadjlist[src], dst)
83-
push!(adjlist.badjlist[dst], src)
8484
else
85+
# Undirected graphs have both forward and backward edges
8586
push!(adjlist.fadjlist[src], dst)
87+
push!(adjlist.badjlist[dst], src)
8688
end
8789

8890
return true

0 commit comments

Comments
 (0)