Skip to content

Commit

Permalink
Merge pull request plasmo-dev#100 from dlcole3/dc/fix_incidence_matri…
Browse files Browse the repository at this point in the history
…x_for_unconnected_graphs

Fixed bug in `incidence_matrix(hypergraph)` when graph is not fully connected
  • Loading branch information
jalving authored Dec 13, 2023
2 parents 4e29c22 + e042b1b commit 1702300
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/graph_representations/hypergraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ function LightGraphs.incidence_matrix(hypergraph::HyperGraph)
end
end
V = Int.(ones(length(I)))
return SparseArrays.sparse(I, J, V)
m = length(hypergraph.vertices)
n = length(hypergraph.hyperedge_map)
return SparseArrays.sparse(I, J, V, m, n)
end

"""
Expand Down

0 comments on commit 1702300

Please sign in to comment.