[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2013-06-29 Thread leif
Nathann Cohen wrote: Three years later I got bitten by this again, and I now believe that the degree of a vertex incident with a loop should be 1. \o/ Because it is rather pleasant to be sure that the degree of a vertex is equal to the number of its neighbors O_o Although that in turn make

Re: [sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2013-06-27 Thread Nathann Cohen
Three years later I got bitten by this again, and I now believe that the degree of a vertex incident with a loop should be 1. Because it is rather pleasant to be sure that the degree of a vertex is equal to the number of its neighbors O_o Nathann On Thursday, May 6, 2010 2:43:43 AM UTC+2, leif

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-05-05 Thread Nathan O'Treally
On 5 Mai, 23:20, Fidel wrote: > Given a graph G, with a loop at vertex j. What is the convention > followed in sage for entry j,j of the adjacency matrix? > > sage: G=Graph({0:[0],1:[1]},allow_loops=True);G.am() > [1 0] > [0 1] > > Just wandering if it is a bug or a feature. What do you think is

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-05-05 Thread Fidel
Hello everyone! Just a side question to this discussion and after looking at #8395. http://trac.sagemath.org/sage_trac/ticket/8395 Given a graph G, with a loop at vertex j. What is the convention followed in sage for entry j,j of the adjacency matrix? sage: G=Graph({0:[0],1:[1]},allow_loops=Tru

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-24 Thread ablondin
Hello, everyone ! If I may add some comments. N. O'Trealy is right when he says that the best approach is to look at the mathematical definitions of objects. On the other hand, one needs to be careful. For instance, the set E of a graph G = (V,E), a directed graph G = (V,E) and a multigraph G = (

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-23 Thread Nathan O'Treally
On 23 Apr., 08:37, Nathann Cohen wrote: > For undirected graph, we settled recently on saying that the degree of > a single vertex with a loop is equal to 2, because we do not want the > inequality (sum of the degrees) = 2* (number of edges) broken. Equality, I guess :-) This unfortunately break

Re: [sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-22 Thread Nathann Cohen
Hmmm I am sorry but for once, I do not think this is really a matter of mathematical justification For undirected graph, we settled recently on saying that the degree of a single vertex with a loop is equal to 2, because we do not want the inequality (sum of the degrees) = 2* (number of ed

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-22 Thread Nathan O'Treally
On 23 Apr., 04:28, Minh Nguyen wrote: > [...] The above demonstrates a bug in > the implementation of degree() as it doesn't handle self-loops > consistently. I understand that the total degree of any graph is twice > the number of edges. If we only consider directed or undirected, cyclic or acyc

Re: [sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-22 Thread Minh Nguyen
Hi Leif, On Fri, Apr 23, 2010 at 7:47 AM, Nathan O'Treally wrote: > And for the single-node undirected circular graph: there's only one > edge, so degree can't be larger than 1. I think the method degree() of CGraphBackend has a bug similar to that which is tracked at ticket #8395 [1]. For a

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-22 Thread Nathan O'Treally
On 22 Apr., 10:52, Nathann Cohen wrote: > In Sage, the "degree" of a vertex in a directed graph is the degree of > the same vertex in the undirected version of the graph. It is the > number of edges "touching" this vertex. If you just want the out- > degree (number of edges leaving the vertex), th

[sage-devel] Re: graph theory: clarify the purpose of keyword "directed" in degree() of CGraphBackend

2010-04-22 Thread Nathann Cohen
In Sage, the "degree" of a vertex in a directed graph is the degree of the same vertex in the undirected version of the graph. It is the number of edges "touching" this vertex. If you just want the out- degree (number of edges leaving the vertex), then it is out_degree (resp in-degree, in_degree).