igraph-help
[Top][All Lists]
Advanced

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

[igraph] Transitivity


From: Delphine Faugaret
Subject: [igraph] Transitivity
Date: Thu, 27 Dec 2012 20:40:12 +0000 (GMT)

Hello everybody,

I would like to calculate the average clustering coefficient.
I therefore used transitivity function in igraph, and for my graph I've got the value: 0.5493 (global), 0.42 (average).
Reading the previous mail called "Small worlds in igraph", I think the "global" is best for what I want to show.
I also compared my results using 2 others softwares Gephi and networkx in python.
If I use this 2 way I have a average clustering coefficient of 0.2625 for networkx and 0.262 for Gephi.
So I don't understand why I can not find the same results with igraph (0.42)

On networkx website I found how they did the function, but I don't know how to translate in R.

def average_clustering(G, nodes=None, weight=None, count_zeros=True):
    r"""Compute the average clustering coefficient for the graph G.

    The clustering coefficient for the graph is the average, 

    .. math::

       C = \frac{1}{n}\sum_{v \in G} c_v,
       
    where `n` is the number of nodes in `G`.

    Parameters
    ----------
    G : graph

    nodes : container of nodes, optional (default=all nodes in G)
       Compute average clustering for nodes in this container. 

    weight : string or None, optional (default=None)
       The edge attribute that holds the numerical value used as a weight.
       If None, then each edge has weight 1.

    count_zeros : bool (default=False)       
       If False include only the nodes with nonzero clustering in the average.

    Returns
    -------
    avg : float
       Average clustering

Thanks for your help,

And happy new years for everybody,

Delph

reply via email to

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