I am very sorry to bug you so long, but I am bewildered now. Of course, the degree is a discrete variable. I said we treat it as a continuous variable because we don't categorize the degree values like we do for a gender. For example, we don't treat degree values 25 and 26 as two different categories. (Formula 7.82 in Newman's book). I am discarding repetitions because I wanted to treat unique degree values as discrete types. For example, to study mixing by genders, I will have first to find out the unique gender values. What is wrong with this? Thank you On Fri, Oct 6, 2017 at 4:21 PM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
On 06.10.2017 07:37, Snehal Shekatkar wrote:
First, the formula for gt.assortativity implies that we are talking about discrete categories for the vertices. If this is true, how can we use it at all for "degree" since we treat that as a continuous variable? Thus, I don't understand what does "in", "out" and "total" do in this formula.
Degrees are discrete, not continuous.
Second, I tried implementing the formula itself assuming that the actual degree values to be discrete types and my code gives different results than the result given by gt.assortativity. I agree that I might be interpreting the whole thing in a different fashion and I would be very happy to understand it. My code:
import numpy as np import graph_tool.all as gt
# Load a graph g = gt.collection.data['karate']
# Unique degree values or types deg_vals = list(set([v.out_degree() for v in g.vertices()])) n = len(deg_vals)
Why are you doing this? The moment you discard repetitions, all the fractions you compute will be wrong.
Why are these two values different?
Because they come from different algorithms.
Best, Tiago
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India