igraph (version 0.7.1)

adjacent.triangles: Count adjacenct triangles

Description

Count how many triangles a vertex is part of, in a graph.

Usage

adjacent.triangles (graph, vids = V(graph))

Arguments

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.

Value

  • A numeric vector, the number of triangles for all vertices queried.

Details

Count how many triangles a vertex is part of.

See Also

transitivity

Examples

Run this code
## 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)

Run the code above in your browser using DataLab