Skip to content

docs: say which icebug algorithms use exported edge weights - #218

Open
prrao87 wants to merge 1 commit into
mainfrom
docs/weighted-icebug-algorithms
Open

prrao87 wants to merge 1 commit into
mainfrom
docs/weighted-icebug-algorithms

Conversation

@prrao87

@prrao87 prrao87 commented Nov 26, 2026

Copy link
Copy Markdown
Member

Why

#200 added edge weights to export_graph, and the docs said only that algorithms "such as ib.distance.Dijkstra" use them. That left readers to guess about the rest, and #200's note "Not covered: icebug's weighted community detection or centrality beyond Dijkstra" read as if the export didn't support them. It does: once Graph.fromCSR gets the weight arrays, icebug decides per algorithm whether to read them. Some algorithms in icebug 13.6 ignore them without a warning, one refuses a weighted graph, and two need an editable copy. This PR says which is which.

What changed

The graph algorithms page gets a "Weighted algorithms in icebug" section:

  • A table per icebug module of the algorithms that use the weights and those that ignore them without a warning. For example, Betweenness, PLM (Louvain) and ParallelLeiden use them; KadabraBetweenness, TopCloseness and SpanningForest don't. ApproxElectricalCloseness raises an error on a weighted graph.
  • A copy for edge ids. SpanningEdgeCentrality and flow.EdmondsKarp need indexEdges(), which fails on a read-only fromCSR graph. They run on ib.Graph(graph, weighted=True, directed=...); without weighted=True the copy drops the weights.
  • What needs an icebug change. A note says lance-csr can't lift these limits: running without the copy needs icebug to allow indexEdges() on fromCSR graphs, and the ignoring algorithms need weighted versions in icebug.
  • Length or strength. Shortest paths, betweenness and closeness read a weight as a length; PageRank, community detection, maximum spanning forests and matchings read it as a strength. The section shows how to pass the inverse, and that Dijkstra assumes no negative weights, which the export doesn't check.

Three new icebug tests check the claims: weighted betweenness takes the cheap route only, Louvain separates two groups of a complete graph by weight alone, and the copy keeps the weights (a max flow of 6 against 2 with unit capacities) while a plain copy drops them. Like the existing icebug tests, they skip when icebug isn't installed.

Validation

  • The table comes from running each algorithm on a 300-node, 2,400-edge random graph with unit and random weights and comparing outputs. For the randomized algorithms (approximate betweenness and closeness, Louvain, Leiden), results were compared with the exact weighted and unweighted answers instead, and for forests and matchings by the edges chosen. icebug's embedding, sparsification and link-prediction modules weren't checked.
  • The five icebug tests pass with uv run --no-sync --with icebug==13.6 --with networkx pytest python/tests/test_graph_export.py -k icebug; the Louvain test passed 15 runs out of 15.
  • Without icebug, the file passes with the icebug tests skipped (11 passed, 5 skipped).
  • make lint, docs/check_snippets.py, zensical build --strict and typos: pass. CI hasn't run yet.

🤖 Generated with Claude Code

The graph algorithms page only said that algorithms such as Dijkstra use
the weights. In icebug 13.6 some algorithms ignore them without a warning,
one refuses weighted graphs, and two need an editable copy that keeps the
weights. List each, note which limits need icebug changes, and test
weighted betweenness, Louvain and the copy.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: 32a11ea
Status: ✅  Deploy successful!
Preview URL: https://22529e45.lance-csr.pages.dev
Branch Preview URL: https://docs-weighted-icebug-algorit.lance-csr.pages.dev

View logs

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant