Loading...

sagedevel@googlegroups.com
[Prev] Thread [Next]  [Prev] Date [Next]
[sagedevel] graph theory: degree() reports the degree of a selfloop as contributing 1 to total degree Minh Nguyen Sun Feb 28 07:00:04 2010
Hi folks, Given a graph G with one vertex v having a selfloop at v, I would expect the total degree of G to be 2, since the total degree is twice the number of edges. But this is not the case as shown below for the case of undirected (multi)graphs: [EMAIL PROTECTED] mvngu]$ sage   Sage Version 4.3.3, Release Date: 20100221   Type notebook() for the GUI, and license() for information.   sage: G = Graph({1:[1]}); G Looped graph on 1 vertex sage: sum(G.degree()) 1 sage: G.size() 0 sage: G = Graph({1:[1]}, loops=True); G Looped graph on 1 vertex sage: sum(G.degree()) 1 sage: G.size() 0 sage: G = Graph({1:[1]}, loops=True, multiedges=True); G Looped multigraph on 1 vertex sage: sum(G.degree()) 1 sage: G.size() 0 The size of G is 1 because there is one edge, i.e. the single selfloop. As shown by the above session, Sage reports the size of G as 0. I believe this is a bug.  Regards Minh Van Nguyen  To post to this group, send an email to [EMAIL PROTECTED] To unsubscribe from this group, send an email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sagedevel URL: http://www.sagemath.org
 [sagedevel] graph theory: degree() reports the degree of a selfloop as contributing 1 to total degree Minh Nguyen 2010/02/28 <=