Skip to content

[Insights] "Sparse cluster" is unactionable on large wikis — cohesion is raw graph density, so every real topic cluster is flagged #731

Description

@CuongGIK

bug, insights, scalability

Summary

On a wiki of ~2,900 pages, the Sparse cluster knowledge-gap warning fires on 18 of 24 communities, covering 96.6% of all pages. It is not detecting a defect in my wiki — the metric it uses is raw graph density, which decays as O(1/n), so any community larger than roughly 55 pages can never clear the threshold no matter how well linked it is. The signal is therefore permanently on and carries no information at this scale.

Where it comes from

src/lib/wiki-graph-analysis.ts (detectCommunities):

const possibleEdges = nodeCount > 1 ? (nodeCount * (nodeCount - 1)) / 2 : 1
const cohesion = (intraEdgesByCommunity.get(communityId) ?? 0) / possibleEdges

src/lib/graph-insights.ts (detectKnowledgeGaps):

if (comm.cohesion < 0.15 && comm.nodeCount >= 3) { ... }

cohesion is the classic density measure 2E / (n(n-1)). Rewritten in terms of the average number of intra-community links per page:

cohesion = mean_intra_degree / (n - 1)

So the threshold cohesion >= 0.15 is equivalent to requiring

mean_intra_degree >= 0.15 * (n - 1)

A 100-page cluster would need every page to average ~15 links to other pages inside the same cluster; a 250-page cluster would need ~37. Real wikis do not look like that, and arguably should not — that is a near-complete graph.

Measurements from my project

Environment: LLM Wiki v0.6.11, Windows 11, project with 2,933 markdown files.

Graph as the app builds it (type: query pages excluded per HIDDEN_TYPES): 2,476 nodes, 10,069 unique edges, mean degree 8.1, median degree 6, and 99.6% of nodes in a single connected component — by any normal standard a well-connected graph.

I re-ran Louvain offline (networkx, resolution 1, unweighted — an approximation of the in-app weighted run) to reproduce what the panel sees:

communities ≥3 nodes flagged cohesion < 0.15 pages inside flagged clusters
29 24 18 2,393 / 2,476 (96.6%)

At this wiki's density, the largest community that can possibly pass the threshold is ~55 pages. Every genuine topic cluster is bigger than that.

Why this matters

The panel's other two signals are useful — isolated nodes is precise and actionable, bridge nodes is interesting — but they are drowned out by a warning that says "96.6% of your wiki is sparse" on every refresh. Worse, acting on it produces harm: the suggested remedy is "add links between these pages", which pushes users and LLM agents to insert filler wikilinks that degrade the graph's signal-to-noise. In my case the panel also generated a review item titled "1834 isolated pages", which a Deep Research run then turned into a page about the year 1834 — the noise propagates into content.

Proposed fixes

Any one of these would restore the signal; (1) is my recommendation because it is scale-invariant and directly actionable.

  1. Threshold on mean intra-community degree instead of density.

    const meanIntraDegree = nodeCount > 0 ? (2 * intraEdges) / nodeCount : 0
    // flag when meanIntraDegree < 2 (i.e. pages in this cluster average
    // fewer than two links to other pages in the same cluster)
    

    This does not change with cluster size, and the message can state something a user can act on: "pages in this cluster link to each other 0.8 times on average".

  2. Compare against the graph's own density rather than a fixed constant — flag a community only when its internal density is materially below the wiki-wide density (e.g. cohesion < 0.5 * globalDensity). This adapts to any wiki size automatically.

  3. Minimum viable change: only evaluate communities below a size where the constant is meaningful (nodeCount <= 50), and/or expose the threshold in .llm-wiki/lint-config.json so it can be disabled — related to Feature request: configurable lint rules (ignore orphan / no-outlinks) #266.

Happy to test a patch against this project; it is a reproducible large-wiki case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions