Skip to content

Commit 1702300

Browse files
authored
Merge pull request #100 from dlcole3/dc/fix_incidence_matrix_for_unconnected_graphs
Fixed bug in `incidence_matrix(hypergraph)` when graph is not fully connected
2 parents 4e29c22 + e042b1b commit 1702300

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/graph_representations/hypergraph.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ function LightGraphs.incidence_matrix(hypergraph::HyperGraph)
128128
end
129129
end
130130
V = Int.(ones(length(I)))
131-
return SparseArrays.sparse(I, J, V)
131+
m = length(hypergraph.vertices)
132+
n = length(hypergraph.hyperedge_map)
133+
return SparseArrays.sparse(I, J, V, m, n)
132134
end
133135

134136
"""

0 commit comments

Comments
 (0)