#12108: is_eulerian doesn't handle disconnected graphs properly
----------------------------+-----------------------------------------------
Reporter: brunellus | Owner: jason, ncohen, rlm
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.8
Component: graph theory | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
----------------------------+-----------------------------------------------
Comment(by ncohen):
Replying to [comment:2 brunellus]:
> My first patch. :-)
And a good one ! `:-)`
Just one remark : the connected_components_number actually calls connected
components. So instead of computing the number of CC and *then* go over
all vertices, what would you think of something like that :
{{{
ok = True
for cc in self.connected_components():
if len(cc) > 1:
if ok:
ok = False
else:
return False
}}}
I feel like it could be faster, but that's really about milliseconds `:-)`
Nathann
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12108#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.