Loading...

sage-devel@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

[sage-devel] graph theory: degree() reports the degree of a self-loop 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 self-loop 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: 2010-02-21                       |
| 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 multi-graph 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
self-loop. 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/sage-devel
URL: http://www.sagemath.org