-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
Eulerian orientation of a graph #7364
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Reviewer: Florent Hivert |
comment:6
Hi Nathann Patch looks good. All tests passed! I'm ready to put a Positive review. However, I'm not a graph expert so I've no idea how clever is the algorithm. Cheers, Florent |
comment:7
From the "complexity" point of view, this algorithm is linear in the number of edges in the graph, so I think it could be filed as "optimal". From the "practical" point of view, I do not think it would be easy to improve, though I am more and more thinking about trying to write such methods in C rather than in Python... Most of the time in these algorithms is spent on Python considerations rather than on actual Graph computations... I am sending a mail to sage-devel about your great idea of a general "Complexity" note in algorithms. Nathann |
comment:8
Replying to @nathanncohen:
You should use Sage's c_graphs directly: this will eliminate Python noise without forcing you to use pure C. Check out |
comment:9
Sorry, I should have pointed you to |
comment:10
Replying to @nathanncohen:
If the complexity is optimal, going from python to C will only improve the speed by a constant factor. Be sure it's really worth it before spending to much time. I'm a little extreme on this, but is it worth spending hours of researchears time, where we can spend money for a faster computer ? ;-) Note: this does not mean I'm not trying to improve the speed of my code ! It only means that a good algorithm is an slow language is much better than a bad algorithm in a fast language. When needed the first is much easier to improve. I'm generally reluctant towards premature optimization. Cheers, Florent |
comment:11
To Robert : Thank you very much !!!! I'll definitely give it a look ! But you make it sound like I would then have to work on a new graph rather than use the Python one ! In this case, I do not really need to create a new graph but I would like the functions "get an edge coming out of this vertex" and "tell me where it goes" to be extremely fast... When will the default Sage Graph the be C ones ? To Florent : I'm aware this only means changing a "factor", but I am living among computer scientists who find it extremely hard to stop thinking like "it is NP-complete : there is no algooorithm to solve it". And I swear I did not forget the word "polynomial". At some point I also wanted to write an algorithm ion Sage to compute the crossign number of a graph. Bruce Reed published a Linear Time algorithm for this problem, using Graph Minor theory. The result is a (2222222^2.... ) * n algorithm which no one can implement, even less use. That's why I prefer mentionning the "two". Besides, one of the reasons people in my lab keep from really switching to Sage is that they currently use Java, which is way faster. ( of course they have less algorithms, of course they miss many things, but Still, it is faster ) I'll update this patch today ! Nathann |
comment:12
I actually wrote 2{2{2{2{2^{...}}}}*n. |
comment:13
My god. I wrote what is called a "tower of exponentials". :-p |
comment:14
This patch should suit you :-) Nathann |
comment:15
Replying to @nathanncohen:
I'm really sorry to bother you again:
Is this a standard in graph theory to call 'm' the number of ??? Actually what ? Edge, Vertex or sum of Both... Maybe this is obvious but better explicit than implicit ;-) I promiss I'll give you a positive review after that ! |
comment:16
Done ! :-) |
Attachment: trac_7364.patch.gz |
comment:17
Ok ! Ready to go ! |
Merged: sage-4.3.alpha1 |
Author: Nathann Cohen |
Implements Graph.eulerian_orientation which returns a DiGraph corresponding to an eulerian orientation of the graph :
An eulerian orientation of an eulerian graph is an orientation such that
for any vertex.
If the graph is not eulerian, this method returns a DiGraph such that
and
Nathann
Component: graph theory
Author: Nathann Cohen
Reviewer: Florent Hivert
Merged: sage-4.3.alpha1
Issue created by migration from https://trac.sagemath.org/ticket/7364
The text was updated successfully, but these errors were encountered: