[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] the s-metric of Doyle et al

From: Tamas Nepusz
Subject: Re: [igraph] the s-metric of Doyle et al
Date: Thu, 15 Jul 2010 20:02:50 +0100

> I'm planning to calculate the s-metric of Doyle et al (link below) and 
> perform related calculations on several graphs and wonder if there's already 
> a body of igraph implementation around this metric. Thanks!
igraph does not implement the s-metric directly (assuming that it is Eq (8) in 
the Doyle et al paper), but it is very easy to calculate using one of the 
higher level interfaces. E.g., in Python, it simply boils down to the following:

def s_metric(graph):
    degrees = graph.degree()
    return sum(degrees[i] * degrees[j] for i, j in graph.get_edgelist())

I guess it's even shorter if you use the R interface, and it shouldn't be more 
than, say, 15 lines (with error checking) when using the C core directly.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]