-
Notifications
You must be signed in to change notification settings - Fork 1
Improve DenseNautyGraph implementation #25
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
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
This is great! Here are my personal answers to topics you brought up, but plenty of what I say here is a matter of taste:
Could you email me at skrastanov@umass.edu so that I can send you the bounty processing details (for when the bounty is finished) |
Thanks for the detailed feedback! I will just go ahead and merge this PR, and extend the readme, add aqua/jet, and follow your other suggestions in the coming PRs. GraphInterfaceChecker is now also included in the tests. |
FYI, JET relies heavily on the compiler, and has way fewer false positives in newer versions. Generally I run it only on the latest julia version. |
Another thing that might make your life easier: move all test dependencies to test/Project.toml and do not specify compat bounds for them -- that way you will have way simpler compat and way less work for the CompatHelper bot. |
Yeah, I will make that change soon; managing the test dependencies on different julia versions is a bit of a headache. Thanks for the suggestions! |
This PR greatly improves the basic implementation of the
DenseNautyGraph
graph type and is the first of a series of PRs that will work towards this bounty: JuliaGraphs/Graphs.jl#452.Main Changes
The low-level implementation of
DenseNautyGraph
has been simplified andDenseNautyGraph
now satisfies the Graphs.jl API. The dense graph format used by nauty stores the full adjacency matrix of the graph as a bit matrix. This bit matrix type is now mirrored on the Julia side in the form of theGraphset
type, which behaves similarly to the standard JuliaBitMatrix
, but is not the same (the name "graphset" is more or less borrowed from the nauty manual). The internal storage format of the bits is different, andGraphset
is resizable, so that the number of graph vertices can be changed. Most high level Graph.jl methods on aDenseNautyGraph
are now implemented via a corresponding low-level method acting on the underlyingGraphset
. There is also some minimal documentation added to the constructors ofDenseNautyGraph
.Questions & Issues
I don't know what level of detail the review should go to. Below is a list of questions or issues I have encountered, roughly in order of relevance.
Correct supertype: Right now, I define
DenseNautyGraph <: AbstractNautyGraph{Int} <: AbstractGraph{Int}
, since the vertices of aDenseNautyGraph
areInt
indices into the underlying adjacency matrix. Is this the correct choice? Is there anything to be gained from inheriting fromAbstractSimpleGraph
?Edge iterators: It is a bit unclear to me how strictly the behavior of
edges(g)
has to be defined. For now, I took a rather strict approach and I implementededges(::NautyGraph)
by defining methods forSimpleEdgerIterator{<:NautyGraph}
. This should lead to maximum compatibility, but is a bit cumbersome. A more lightweight approach would be to simple return an iterator over the nonzero elements of the adjacency matrix.UInt16
,UInt32
, orUInt64
. I did some quick tests, and the choices does not seem to make a big performance difference. The default choice (UInt64
) seems to be fastest for all graph sizes, if only slightly for small graphs (<32 vertices). So there is not really much point in using smaller integer types. On the other hand, having the option to change the integer type doesn't hurt either (and it doesn't really make the implementation more complicated), so I have left it in for now.@Krastanov please let me know if this type of summary of the PR is sufficiently clear, or if other comments/descriptions are needed. This PR is a pretty big refactor of the entire package, the following PRs will probably be much more self-contained and easier to review. Also, should I give you commit/maintain rights to the repo?