Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Apr 16, 2024
1 parent 745061e commit 0d7b19f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 35 deletions.
31 changes: 0 additions & 31 deletions examples/partitioning.jl

This file was deleted.

2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
KaHyPar = "2a6221f6-aa48-11e9-3542-2d9e0ef01880"
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b"
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
25 changes: 21 additions & 4 deletions test/test_partitionedgraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ using Graphs:
random_regular_graph,
rem_vertex!,
vertices
using Metis: Metis
using NamedGraphs: NamedEdge, NamedGraph
# TODO: Move to `NamedGraphGenerators`.
using NamedGraphs: named_comb_tree, named_grid, named_triangular_lattice_graph
Expand Down Expand Up @@ -39,6 +40,7 @@ using NamedGraphs.PartitionedGraphs:
partitionvertices,
unpartitioned_graph
using Dictionaries: Dictionary, dictionary
using Pkg: Pkg
using Test: @test, @testset

@testset "Test Partitioned Graph Constructors" begin
Expand Down Expand Up @@ -174,14 +176,13 @@ end
end

@testset "Test NamedGraphs Functions on Partitioned Graph" begin
functions = [is_tree, default_root_vertex, center, diameter, radius]
gs = [
functions = (is_tree, default_root_vertex, center, diameter, radius)
gs = (
named_comb_tree((4, 4)),
named_grid((2, 2, 2)),
NamedGraph(random_regular_graph(12, 3)),
named_triangular_lattice_graph(7, 7),
]

)
for f in functions
for g in gs
pg = PartitionedGraph(g, [vertices(g)])
Expand All @@ -193,4 +194,20 @@ end
end
end
end

@testset "Graph partitioning" begin
g = named_grid((4, 4))
npartitions = 4
backends = ["metis"]
if !Sys.iswindows()
# `KaHyPar` doesn't work on Windows.
Pkg.add("KaHyPar"; io=devnull)
push!(backends, "kahypar")
end
for backend in backends
pg = PartitionedGraph(g; npartitions, backend="metis")
@test pg isa PartitionedGraph
@test nv(partitioned_graph(pg)) == npartitions
end
end
end

0 comments on commit 0d7b19f

Please sign in to comment.