| adjacent.triangles {igraph} | R Documentation |
Count how many triangles a vertex is part of, in a graph.
adjacent.triangles (graph, vids = V(graph))
graph |
The input graph. It might be directed, but edge directions are ignored. |
vids |
The vertices to query, all of them by default. This might be a vector of numeric ids, or a character vector of symbolic vertex names for named graphs. |
Count how many triangles a vertex is part of.
A numeric vector, the number of triangles for all vertices queried.
Gabor Csardi csardi.gabor@gmail.com
## A small graph
kite <- graph.famous("Krackhardt_Kite")
atri <- adjacent.triangles(kite)
plot(kite, vertex.label=atri)
## Should match, local transitivity is the
## number of adjacent triangles divided by the number
## of adjacency triples
transitivity(kite, type="local")
adjacent.triangles(kite) / (degree(kite) * (degree(kite)-1)/2)