Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Fixes #555: graphmatrices convert incorrect on CA
Browse files Browse the repository at this point in the history
CombinatorialAdjacency(CombinatorialAdjacency(g)) was returning the backing storage.
Fix includes tests.
  • Loading branch information
jpfairbanks committed Mar 23, 2017
1 parent 91df2ab commit 9365a71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/linalg/graphmatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ adjacency(lapl::GraphMatrix) = lapl.A
convert(::Type{Adjacency}, lapl::Laplacian) = lapl.A
convert(::Type{CombinatorialAdjacency}, adjmat::Adjacency) = adjmat.A
convert(::Type{SparseMatrix}, adjmat::CombinatorialAdjacency) = adjmat.A
convert(::Type{CombinatorialAdjacency}, adjmat::CombinatorialAdjacency) = adjmat


function sparse(lapl::M) where M<:Laplacian
Expand Down
2 changes: 2 additions & 0 deletions test/linalg/graphmatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export test_adjacency, test_laplacian, test_accessors, test_arithmetic, test_oth
converttest(SparseMatrix{Float64},stochmat)
converttest(SparseMatrix{Float64},adjhat)
converttest(SparseMatrix{Float64},avgmat)
@test isa(CombinatorialAdjacency(adjmat), CombinatorialAdjacency)
@test isa(CombinatorialAdjacency(avgmat), CombinatorialAdjacency)
@test prescalefactor(adjhat) == postscalefactor(adjhat)
@test postscalefactor(stochmat) == prescalefactor(avgmat)
@test prescalefactor(adjhat) == postscalefactor(adjhat)
Expand Down

0 comments on commit 9365a71

Please sign in to comment.