Use this if you are using igraph from R
These functions find all, the largest or all the maximal weighted cliques in an undirected graph. The weight of a clique is the sum of the weights of its edges.
weighted_cliques( graph, vertex.weights = NULL, min.weight = 0, max.weight = 0, maximal = FALSE )
graph |
The input graph, directed graphs will be considered as undirected ones, multiple edges and loops are ignored. |
vertex.weights |
Vertex weight vector. If the graph has a |
min.weight |
Numeric constant, lower limit on the weight of the cliques to find.
|
max.weight |
Numeric constant, upper limit on the weight of the cliques to find.
|
maximal |
Specifies whether to look for all weighted cliques ( |
weighted_cliques
find all complete subgraphs in the input graph,
obeying the weight limitations given in the min
and max
arguments.
largest_weighted_cliques
finds all largest weighted cliques in the
input graph. A clique is largest if there is no other clique whose total
weight is larger than the weight of this clique.
max_weighted_cliques
finds all maximal weighted cliques in the input graph.
A weighted clique is maximal if it cannot be extended to a clique with larger
total weight. The largest weighted cliques are always maximal, but a maximal
weighted clique is not necessarily the largest.
count_max_weighted_cliques
counts the maximal weighted cliques.
weighted_clique_num
calculates the weight of the largest weighted clique(s).
weighted_cliques
and largest_weighted_cliques
return a
list containing numeric vectors of vertex IDs. Each list element is a weighted
clique, i.e. a vertex sequence of class igraph.vs
.
weighted_clique_num
and count_max_weighted_cliques
return an integer
scalar.
Tamas Nepusz ntamas@gmail.com and Gabor Csardi csardi.gabor@gmail.com
g <- make_graph("zachary") V(g)$weight <- 1 V(g)[c(1,2,3,4,14)]$weight <- 3 weighted_cliques(g) weighted_cliques(g, maximal=TRUE) largest_weighted_cliques(g) weighted_clique_num(g)