adjacent.triangles {igraph}R Documentation

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.

Details

Count how many triangles a vertex is part of.

Value

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

Author(s)

Gabor Csardi csardi.gabor@gmail.com

See Also

transitivity

Examples

## 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)

[Package igraph version 0.7.0 Index]