grp: Group vertices by adjacencies

View source: R/Adjacencies.R

grpR Documentation

Group vertices by adjacencies

Description

Generic functions for finding groups based on edge adjacencies, e.g. neighbourhoods, districts or ancestral sets.

Usage

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

grp2(v, edges, dir, inclusive, sort = 1)

groups(graph, etype, sort = 1)

Arguments

graph

an object of class mixedgraph

v

vertices to group

etype

edge types to group by (defaults to all)

inclusive

logical indicating whether v should be included in output group.

dir

integer(s) indicating if direction should be considered: 0 = undirected, 1 = from row to column; -1 = from column to row.

sort

integer: 1 for unique but unsorted, 2 for sorted (0 for possibly repeated and unsorted).

force

logical - should invalid v be ignored?

edges

an adjMatrix or adjList

Details

grp() finds all vertices that can be reached from vertices in v by edges of the specified type, and in the specified direction. For example, we can find all the ancestors of v by using type="directed" and dir=-1 (i.e. go back up the edges).

groups() finds equivalence classes in a graph based on being connected by such a path (i.e. the connected components with respect to the specified edge types).

If any v is not a vertex of graph, an error is returned, unless force=TRUE.

grp2 is a faster version of the function for a single adjMatrix or adjList.

Functions

  • grp2(): Faster routine for single adjMatrix or adjList

  • groups(): find connected components

See Also

adj for single edge adjacencies.


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