Skip to content

19 core - #120

Open
eriknw wants to merge 2 commits into
python-graphblas:18-tree-recognitionfrom
eriknw:19-core
Open

eriknw wants to merge 2 commits into
python-graphblas:18-tree-recognitionfrom
eriknw:19-core

Conversation

@eriknw

@eriknw eriknw commented Dec 2, 2026

Copy link
Copy Markdown
Member

Add core decomposition by peeling the graph a round at a time.

  • core_number, onion_layers
  • k_core, k_shell, k_crust, k_corona (graphs with data a matrix cannot hold, a precomputed core_number, and a k that is not a real number are left to NetworkX)
  • A self-loop raises NetworkXNotImplemented, as in NetworkX
  • The four k_ names carry the note on a rebuilt graph's weights taking one type, as the other graph-returning names do

Stacked on #119.

core_number peels the graph a round at a time: every node of degree
at most k leaves together, one masked product takes their edges off
their neighbors' degrees, and when a round finds no such node, k rises
to the smallest degree left. A node's core number is the k at which it
leaves. A directed graph's degree is its in-degree plus its
out-degree, so a pair with an edge each way counts twice, as in
NetworkX. onion_layers numbers the same rounds.

k_core, k_shell, k_crust and k_corona are subgraphs induced by the core
numbers, keeping the input's values and graph attributes; as for
k_truss, a graph with data a matrix cannot hold is left to NetworkX,
and so is a precomputed core_number. Self-loops raise NetworkX's
errors, and the results list their nodes in NetworkX's order.
k_core, k_corona, k_crust and k_shell rebuild their result from one
matrix as compose and k_truss do, so their additional_docs now carry
the same note on the type the edge weights come back in, in place of
the shorter one they had.
@eriknw eriknw mentioned this pull request Dec 2, 2026
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.51852% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.69%. Comparing base (17ae99e) to head (46e5006).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           18-tree-recognition     #120      +/-   ##
=======================================================
+ Coverage                92.55%   92.69%   +0.14%     
=======================================================
  Files                      177      178       +1     
  Lines                    10673    10938     +265     
  Branches                  1232     1253      +21     
=======================================================
+ Hits                      9878    10139     +261     
  Misses                     546      546              
- Partials                   249      253       +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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