grp | R Documentation |
Generic functions for finding groups based on edge adjacencies, e.g. neighbourhoods, districts or ancestral sets.
grp(graph, v, etype, inclusive = TRUE, dir = 0, sort = 1, force = FALSE)
grp2(v, edges, dir, inclusive, sort = 1)
groups(graph, etype, sort = 1)
graph |
an object of class |
v |
vertices to group |
etype |
edge types to group by (defaults to all) |
inclusive |
logical indicating whether |
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 |
edges |
an |
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
.
grp2()
: Faster routine for single adjMatrix
or adjList
groups()
: find connected components
adj
for single edge adjacencies.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.