Skip to content

WIP: Add an is_chordal algorithm #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Luis-Varona
Copy link

We implement Tarjan and Yannakakis (1984)'s MCS algorithm, taking inspiration from the existing NetworkX implementation. Everything is done except for example doctests in src/chordality.jl and unit tests in test/chordality.jl. (This PR is part of a new suite of algorithms outlined in issue #431.)

We implement Tarjan and Yannakakis (1984)'s MCS algorithm, taking inspiration from the existing NetworkX implementation. Everything is done except for example doctests in src/chordality.jl and unit tests in test/chordality.jl. (This PR is part of a new suite of algorithms outlined in issue JuliaGraphs#431.)
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 97.09%. Comparing base (c001dab) to head (eeb10f4).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/chordality.jl 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #434      +/-   ##
==========================================
- Coverage   97.41%   97.09%   -0.32%     
==========================================
  Files         120      121       +1     
  Lines        6953     6982      +29     
==========================================
+ Hits         6773     6779       +6     
- Misses        180      203      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@simonschoelly
Copy link
Member

Do you by any change know where I could find a public accessible version of that paper? My usual methods did not help.

@Krastanov
Copy link
Member

out.pdf

The paper is attached here, courtesy of the UMass library.

@Luis-Varona
Copy link
Author

out.pdf

The paper is attached here, courtesy of the UMass library.

Wonderful, @Krastanov, thanks!

@Luis-Varona
Copy link
Author

@simonschoelly, just wanted to let you know I certainly haven't abandoned this PR. I was busy with work this past week and I'm at a conference this weekend, but I'll get back to it shortly. I've looked over your comments and it shouldn't be many more changes at all anyway, hehe.

Originally, we restricted the input type for is_chordal to AbstractSimpleGraph to rule out parallel edges, but some other graph types we would like to support (such as SimpleWeightedGraph) are of the more general AbstractGraph type. It turns out the current AbstractGraph interface aleady does not support parallel edges, so there is no worry here--it is already stated in the Implementation Notes anyway that is_chordal should not take in graphs with parallel edges as input.
@Luis-Varona
Copy link
Author

@simonschoelly, just changed the input type from AbstractSimpleGraph to AbstractGraph. Anything else you'd like me to change before I get around to adding tests?

@Luis-Varona
Copy link
Author

Wait—I just remembered your comment about induced subgraphs. I'll think about that and get back to you I was largely just porting over networkx's implementation, which does do this, but it probably really isn't optimal.

@simonschoelly
Copy link
Member

@simonschoelly, just wanted to let you know I certainly haven't abandoned this PR. I was busy with work this past week and I'm at a conference this weekend, but I'll get back to it shortly. I've looked over your comments and it shouldn't be many more changes at all anyway, hehe.

Don't worry - we are quite slow with reviewing PRs here :D

Originally mirroring the networkx implementation, we created a new AbstractGraph object every time we tested subsequent neighbors in the potential PEO with the induced_subgraph function. This commit makes our implementation more performant by simply taking the vertex (sub)set and checking to see if all pairs are adjacent via iteration.

Additionally, we change inconsistent naming in certain parts ('node' vs 'vertex'), changing everything to 'vertex' where relevant.
@Luis-Varona
Copy link
Author

@simonschoelly @Krastanov I've fixed the issue regarding unnecessary allocations with induced_subgraph, instead having the _induces_clique helper take in a vertex subset and, in the context of the original graph, confirm that all possible edges exist. @simonschoelly, is there anything else I should change before I start on unit tests and docstring examples?

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.

3 participants