-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Reverse Cuthill-McKee and Maximum Bipartite Matching reorderings of sparse graphs #3751
Conversation
Added the symrcm function that takes a symmetric graph in CSR or CSC sparse format and returns an array of row and column permutations that reduces the overall bandwidth of the underlying matrix.
Changes Unknown when pulling 1c2106a on nonhermitian:master into * on scipy:master*. |
Changes Unknown when pulling 66960e0 on nonhermitian:master into * on scipy:master*. |
Changes Unknown when pulling 66960e0 on nonhermitian:master into * on scipy:master*. |
Looks good, as far as I can tell. This would close #3424. |
The name isn't very descriptive, needs to be expanded. Also, this algorithm has a fairly large overlap with |
@jakevdp want to have a look at this? |
include 'parameters.pxi' | ||
|
||
def symrcm(graph, symmetric_mode=False): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring format: need a one-line summary, then a blank line. The first line gets picked up in listing in html docs.
I'd be tempted to make the changes rgommers suggested into nonhermitian's PR except that the PR is on master rather than a separate branch. |
I have time tomorrow to make the changes. I will also add a maximal
|
- Added more descriptive name for RCM function - Made changes based on @rgommers suggestions. - Added non-symmetric maximum bipartite matching function.
Changes Unknown when pulling 7e6d153 on nonhermitian:master into * on scipy:master*. |
Regarding the TravisCI test failure, this would be fixed if the indices in the bipartite matching test were explicitly dtype int32? Looking at https://github.com/scipy/scipy/blob/master/scipy/sparse/csgraph/parameters.pxi the dtype of |
Changes Unknown when pulling 7e6d153 on nonhermitian:master into * on scipy:master*. |
I have explicitly set everything to dtype=int32. However, perhaps a fused type would work here. |
Yes fused types might work; these PRs/issues have some related discussion: #243 #2194 Edit: Now I think there is some subtle typing bug in the |
Changes Unknown when pulling a1461b0 on nonhermitian:master into * on scipy:master*. |
Changes Unknown when pulling a1461b0 on nonhermitian:master into * on scipy:master*. |
Changes Unknown when pulling 818ef33 on nonhermitian:master into * on scipy:master*. |
Changes Unknown when pulling ed23297 on nonhermitian:master into * on scipy:master*. |
Good catch, I guess this was the problem all along. I'd suspected it but mistakenly ruled it out when I saw similar code in qutip like https://github.com/qutip/qutip/blob/master/qutip/cy/graph_utils.pyx#L234. |
QuTiP doesn’t test against NumPy 1.5.1 so I had to do the old trial and error solution method to find this. On Jul 9, 2014, at 8:36 PM, argriffing notifications@github.com wrote:
|
Looks OK, but I'll wait for feedback of more experienced csgraphers. |
Changes Unknown when pulling 6aed2e4 on nonhermitian:master into * on scipy:master*. |
I found a bug, so hold off on pulling. |
- Also set length of temp_degrees array to the max node degree of the graph.
Test to verify node reordering works properly.
Changes Unknown when pulling eb85936 on nonhermitian:master into * on scipy:master*. |
What is the status of this PR? |
The code looks good to me --- I assume the bug mentioned by @nonhermitian above was fixed in eb85936. One question is using ITYPE_t which is int32 --- but it seems this is used for values with maximum value of shape[0] rather than nnz. It would actually be very interesting if this helps with gh-3831 |
Yes, the error in the RCM code was fixed in the last commit. As it turns out, all of the RCM tests had graphs with nodes of the same degree, so sorting wasn't being tested. In the last commit is an example that is more general, and that caught the bug. |
ENH: sparse.csgraph: Reverse Cuthill-McKee and Maximum Bipartite Matching reorderings of sparse graphs
Merging, LGTM. |
Added the symrcm function that takes a symmetric graph in CSR or CSC
sparse format and returns an array of row and column permutations that
reduces the overall bandwidth of the underlying matrix. This is useful for
direct and iterative sparse linear solvers.