From dd9c5cdf694006a4158a48057cde8e3c66ef4e9a Mon Sep 17 00:00:00 2001 From: Joseph Tindall <51231103+JoeyT1994@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:12:24 -0500 Subject: [PATCH] Fix bug in `copy(pg::PartitionedGraph)` (#50) --- src/Graphs/partitionedgraphs/partitionedgraph.jl | 2 +- test/test_partitionedgraph.jl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Graphs/partitionedgraphs/partitionedgraph.jl b/src/Graphs/partitionedgraphs/partitionedgraph.jl index 3f8cdad..45a6ec6 100644 --- a/src/Graphs/partitionedgraphs/partitionedgraph.jl +++ b/src/Graphs/partitionedgraphs/partitionedgraph.jl @@ -99,7 +99,7 @@ function copy(pg::PartitionedGraph) copy(unpartitioned_graph(pg)), copy(partitioned_graph(pg)), copy(partitioned_vertices(pg)), - copy(partitionvertex(pg)), + copy(which_partition(pg)), ) end diff --git a/test/test_partitionedgraph.jl b/test/test_partitionedgraph.jl index 67d047e..9a4aea7 100644 --- a/test/test_partitionedgraph.jl +++ b/test/test_partitionedgraph.jl @@ -27,6 +27,8 @@ using Graphs @test is_tree(partitioned_graph(pg)) @test nv(pg) == nx * ny @test nv(partitioned_graph(pg)) == nx + pg_c = copy(pg) + @test pg_c == pg #Same partitioning but with a dictionary constructor partition_dict = Dictionary([first(partition) for partition in partitions], partitions)