graph health: fix-categories, cap-degree, link-orphans
Three new tools for structural graph health: - fix-categories: rule-based recategorization fixing core inflation (225 → 26 core nodes). Only identity.md and kent.md stay core; everything else reclassified to tech/obs/gen by file prefix rules. - cap-degree: two-phase degree capping. First prunes weakest Auto edges, then prunes Link edges to high-degree targets (they have alternative paths). Brought max degree from 919 → 50. - link-orphans: connects degree-0/1 nodes to most textually similar connected nodes via cosine similarity. Linked 614 orphans. Also: community detection now filters edges below strength 0.3, preventing weak auto-links from merging unrelated communities. Pipeline updated: consolidate-full now runs link-orphans + cap-degree instead of triangle-close (which was counterproductive — densified hub neighborhoods instead of building bridges). Net effect: Gini 0.754 → 0.546, max degree 919 → 50.
This commit is contained in:
parent
6c7bfb9ec4
commit
94dbca6018
5 changed files with 297 additions and 2 deletions
|
|
@ -922,6 +922,27 @@ pub fn consolidate_full(store: &mut Store) -> Result<(), String> {
|
|||
}
|
||||
}
|
||||
|
||||
// --- Step 3b: Link orphans ---
|
||||
log.write("\n--- Step 3b: Link orphans ---")?;
|
||||
println!("\n--- Linking orphan nodes ---");
|
||||
*store = Store::load()?;
|
||||
|
||||
let (lo_orphans, lo_added) = neuro::link_orphans(store, 2, 3, 0.15);
|
||||
log.write(&format!(" {} orphans, {} links added", lo_orphans, lo_added))?;
|
||||
|
||||
// --- Step 3c: Cap degree ---
|
||||
log.write("\n--- Step 3c: Cap degree ---")?;
|
||||
println!("\n--- Capping node degree ---");
|
||||
*store = Store::load()?;
|
||||
|
||||
match store.cap_degree(50) {
|
||||
Ok((hubs, pruned)) => {
|
||||
store.save()?;
|
||||
log.write(&format!(" {} hubs capped, {} edges pruned", hubs, pruned))?;
|
||||
}
|
||||
Err(e) => log.write(&format!(" ERROR: {}", e))?,
|
||||
}
|
||||
|
||||
// --- Step 4: Digest auto ---
|
||||
log.write("\n--- Step 4: Digest auto ---")?;
|
||||
println!("\n--- Generating missing digests ---");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue