collapse: Collapse multiple edge types to a single list or matrix

View source: R/Adjacencies.R

collapseR Documentation

Collapse multiple edge types to a single list or matrix

Description

Collapse multiple edge types to a single list or matrix

Usage

collapse(
  edges,
  v1,
  v2,
  dir = 1,
  matrix = FALSE,
  nv,
  sparse = FALSE,
  sort = 1,
  rev = FALSE,
  double_up = FALSE
)

Arguments

edges

list of edges to include

v1, v2

incoming and outgoing vertices, defaults to all.

dir

direction

matrix

logical indicating whether to force the return of an adjacency matrix

nv

number of vertices for adjMatrix

sparse

should we use sparse matrices if available?

sort

1=unique but not sorted, 2=unique and sorted, 0=neither

rev

logical: should directed adjLists have the direction inverted if dir=1?

double_up

logical: should edges with dir=0 be repeated in both directions for an edgeMatrix?

Details

returns an edgeMatrix or adjMatrix for possibly multiple edge types. If any of the edges are specified as an adjacency matrix, then the output will also be an adjacency matrix, and similarly for an edgeMatrix.

If nv is not supplied, then it is inferred from the input.

If v1 or v2 are specified then the first and second vertices must belong to these respective sets.


rje42/MixedGraphs documentation built on March 20, 2024, 8:09 a.m.