Skip to content

Commit 6861616

Browse files
Daniel Bergmangdalle
andauthored
throw ArgumentError on transitiveclosure!(::MetaGraph) (#90)
* 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`. * add selflooped opt arg * add test * Update src/metagraph.jl Co-authored-by: Guillaume Dalle <[email protected]> --------- Co-authored-by: Guillaume Dalle <[email protected]>
1 parent 1ea0c41 commit 6861616

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/metagraph.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,7 @@ This can be useful to interpret the results of methods inherited from `Graphs`.
248248
function label_for(meta_graph::MetaGraph, code::Integer)
249249
return meta_graph.vertex_labels[code]
250250
end
251+
252+
function Graphs.transitiveclosure!(meta_graph::MetaGraph, selflooped=false)
253+
throw(ArgumentError("transitiveclosure! not implemented for type MetaGraph"))
254+
end

test/misc.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,10 @@ end
8282
(from, to) = first(edge_labels(graph))
8383
@test graph[from, to] === 1
8484
end
85+
86+
@testset "No transitiveclosure! for MetaGraph" begin
87+
graph = MetaGraph(
88+
complete_graph(2), ["3" => nothing, "2" => nothing], [("3", "2") => 1]
89+
)
90+
@test_throws ArgumentError transitiveclosure!(graph)
91+
end

0 commit comments

Comments
 (0)