From e9d0402e55e898534b131381ba85725b13c50f67 Mon Sep 17 00:00:00 2001 From: Joey Date: Tue, 23 Jan 2024 12:25:16 -0500 Subject: [PATCH 1/2] Bug Fix. Small Changes --- src/Graphs/partitionedgraphs/partitionedge.jl | 2 +- src/Graphs/partitionedgraphs/partitionedgraph.jl | 2 +- src/Graphs/partitionedgraphs/partitioning.jl | 2 +- test/test_partitionedgraph.jl | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Graphs/partitionedgraphs/partitionedge.jl b/src/Graphs/partitionedgraphs/partitionedge.jl index b344e0b..a7b88c6 100644 --- a/src/Graphs/partitionedgraphs/partitionedge.jl +++ b/src/Graphs/partitionedgraphs/partitionedge.jl @@ -1,4 +1,4 @@ -struct PartitionEdge{V,E<:AbstractEdge{<:V}} <: AbstractPartitionEdge{V} +struct PartitionEdge{V,E<:AbstractEdge{V}} <: AbstractPartitionEdge{V} edge::E end diff --git a/src/Graphs/partitionedgraphs/partitionedgraph.jl b/src/Graphs/partitionedgraphs/partitionedgraph.jl index 27ad0fe..fc08513 100644 --- a/src/Graphs/partitionedgraphs/partitionedgraph.jl +++ b/src/Graphs/partitionedgraphs/partitionedgraph.jl @@ -150,5 +150,5 @@ end function induced_subgraph( pg::PartitionedGraph, partitionverts::Vector{V} ) where {V<:PartitionVertex} - return induced_subgraph(pg, vertices(pg, partitionverts)) + return induced_subgraph(unpartitioned_graph(pg), vertices(pg, partitionverts)) end diff --git a/src/Graphs/partitionedgraphs/partitioning.jl b/src/Graphs/partitionedgraphs/partitioning.jl index 3074fc4..42347b0 100644 --- a/src/Graphs/partitionedgraphs/partitioning.jl +++ b/src/Graphs/partitionedgraphs/partitioning.jl @@ -90,7 +90,7 @@ function partitioned_vertices( end function partitioned_vertices( - g::AbstractNamedGraph; npartitions=nothing, nvertices_per_partition=nothing, kwargs... + g::AbstractGraph; npartitions=nothing, nvertices_per_partition=nothing, kwargs... ) vertex_partitions = partitioned_vertices( parent_graph(g); npartitions, nvertices_per_partition, kwargs... diff --git a/test/test_partitionedgraph.jl b/test/test_partitionedgraph.jl index 25bd881..5a0e1db 100644 --- a/test/test_partitionedgraph.jl +++ b/test/test_partitionedgraph.jl @@ -115,10 +115,10 @@ end ) pg_1 = subgraph(pg, PartitionVertex.(subgraph_partitioned_vertices)) + @test isa(pg_1, NamedGraph) pg_2 = subgraph(pg, subgraph_vertices) - @test pg_1 == pg_2 + @test isa(pg_2, PartitionedGraph) @test nv(pg_1) == length(subgraph_vertices) - @test nv(partitioned_graph(pg_1)) == length(subgraph_partitioned_vertices) subgraph_partitioned_vertex = 3 subgraph_vertices = partitions[subgraph_partitioned_vertex] From 36de13cec19f73a5711da09c2c4d0e69ec78f489 Mon Sep 17 00:00:00 2001 From: Joey Date: Tue, 23 Jan 2024 13:33:49 -0500 Subject: [PATCH 2/2] Revert Induced Subgraph Changes --- src/Graphs/partitionedgraphs/partitionedgraph.jl | 2 +- test/test_partitionedgraph.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Graphs/partitionedgraphs/partitionedgraph.jl b/src/Graphs/partitionedgraphs/partitionedgraph.jl index fc08513..27ad0fe 100644 --- a/src/Graphs/partitionedgraphs/partitionedgraph.jl +++ b/src/Graphs/partitionedgraphs/partitionedgraph.jl @@ -150,5 +150,5 @@ end function induced_subgraph( pg::PartitionedGraph, partitionverts::Vector{V} ) where {V<:PartitionVertex} - return induced_subgraph(unpartitioned_graph(pg), vertices(pg, partitionverts)) + return induced_subgraph(pg, vertices(pg, partitionverts)) end diff --git a/test/test_partitionedgraph.jl b/test/test_partitionedgraph.jl index 5a0e1db..25bd881 100644 --- a/test/test_partitionedgraph.jl +++ b/test/test_partitionedgraph.jl @@ -115,10 +115,10 @@ end ) pg_1 = subgraph(pg, PartitionVertex.(subgraph_partitioned_vertices)) - @test isa(pg_1, NamedGraph) pg_2 = subgraph(pg, subgraph_vertices) - @test isa(pg_2, PartitionedGraph) + @test pg_1 == pg_2 @test nv(pg_1) == length(subgraph_vertices) + @test nv(partitioned_graph(pg_1)) == length(subgraph_partitioned_vertices) subgraph_partitioned_vertex = 3 subgraph_vertices = partitions[subgraph_partitioned_vertex]