#18250: G.triangles_count speedup
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_review
           Type:         |    Milestone:  sage-6.7
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:  graph  |    Reviewers:  Vincent Delecroix
  theory                 |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  fd88c98cfc2fee8d0750cd9b6f88d1d7b8177ed4
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  public/18250           |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by vdelecroix):

 Replying to [comment:15 ncohen]:
 > > The method `matrix` does work for non simple graphs, right? (after
 removing the loops)
 >
 > After removing loops and multiple edges, yes.

 Please, consider the following '''right''' answers
 {{{
 sage: G = Graph([(0,1),(0,1),(1,2),(2,0)], multiedges=True)
 sage: (G.adjacency_matrix()**3).trace() / 6
 2
 sage: sage: G = Graph([(0,1),(0,1),(1,2), (1,2), (2,0)], multiedges=True)
 sage: (G.adjacency_matrix()**3).trace()//6
 4
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18250#comment:16>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to