4.1. igraph_community_walktrap — This function is the implementation of the Walktrap community

int igraph_community_walktrap(const igraph_t *graph, 
			      const igraph_vector_t *weights,
			      int steps,
			      igraph_matrix_t *merges,
			      igraph_vector_t *modularity);

finding algorithm, see Pascal Pons, Matthieu Latapy: Computing communities in large networks using random walks, http://arxiv.org/abs/physics/0512106

Currently the original C++ implementation is used in igraph, see http://www.liafa.jussieu.fr/~pons/index.php?item=prog&item2=walktrap&lang=en I'm grateful to Matthieu Latapy and Pascal Pons for providing this source code.

Note that the graph must not contain isolated vertices in order to use this method.

Arguments: 

graph:

The input graph.

weights:

Numeric vector giving the weights of the edges. If it is a NULL pointer then all edges will have equal weights.

steps:

Integer constant, the length of the random walks.

merges:

Pointer to a matrix, the merges performed by the algorithm will be stored here (if not NULL). Each merge is a row in a two-column matrix and contains the ids of the merged clusters. Clusters are numbered from zero and cluster number smaller than the number of nodes in the network belong to the individual vertices as singleton clusters. In each step a new cluster is created from two other clusters and its id will be one larger than the largest cluster id so far. This means that before the first merge we have n clusters (the number of vertices in the graph) numbered from zero to n-1. The first merge created cluster n, the second cluster n+1, etc.

modularity:

Pointer to a vector. If not NULL then the modularity score of the current clustering is stored here after each merge operation.

Returns: 

Error code.

See also: 

igraph_community_spinglass(), igraph_community_edge_betweenness().

Time complexity: O(|E||V|^2) in the worst case, O(|V|^2 log|V|) typically, |V| is the number of vertices, |E| is the number of edges.