Skip to content

Commit 543409d

Browse files
committed
Revert default dir for laplacian_matrix, document the discrepancy with Graphs
1 parent 227602d commit 543409d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/overrides.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ end
4040
"""
4141
Graphs.laplacian_matrix(g, T; dir)
4242
43-
Subtract the adjacency matrix to the degree matrix, both filled with element type `T` and considering edge direction `dir ∈ [:in, :out, :both]` (default is `:both`).
43+
Subtract the adjacency matrix to the degree matrix, both filled with element type `T` and considering edge direction `dir ∈ [:in, :out, :both]` (unlike in Graphs.jl, default is `:out`).
4444
"""
4545
function Graphs.laplacian_matrix(
46-
g::AbstractSimpleWeightedGraph, T::DataType=weighttype(g); dir::Symbol=:both
46+
g::AbstractSimpleWeightedGraph, T::DataType=weighttype(g); dir::Symbol=:out
4747
)
4848
return degree_matrix(g, T; dir=dir) - adjacency_matrix(g, T; dir=dir)
4949
end

test/overrides.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@test adjacency_matrix(g)[2, 4] == 0
4949
@test adjacency_matrix(g; dir=:out) == adjacency_matrix(g; dir=:in)'
5050
@test issymmetric(laplacian_matrix(g))
51-
@test laplacian_matrix(g, Float64) g3_l
51+
@test laplacian_matrix(g, Float64; dir=:out) g3_l
5252
@test g[1:3] == SimpleWeightedGraph{eltype(g),weighttype(g)}(path_graph(3))
5353
gx = copy(g)
5454
add_edge!(gx, 2, 3, 99)
@@ -74,8 +74,8 @@
7474
@test_throws DomainError degree_matrix(g, dir=:other)
7575
@test @inferred(adjacency_matrix(g, Int64)) == adjacency_matrix(g, Int64; dir=:out)
7676
@test adjacency_matrix(g; dir=:out) == adjacency_matrix(g; dir=:in)'
77-
@test !issymmetric(laplacian_matrix(g))
78-
@test laplacian_matrix(g, Float64) g5_l
77+
@test !issymmetric(laplacian_matrix(g; dir=:out))
78+
@test laplacian_matrix(g, Float64; dir=:out) g5_l
7979
@test @inferred(pagerank(g))[3] 0.2266 atol = 0.001
8080
@test length(@inferred(pagerank(g))) == nv(g)
8181
@test_throws ErrorException pagerank(g, 2)

0 commit comments

Comments
 (0)