Create undirected and directed graphs

Share:

Description

These functions are wrappers for creation of graphs as implemented by graphNEL objects in the graph package.

Usage

1
2
3
4
ug(..., result="NEL")
dag(..., result="NEL", forceCheck=FALSE)
ugList(x, result="NEL")
dagList(x, result="NEL", forceCheck=FALSE)

Arguments

...

A generating class for a graph, see examples below

x

A list containing a generating class for a graph, see examples below

forceCheck

Logical determining if it should be checked if the graph is acyclical

result

The format of the graph. The possible choices are "NEL" (for a graphNEL object), "matrix" (for an adjacency matrix), "igraph" (for an igraph object), "Matrix" (for a sparse matrix).

Value

Functions ug(), dag(), ugList() and dagList() return a 'graphNEL' object, an adjacency matrix or an 'igraph' object.

Author(s)

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ugr <- ug(~me:ve,~me:al,~ve:al,~al:an,~al:st,~an:st)

ugr <- ug(~me:ve:al,~al:an:st)

ugr <- ug(c("me","ve"),c("me","al"),c("ve","al"),c("al","an"),c("al","st"),c("an","st")) 

ugr <- ug(~me:ve:al, c("me","ve"),c("me","al"),c("ve","al"),c("al","an"),c("al","st"),c("an","st"))


dagr <- dag(c("me","ve"),c("me","al"),c("ve","al"),c("al","an"),c("al","st"),c("an","st"))


dagr <- dag(~me:ve,~me:al,~ve:al,~al:an,~al:st,~an:st)


dagr <- dag(~me:ve:al,~ve:al:an)

edges(ugr)
nodes(ugr)

edges(dagr)
nodes(dagr)

ugList(list(~me:ve:al,~al:an:st))
dagList(list(~me:ve:al,~ve:al:an))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.