Package networkx :: Module cluster

[frames | no frames]

## Module networkx.cluster

Compute clustering coefficients and transitivity of graphs.

Clustering coefficient

  For each node find the fraction of possible triangles that are triangles, c_i = triangles_i / (k_i*(k_i-1)/2) where k_i is the degree of node i.

  A coefficient for the whole graph is the average C = avg(c_i)

Transitivity

  Find the fraction of all possible triangles which are in fact triangles. Possible triangles are identified by the number of "triads" (two edges with a shared vertex)

  T = 3*triangles/triads

Function Summary
| ``average_clustering`(G)` Average clustering coefficient for a graph.
| ``clustering`(G, nbunch, **kwds)` Clustering coefficient for each node in nbunch
| ``transitivity`(G)` Transitivity (fraction of transitive triangles) for a graph
| ``triangles`(G, nbunch, **kwds)` Return number of triangles for nbunch of nodes.

Variable Summary
`str` | `__author__` = `'Aric Hagberg (hagberg@lanl.gov)\nPieter Sw...`
`str` | `__credits__` = `''`
`str` | `__date__` = `'$Date: 2005-06-14 12:48:10 -0600 (Tue, 14 Ju...`
`str` | `__revision__` = `'$Revision: 1012 $'`

Function Details

### average_clustering(G)

Average clustering coefficient for a graph.

Note: this is a space saving routine; It might be faster to use clustering to get a list and then take average.

### clustering(G, nbunch=None, **kwds)

Clustering coefficient for each node in nbunch

### transitivity(G)

Transitivity (fraction of transitive triangles) for a graph

### triangles(G, nbunch=None, **kwds)

Return number of triangles for nbunch of nodes. If nbunch is None, then return triangles for every node.

Note: Each triangle is counted three times: once at each vertex.

Variable Details

### __author__

  Type:
    `str`
  Value:

        '''Aric Hagberg (hagberg@lanl.gov)
        Pieter Swart (swart@lanl.gov)
        Dan Schult (dschult@colgate.edu)'''

### __credits__

  Type:
    `str`
  Value:

        ''

### __date__

  Type:
    `str`
  Value:

        '$Date: 2005-06-14 12:48:10 -0600 (Tue, 14 Jun 2005) $'

### __revision__

  Type:
    `str`
  Value:

        '$Revision: 1012 $'

Generated by Epydoc 2.1 on Sun Aug 21 08:06:58 2005 | http://epydoc.sf.net