Skip to content

Commit

Permalink
fixed cycle prob update slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebd99 committed Dec 7, 2023
1 parent 4593325 commit e27140d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Source/CardinalityWithColors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ QSC = QuasiStableColors
using Graphs: SimpleDiGraphFromIterator, Edge, DiGraph, edges, nv, ne, add_edge!,
add_vertex!, vertices, all_neighbors, src, dst, outneighbors, inneighbors


BoolPath = Vector{Bool}
NodeId = Int
Color = Int16
Expand Down Expand Up @@ -72,8 +71,6 @@ function params_to_string(params::ColorSummaryParams)
return summary_name
end



include("PropertyGraph.jl")
include("datasets.jl")
include("utils.jl")
Expand Down
1 change: 0 additions & 1 deletion Source/ColorSummary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ function update_edge_degrees!(summary::ColorSummary{AvgDegStats}, start_node, en
summary.total_added_edges += 1
end


function generate_color_summary(g::DataGraph, params::ColorSummaryParams=ColorSummaryParams(); verbose=0, timing_vec::Vector{Float64} = Float64[], use_cycle_join_table=true)
DS = params.deg_stats_type
if (verbose > 0)
Expand Down
7 changes: 3 additions & 4 deletions Source/DegreeStats.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file defines the interface and several instantiations of degree statistics. These are
# the core statistic that is used in the estimation procedure.


abstract type DegreeStats end

# A degree statistic is derived from a set of edges. We include the data graph as well in
Expand All @@ -16,6 +15,7 @@ end
function get_out_deg_estimate(d::DegreeStats)
throw(ErrorException("DegreeStats is an abstract type, you probably meant to call a particular instance."))
end

function get_in_deg_estimate(d::DegreeStats)
throw(ErrorException("DegreeStats is an abstract type, you probably meant to call a particular instance."))
end
Expand Down Expand Up @@ -136,7 +136,6 @@ end
get_in_deg_estimate(d::AvgDegStats) = d.avg_in
get_out_deg_estimate(d::AvgDegStats) = d.avg_out


struct AvgAccumulator <:StatAccumulator
weight::Float32
end
Expand All @@ -147,9 +146,9 @@ scale_coloring(w::AvgAccumulator, s) = AvgAccumulator(w.weight * s)

function extend_coloring(w::AvgAccumulator, d::AvgDegStats, out_edge::Bool)
if out_edge
return AvgAccumulator(w.weight*d.avg_out)
return scale_coloring(w, d.avg_out)
else
return AvgAccumulator(w.weight*d.avg_in)
return scale_coloring(w, d.avg_in)
end
end

Expand Down
2 changes: 1 addition & 1 deletion Source/PropertyGraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ end

function add_labeled_node!(g::DataGraph, node_labels=[], data_label=-1)
add_vertex!(g.graph)
g.vertex_labels = [g.vertex_labels..., node_labels]
push!(g.vertex_labels, node_labels)
end

function print_graph!(g::PropertyGraph)
Expand Down
1 change: 1 addition & 0 deletions Source/QuasiStableCardinalityEstimator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ function handle_extra_edges!(query::QueryGraph, summary::ColorSummary{DS}, parti
probability_no_edge *= 1.0 - get_independent_cycle_likelihood(edge_label, child_label, parent_color, child_color, summary)
end
end
probability_no_edge *= 1.0 - summary.total_added_edges/summary.total_nodes^2
partial_weights[i] = scale_coloring(partial_weights[i], (1.0 - probability_no_edge))
end
end
Expand Down

0 comments on commit e27140d

Please sign in to comment.