pub struct HdtStats {
pub tree_cuts: u64,
pub candidate_edges: u64,
pub replacements: u64,
pub tree_promotions: u64,
pub non_tree_promotions: u64,
pub levels_visited: u64,
}Expand description
Cumulative HDT repair work, from HdtGraph::stats.
A stable interface of the experimental HDT engine
(crate::EngineConfig::Hdt). The struct is exhaustive: its six public
fields are frozen for 1.x, and a new field requires a major release.
§Guaranteed
- Each field counts the event its documentation names, in units of events.
- Every counter is
0on a new graph (HdtGraph::new,Default) and afterHdtGraph::reset_stats. - Between resets, counters only grow, and each saturates at
u64::MAXinstead of wrapping. - Queries (
HdtGraph::connected,HdtGraph::node_count,HdtGraph::edge_count,HdtGraph::stats,HdtGraph::storage_stats) never change them. replacements <= tree_cuts(at most one replacement per removed spanning edge),replacements <= candidate_edges(a replacement is an examined candidate) andtree_cuts <= levels_visited(each removed spanning edge visits at least one level).
§Implementation-dependent
The exact values for a given operation sequence: which edges belong to the spanning forest, which edges are promoted, the order in which candidates are examined and how many levels are visited depend on the implementation and may change in any release. Do not compare values across versions.
§Examples
use knotrel_core::{HdtGraph, HdtStats};
let mut graph = HdtGraph::new();
graph.link(1, 2)?;
graph.link(2, 3)?;
graph.link(3, 1)?;
graph.cut(1, 2)?;
let stats = graph.stats();
assert!(stats.replacements <= stats.tree_cuts);
assert!(stats.replacements <= stats.candidate_edges);
graph.reset_stats();
assert_eq!(graph.stats(), HdtStats::default());Fields§
§tree_cuts: u64Removed edges that belonged to the spanning forest.
candidate_edges: u64Exact-level non-tree edges examined for replacement (once per visit).
replacements: u64Successful replacements of a removed spanning edge.
tree_promotions: u64Increases of a tree edge’s level, each adding it to one higher forest.
non_tree_promotions: u64Increases of an internal non-tree edge’s level.
levels_visited: u64Replacement-search levels visited after tree cuts.