From acebcf48c2912f390a977297ab5e1d47c82768e8 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 12 Dec 2023 15:42:03 -0700 Subject: [PATCH 1/2] added dimensions for incidence_matrix function --- src/graph_representations/hypergraph.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graph_representations/hypergraph.jl b/src/graph_representations/hypergraph.jl index 78741f26..10968cfb 100644 --- a/src/graph_representations/hypergraph.jl +++ b/src/graph_representations/hypergraph.jl @@ -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 = m + return SparseArrays.sparse(I, J, V, m, n) end """ From e042b1b734e0f6dfec4146633db56e1cf2cc144b Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 12 Dec 2023 16:21:51 -0700 Subject: [PATCH 2/2] Fixed dimension to be length of hyperedges --- src/graph_representations/hypergraph.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph_representations/hypergraph.jl b/src/graph_representations/hypergraph.jl index 10968cfb..850c1b08 100644 --- a/src/graph_representations/hypergraph.jl +++ b/src/graph_representations/hypergraph.jl @@ -129,7 +129,7 @@ function LightGraphs.incidence_matrix(hypergraph::HyperGraph) end V = Int.(ones(length(I))) m = length(hypergraph.vertices) - n = m + n = length(hypergraph.hyperedge_map) return SparseArrays.sparse(I, J, V, m, n) end