triangles.search: Search for triangles in an undirected graph

View source: R/triangles.search.R

Search for triangles in an undirected graphR Documentation

Search for triangles in an undirected graph

Description

Search for triangles in an undirected graph.

Usage

triangles.search(G) 

Arguments

G

The adjacency matrix of an undirected graph. G[i, j] = G[j, i] = 1 means there is an edge between modes i and j. Zero values indicate the absence of edges.

Details

The functions searches for triangles, that is for tripletes of nodes (or variables) for which X-Y, Y-Z and X-Z.

Value

A matrix with thre columns. If there are no triangles, the matrix is empty. If there is at least one triangle, then each row contains three numbers, one for each node. See the examples below.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr

See Also

plotnetwork, pc.skel, mmhc.skel

Examples

set.seed(123)
x <- rdag2(1000, p = 20, nei = 4)$x
a <- pc.skel(x, alpha = 0.05)
plotnetwork(a$G)
triangles.search(a$G)

MXM documentation built on Aug. 25, 2022, 9:05 a.m.