-
Notifications
You must be signed in to change notification settings - Fork 47
Fill in reduction with Cuthill-McKee ordering #182
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
Nested dissection is a method to find a good permutation on sparse matrices representing loosely connected graphs. This kind of matrix is common for differential operators on discrete manifolds such as triangle meshes, or on tetrahedral meshes.
This will be nice to visualize the effect of nested dissection.
Now the nested dissection knows the size of all parts during its traversal, allowing it to stop the BFS early enough and ensure it creates equal splits.
Previous fix would record the correct permutation, but would not ensure the nested_dissection calls were issued with the components taken into account. This patch is a simple way to fix that: each time a connected component is identified, our nested dissection is run on it.
The gain is quite interesting when seen on triangle meshes.
This will enable saving an image to ease visualization.
We only need to be able to render pngs in our example.
Need to read more on the theory before implementing a good nested dissection. Cuthill-McKee is already useful though. I'm explicitly keeping the nested dissection experiments in the history in case it turns out to be useful later on.
CI fails because of a compiler regression apparently, see bluss/matrixmultiply#50 and rust-lang/rust#67743 I'll wait for the fix I guess. |
866b343
to
e0c7c61
Compare
Hey @vbarrielle :) From the changes I can't quite see, if you have considered implementing the reverse Cuthill-Mckee algorithm instead? It is typically at least as good as the 'normal' ordering, and easy to obtain - simply reverse the ordering. One question: Why do you not check if a vertex is unvisited before pushing to Also, you seem to have choosen to always select a vertex of minimum degree as starting vertex. I believe it is state of the art to instead choose a pseudoperipheral vertex. Or did you decide that is too costly to compute for your users typical use cases? |
Some more remarks- I'm really sorry if I am wasting your time. You sort using the stable method. Why not use Some background: I have tweaked my rust implementation of this algorithm over the last few days, and would just like to share some insights I gained, with a commonly used crate. I could prepare a PR, but I am not familiar with this codebase. Some mentoring would be required. |
Hello @LukiRe, thanks for your feedback, it will be particularly interesting if you're researching fill-in reducing algorithms. The main answer to all you questions would be that this PR was a first step towards understanding this topic which is new to me. Here are detailed answers to your questions:
If you want to open a PR to share your own implementation, I'm definetely open to it, and I can help you around with the codebase. Simply open a new issue with you questions. |
The Cuthill-McKee ordering permutes a symmetric sparse matrix such that its profile is reduced. This in turn implies less additional nonzeros in Cholesky factorizations.
This pull request adds the ability to compute this ordering and to apply it to a matrix.
It also adds the ability to visualize the nonzero pattern of a sparse matrix to check the profile reduction.
To have good example matrices, the ability to create the (graph) laplacian matrix of a triangle mesh has also been added.