pub struct CochangeGraph { /* private fields */ }vcs-git only.Expand description
A sparse, undirected, weighted co-change graph built incrementally across a history walk.
Paths are interned to FileIds and adjacency is stored sparsely
(Vec<HashMap<FileId, u32>> indexed by node), so memory scales with
the number of observed co-change pairs, not with files². Two graphs
are tracked in lock-step — the full long-window graph and the
recent-window subgraph — so both entropy variants come from one walk.
Implementations§
Source§impl CochangeGraph
impl CochangeGraph
Sourcepub fn record_commit<P: AsRef<Path>>(&mut self, paths: &[P], in_recent: bool)
pub fn record_commit<P: AsRef<Path>>(&mut self, paths: &[P], in_recent: bool)
Record that every file in paths changed together in one commit,
adding (or strengthening) an edge between each unordered pair.
Commits touching more than MAX_COCHANGE_COMMIT_FILES files are
skipped to bound the O(width²) edge growth of bulk imports. When
in_recent is set, the edges are added to the recent subgraph too.
Sourcepub fn entropy(&self, path: &Path) -> (f64, f64)
pub fn entropy(&self, path: &Path) -> (f64, f64)
Co-change entropy (long, recent) for path, in bits.
Returns (0.0, 0.0) for a path that was never recorded or that
only ever appeared in single-file commits — by definition it has
no co-change neighbours. That zero is computed, not “missing”:
every file in a VCS walk receives a value.
Trait Implementations§
Source§impl Clone for CochangeGraph
impl Clone for CochangeGraph
Source§fn clone(&self) -> CochangeGraph
fn clone(&self) -> CochangeGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more