#13289: Determine if a vertex is a cut vertex
---------------------------------+------------------------------------------
       Reporter:  dcoudert       |         Owner:  jason, ncohen, rlm
           Type:  enhancement    |        Status:  needs_review      
       Priority:  major          |     Milestone:  sage-5.3          
      Component:  graph theory   |    Resolution:                    
       Keywords:                 |   Work issues:                    
Report Upstream:  N/A            |     Reviewers:                    
        Authors:  David Coudert  |     Merged in:                    
   Dependencies:                 |      Stopgaps:                    
---------------------------------+------------------------------------------

Comment (by sluther):

 Nice work!

 1)
 {{{
 4034            if not u in self.vertices():
 }}}
 should be:
 {{{
 4034            if u not in self:
 }}}

 2) Any reason you're using self._directed instead of self.is_directed() \\
 3)
 {{{
 while len(queue) > 0:
 }}}
 should be:
 {{{
 while queue:
 }}}
 4) There is a potential performance optimization. Currently you first
 perform the full dfs and then check if all neighbors of v have been seen.
 You could instead mark the neighbors as seen once you saw them and abort
 the dfs once you saw all of them. \\
 i.e. store them in a set and call discard on the set whenever you add a
 vertex to 'seen'. Then abort the dfs when the set is empty.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13289#comment:15>
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.

Reply via email to