Re: graph theory: degree() reports the degree of a self-loop as contributing 1 to total degree

97 views
Skip to first unread message
Message has been deleted

Nathann Cohen

unread,
Feb 28, 2010, 9:44:13 AM2/28/10
to sage-devel
> 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:

I never use looped graphs or multigraphs, but I agree I would expect a
2 in this situation. It fits with the fact that you can always orient
a graph in such a way that all the degrees are divided by two (+1 if
the degree is odd).

This should be easy to fix in c_graph.pyx or directly in the backends
for dense/sparse graphs. Anyway, this should not happen :

sage: G = Graph({1:[1]}); G.degree(1)
1
sage: G = Graph({1:[1]}, implementation="networkx"); G.degree(1)
2

Nathann

Reply all
Reply to author
Forward
Message has been deleted
0 new messages