Skip to content

Add potentially connected check for degree sequences - #2924

Draft
Tagl wants to merge 2 commits into
igraph:mainfrom
Tagl:feat/potentially-connected
Draft

Add potentially connected check for degree sequences#2924
Tagl wants to merge 2 commits into
igraph:mainfrom
Tagl:feat/potentially-connected

Conversation

@Tagl

@Tagl Tagl commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Adds the function is_potentially_connected which takes as input a degree sequence for the undirected case or degree sequences for the directed case.
The function assumes the input has been checked previously to be graphical.
The function returns true if there exists at least one realization which is weakly or strongly connected, depending on chosen mode.
The function supports simple graphs with or without loops and multigraphs with or without loops, with the exception of strongly connected simple graphs with self-loops, which returns IGRAPH_UNIMPLEMENTED for now.

The time complexity and memory complexity of the function is $\mathcal{O}(n)$ and the bucket sort used is implemented in a way that minimizes allocations, similar to existing implementation of is_graphical_directed_simple

  • By submitting this pull request, I assign the copyright of my contribution to The igraph development team.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.43478% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.55%. Comparing base (e8e03b2) to head (06bd28b).

Files with missing lines Patch % Lines
src/misc/graphicality.c 90.43% 11 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2924      +/-   ##
==========================================
+ Coverage   75.53%   75.55%   +0.02%     
==========================================
  Files         406      406              
  Lines       75426    75541     +115     
  Branches    15081    15112      +31     
==========================================
+ Hits        56974    57078     +104     
- Misses      18452    18463      +11     
Files with missing lines Coverage Δ
src/misc/graphicality.c 96.21% <90.43%> (-1.99%) ⬇️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8e03b2...06bd28b. Read the comment docs.

🚀 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