igraph-help
[Top][All Lists]
Advanced

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

[igraph] trying to translate redundancy measure for bipartite graph from


From: Simone Gabbriellini
Subject: [igraph] trying to translate redundancy measure for bipartite graph from python
Date: Fri, 1 Feb 2013 17:53:43 +0100

Hello List,

I have found this python code from networkx and I would like to port
it to r and use it along with igraph. It represents the redundancy
measure of Matthieu Latapy, Clèmence Magnien, Nathalie Del Vecchio,
"Basic notions for the analysis of large two-mode networks":

if nodes is None:
        nodes = G
    rc = {}
    for v in nodes:
        overlap = 0.0
        for u, w in combinations(G[v], 2):
            if len((set(G[u]) & set(G[w])) - set([v])) > 0:
                overlap += 1
        if overlap > 0:
            n = len(G[v])
            norm = 2.0/(n*(n-1))
        else:
            norm = 1.0
        rc[v] = overlap*norm
    return rc

is there any combinations() in r? something that explore all possible
combinations in a vector - as far as I have understood it...

Best,
Simone

-- 
Simone Gabbriellini, PhD

address@hidden, University of Bologna
mobile: +39 340 39 75 626
email: address@hidden
home: www.digitaldust.it

DigitalBrains srl
Amministratore
mobile: +39 340 39 75 626
email: address@hidden
home: www.digitalbrains.it



reply via email to

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