From b2b0ffcb982a9f17b2b6418706e53a945302e3cf Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Thu, 27 Mar 2025 08:10:33 -0400 Subject: [PATCH 1/4] throw ArgumentError on transitiveclosure!(::MetaGraph) previously, this would not return an error but would not update the underlying graph structure. Note: simply calling `transitiveclosure!(G.graph)` also fails as this does not update the metadata, e.g. `G.edge_data`. --- src/metagraph.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/metagraph.jl b/src/metagraph.jl index 57e1179..bcd6c26 100644 --- a/src/metagraph.jl +++ b/src/metagraph.jl @@ -248,3 +248,7 @@ This can be useful to interpret the results of methods inherited from `Graphs`. function label_for(meta_graph::MetaGraph, code::Integer) return meta_graph.vertex_labels[code] end + +function transitiveclosure!(meta_graph::MetaGraph) + throw(ArgumentError("transitiveclosure! not implemented for type MetaGraph")) +end From 2452b53bc5cf1502975d2f3a5686b00a184a4521 Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Thu, 27 Mar 2025 08:26:28 -0400 Subject: [PATCH 2/4] add selflooped opt arg --- src/metagraph.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metagraph.jl b/src/metagraph.jl index bcd6c26..4c2d537 100644 --- a/src/metagraph.jl +++ b/src/metagraph.jl @@ -249,6 +249,6 @@ function label_for(meta_graph::MetaGraph, code::Integer) return meta_graph.vertex_labels[code] end -function transitiveclosure!(meta_graph::MetaGraph) +function transitiveclosure!(meta_graph::MetaGraph, selflooped=false) throw(ArgumentError("transitiveclosure! not implemented for type MetaGraph")) end From 29fe0fffb371f12265d105d517ee9131418e714f Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Thu, 27 Mar 2025 23:07:57 -0400 Subject: [PATCH 3/4] add test --- test/misc.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/misc.jl b/test/misc.jl index 67f0bb0..9d731a0 100644 --- a/test/misc.jl +++ b/test/misc.jl @@ -82,3 +82,10 @@ end (from, to) = first(edge_labels(graph)) @test graph[from, to] === 1 end + +@testset "No transitiveclosure! for MetaGraph" begin + graph = MetaGraph( + complete_graph(2), ["3" => nothing, "2" => nothing], [("3", "2") => 1] + ) + @test_throws ArgumentError transitiveclosure!(graph) +end From f369715a9c788a3e6a98b8536cb39082f75d66f0 Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Fri, 28 Mar 2025 08:23:54 -0400 Subject: [PATCH 4/4] Update src/metagraph.jl Co-authored-by: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> --- src/metagraph.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metagraph.jl b/src/metagraph.jl index 4c2d537..e522e1a 100644 --- a/src/metagraph.jl +++ b/src/metagraph.jl @@ -249,6 +249,6 @@ function label_for(meta_graph::MetaGraph, code::Integer) return meta_graph.vertex_labels[code] end -function transitiveclosure!(meta_graph::MetaGraph, selflooped=false) +function Graphs.transitiveclosure!(meta_graph::MetaGraph, selflooped=false) throw(ArgumentError("transitiveclosure! not implemented for type MetaGraph")) end