Skip to content

Commit

Permalink
abstract out degree statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebd99 committed Dec 7, 2023
1 parent 6929150 commit 72b6516
Show file tree
Hide file tree
Showing 6 changed files with 475 additions and 294 deletions.
6 changes: 4 additions & 2 deletions Experiments/Scripts/coloring_methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Profile
include("../Experiments.jl")

datasets = [hprd]
datasets = [human]
partitioning_schemes = [
[(Degree, 64)],
[(NeighborNodeLabels, 64)],
Expand All @@ -11,7 +11,9 @@ partitioning_schemes = [
[(Hash, 64)],
[(Degree, 8), (QuasiStable, 32), (NeighborNodeLabels, 24)],
[(Degree, 8), (NeighborNodeLabels, 24), (QuasiStable, 32)]]

partitioning_schemes = [
[(QuasiStable, 64)],
]
experiment_params = Vector{ExperimentParams}()
for dataset in datasets
for scheme in partitioning_schemes
Expand Down
15 changes: 6 additions & 9 deletions Source/CardinalityWithColors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,15 @@ BoolPath = Vector{Bool}
NodeId = Int
Color = Int16
StartEndColorPair = Tuple{Color, Color}
abstract type Comparable end
import Base .==
function ==(a::T, b::T) where T <: Comparable
(a.path == b.path) && (a.colors == b.colors)
end
@auto_hash_equals mutable struct CyclePathAndColors
path::BoolPath
colors::StartEndColorPair
end

@enum PARTITIONER QuasiStable Hash Degree DirectedDegree SimpleLabel InOut LabelInOut NeighborEdges MostNeighbors NeighborNodeLabels


struct ColorSummaryParams
deg_stats_type::Type
num_colors::Int
max_cycle_size::Int
max_partial_paths::Int
Expand All @@ -35,15 +30,16 @@ struct ColorSummaryParams
proportion_not_updated::Float16
proportion_deleted::Float16

function ColorSummaryParams(;max_cycle_size=4, max_partial_paths=1000,
function ColorSummaryParams(;deg_stats_type = AvgDegStats, max_cycle_size=4, max_partial_paths=1000,
partitioning_scheme::Vector{Tuple{PARTITIONER, Int}} = [(QuasiStable, 64)], weighting=true, proportion_not_updated = 1.0, proportion_deleted=0.0)
num_colors = sum([x[2] for x in partitioning_scheme])
return new(num_colors, max_cycle_size, max_partial_paths, partitioning_scheme, weighting, proportion_not_updated, proportion_deleted)
return new(deg_stats_type, num_colors, max_cycle_size, max_partial_paths, partitioning_scheme, weighting, proportion_not_updated, proportion_deleted)
end
end

function params_to_string(params::ColorSummaryParams)
summary_name = "ColorSummary_" * string(params.partitioning_scheme) * "_"
summary_name = "ColorSummary_" * string(params.deg_stats_type) * "_"
summary_name *= string(params.partitioning_scheme) * "_"
summary_name *= string(params.max_cycle_size) * "_"
summary_name *= string(params.max_partial_paths)* "_"
summary_name *= string(params.proportion_not_updated) * "_"
Expand All @@ -58,5 +54,6 @@ include("datasets.jl")
include("utils.jl")
include("ExactSizeCalculator.jl")
include("ColoringMethods.jl")
include("DegreeStats.jl")
include("ColorSummary.jl")
include("QuasiStableCardinalityEstimator.jl")
Loading

0 comments on commit 72b6516

Please sign in to comment.