Hi kcrisman,

On Mon, Nov 30, 2009 at 10:42 AM, kcrisman <kcris...@gmail.com> wrote:

<SNIP>

> That is odd; I am pretty sure there used to be such a method, maybe
> two years ago?

It turns out there is such a function. One could use
Graph.degree_iterator() as suggested by mhansen, or Graph.degree() as
suggested by ncohen. But the result must be sorted in non-increasing
order:

[mv...@sage ~]$ sage
----------------------------------------------------------------------
| Sage Version 4.2.1, Release Date: 2009-11-14                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: g = Graph({"a": ["b", "e"], "b": ["a", "g", "e", "c"], \
....: "c": ["b", "e", "d"], "d": ["c", "f"], "e": ["f", "a", "b", "c"], \
....: "f": ["g", "d", "e"], "g": ["b", "f"]})
sage: sorted(g.degree(), reverse=True)
[4, 4, 3, 3, 2, 2, 2]
sage: sorted(g.degree_iterator(), reverse=True)
[4, 4, 3, 3, 2, 2, 2]

-- 
Regards
Minh Van Nguyen

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to