This function detects the community structure of a graph. To detect the community structure the user can choose one of the methods implemented in igraph.
methodCommunity(
graph,
method = c("walktrap", "edgeBetweenness", "fastGreedy", "louvain", "spinglass",
"leadingEigen", "labelProp", "infomap", "optimal", "other"),
FUN = NULL,
directed = FALSE,
weights = NULL,
steps = 4,
spins = 25,
e.weights = NULL,
v.weights = NULL,
nb.trials = 10
)
The output of prepGraph.
The clustering method, one of "walktrap", "edgeBetweenness", "fastGreedy", "louvain", "spinglass", "leadingEigen", "labelProp", "infomap", "optimal", "other".
in case the @method parameter is "other" there is the possibility to use a personal function passing its name through this parameter. The personal parameter has to take as input the @graph and the @weights (that can be NULL), and has to return a community object.
Logical constant, whether to calculate directed edge betweenness for directed graphs. This argument is settable only for "edgeBetweenness" method.
Optional positive weight vector. If the graph has a weight edge attribute, then this is used by default. Supply NA here if the graph has a weight edge attribute, but you want to ignore it. Larger edge weights correspond to stronger connections. This argument is not settable for "infomap" method.
The number of steps to take, this is actually the number of tries to make a step. It is not a particularly useful parameter. This argument is settable only for "leadingEigen" and "walktrap" method.
Integer constant, the number of spins to use. This is the upper limit for the number of communities. It is not a problem to supply a (reasonably) big number here, in which case some spin states will be unpopulated. This argument is settable only for "spinglass" method.
If not NULL, then a numeric vector of edge weights. The length must match the number of edges in the graph. By default the <U+2018>weight<U+2019> edge attribute is used as weights. If it is not present, then all edges are considered to have the same weight. Larger edge weights correspond to stronger connections. This argument is settable only for "infomap" method.
If not NULL, then a numeric vector of vertex weights. The length must match the number of vertices in the graph. By default the <U+2018>weight<U+2019> vertex attribute is used as weights. If it is not present, then all vertices are considered to have the same weight. A larger vertex weight means a larger probability that the random surfer jumps to that vertex. This argument is settable only for "infomap" method.
The number of attempts to partition the network (can be any integer value equal or larger than 1). This argument is settable only for "infomap" method.
A Communities object.
# NOT RUN {
my_file <- system.file("example/football.gml", package="robin")
graph <- prepGraph(file=my_file, file.format="gml")
methodCommunity (graph=graph, method="louvain")
# }
Run the code above in your browser using DataLab