Processing math: 100%
Ask Your Question
1

degree versus in_degree

asked 5 years ago

djp gravatar image

updated 5 years ago

tmonteil gravatar image

I have a problem when calling degree and in_degree on directed graph I loaded. In particular, I had thought, for a particular node, that degree = in + out degree but am getting a situation where in_degree > degree for a given node. Here is the output for a graph I loaded:

sage: T.in_degree(vertices=[0],labels=True)
{0: 628}
sage: T.degree(vertices=[0],labels=True)
{0: 394}

This is also the case for other nodes in the graph.

Any idea what's going on here?

thanks! --David

Preview: (hide)

Comments

1

There might be a bug, could you please provide the code for T so that we can inspect further ?

tmonteil gravatar imagetmonteil ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 5 years ago

dan_fulea gravatar image

This is an answer, because it could not be inserted as a comment. The following code starts the check in a special case of a directed graph given by the divisibility relation on the integers from 1 to 120:

sage: g = DiGraph([[1..120], lambda i,j: i != j and i.divides(j)])
sage: checklist = []
sage: for v in g.vertices():
....:     in_v  = g. in_degree(vertices=[v], labels=True)[v]
....:     out_v = g.out_degree(vertices=[v], labels=True)[v]
....:     deg_v = g.    degree(vertices=[v], labels=True)[v]
....:     checklist.append( in_v + out_v == deg_v )
....:      
sage: False in checklist
False
sage: checklist == 120*[True]
True

So the checklist contains only the True value. This is ok. Which is the result for the graph T from the OP? Which is the method used to construct it? Is there a minimal example reproducing the same error / incompatibility?!

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 5 years ago

Seen: 660 times

Last updated: Sep 13 '19