Skip to content

Commit

Permalink
Add seed option to KaHyPar optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Dec 11, 2023
1 parent 0281ec3 commit 10e7dae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DataStructures = "0.18"
FiniteDifferences = "0.12"
GraphMakie = "0.5"
Graphs = "1.6"
KaHyPar = "0.3"
KaHyPar = "0.3.1"
Makie = "0.19"
Memoize = "0.4"
Suppressor = "0.2"
Expand Down
2 changes: 2 additions & 0 deletions src/Optimizers/KaHyPar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using Suppressor
configuration::Union{Nothing,Symbol,String} = nothing
edge_scaler::Function = Base.Fix1(*, 1000) Int round log2
vertex_scaler::Function = Base.Fix1(*, 1000) Int round log2
seed::Int = 0
end

function EinExprs.einexpr(config::HyPar, path)
Expand All @@ -28,6 +29,7 @@ function EinExprs.einexpr(config::HyPar, path)
vertex_weights = map(config.vertex_scaler length, path.args)

hypergraph = KaHyPar.HyperGraph(incidence_matrix, vertex_weights, edge_weights)
KaHyPar.kahypar_set_seed(hypergraph.context, config.seed)

partitions = @suppress KaHyPar.partition(
hypergraph,
Expand Down

0 comments on commit 10e7dae

Please sign in to comment.