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
speed up edge_connectivity in easy cases #7854
Comments
comment:1
Small modifications, good results :
After :
|
comment:2
Nathann, I tried before the patch but got:
Which LP package did you use? CBC or GLPK? Did you check you got a speedup with both? |
comment:3
Hello !!!! Actually, the patch works with any LP solver which is installed. This patch just avoids the use of LP when it is possible -- when the graph isn't connected, or not 2-connected. The functions used are written in Cython, which makes them almost instantaneous to use. Actually, checking the connectivity for low values this way is even faster than just generating the linear program, so it definitely is good to have :-) Nathann |
comment:4
thanks Nathann for your answer.
thus it seems to me some work is needed, because according to the patch documentation, after Paul |
comment:5
Hello !! It was even worse than this... The patch made Sage check manually if the graph was 1- or 2-connected, even if the user requested the weights on the edges to be taken into account, which would clearly have returned wrong results at some point, as the speedup only considered the graph's topology. It now checks this option is set to False. I also set it to False by default, so that the user will be able to enjoy these speed-ups. Anyway, I think it is best not to use the edges' weights by default. I very frequently deal with graph having tuples as labels to remember a lot of informations, and this function wouldn't like it at all :-) (several minutes later) Ahem... And I also noticed a bug that had me worried for a while. When testing docstrings, I found that the PappusGraph was only 1-connected instead of 3-connected, and the LP seemed to be in fault. In the end, I just noticed I had called "g" the strongly connected orientation, which was the main graph's name !!!!! Better this way... ;-) Thank you for your help ! Nathann |
Attachment: trac_7854.patch.gz |
Author: Nathann Cohen |
comment:6
Now the patch gives floating-point values as before. (This might be solved in a further ticket, thus I give a positive review for the present one.) |
Reviewer: Paul Zimmermann |
comment:7
The reason is that this function handles weighted edges, and those edges may be weighted with floating-point values :-) I am myself only interested by "topological" connectivity, in which all edges are weighted with 1, but I do not really mind as long as connectivity() == k works... Thank you very much for your help !!! Nathann |
Merged: sage-4.3.4.alpha0 |
This functions uses LP and has a big overhead because of that... Is many cases, though, the graph is not connected, or not 2-connected.
To test if a graph is connected, we already have the function is_connected which does the job very efficiently through depth-first-searches.
We also have a function is_strongly_connected for DiGraphs.
To test if a Graph is 2-connected, we can first :
Without this, much time is spent over building a useless Linear Program.
Nathann
Component: graph theory
Author: Nathann Cohen
Reviewer: Paul Zimmermann
Merged: sage-4.3.4.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7854
The text was updated successfully, but these errors were encountered: