GraphAlgo-glist2adjMAT: Creates adjacency matrix for a graph from a list of...

Description Usage Arguments Value Author(s) See Also Examples

Description

Creates adjacency matrix for a graph from a list of generators. The graph is assumed to be undirected.

Usage

1
2
glist2adjMAT(glist, vn = uniquePrim(c(glist, recursive = TRUE)), result="matrix")
vpaL2adjMAT(vpaL, vn=uniquePrim(c(vpaL, recursive=TRUE)), result="matrix")

Arguments

glist

A list of generators for an undirected graph.

vpaL

A list of the form (v,pa(v)) specifying a directed acyclic graph.

vn

The names of the vertices in the graphs. These will be the row and column names of the matrix

result

Either "matrix" or "Matrix" (for a sparse matrix representation)

Value

An adjacency matrix (or NULL if glist has length 0)

Author(s)

S<f8>ren H<f8>jsgaard, sorenh@math.aau.dk

See Also

ug dag

Examples

1
2
3
4
5
6
7
glist <- list(1:3,2:4,4:5)
am1 <- glist2adjMAT(glist)
am2 <- vpaL2adjMAT(glist)
if (interactive()){
 plot(as(am1, "graphNEL"))
 plot(as(am2, "graphNEL"))
}

gRbase documentation built on May 2, 2019, 4:51 p.m.