adj: Find adjacent vertices

View source: R/Adjacencies.R

adjR Documentation

Find adjacent vertices

Description

Generic function for finding adjacent vertices based on any kind of edge.

Usage

adj(graph, v, etype, dir = 0, inclusive = TRUE, sort = 1, force = FALSE)

adjacent(graph, v1, v2, etype, dir = 0)

Arguments

graph

an object of class mixedgraph

v

vertices to find adjacencies

etype

edge types to consider; defaults to all

dir

for directed edges, indicates which direction to search in: 1: along direction, -1: against direction, 0: both directions.

inclusive

logical indicating whether elements of v can be included in output group.

sort

integer: 1 for unique but unsorted, 2 for sorted (0 for possibly repeated and unsorted). If edges are stored as a matrix then output will always be unique and sorted.

force

logical - should invalid v be ignored?

v1, v2

vertices between which to test for adjacency

Details

The argument directed is recycled for multiple edge types, but has no effect for edges without a specified direction. If any v is not a vertex of graph, an error is returned, unless force=TRUE.

The function adjacent tests for a particular adjacency between two vertices.

Functions

  • adjacent(): Test for adjacency

See Also

grp for vertices joined by paths, groups for partitions of vertices by adjacency type.

Examples

adj(gr1, v=1, etype="directed")
adj(gr1, v=1, etype="directed", dir=-1)
adjacent(gr1, 1, 3, etype="directed", dir=1)


rje42/MixedGraphs documentation built on March 29, 2025, 11:47 p.m.