GraphAlgo-vpar: List of vertices and their parents for graph.

Description Usage Arguments Value Author(s) See Also Examples

Description

Get list of vertices and their parents for graph.

Usage

1
2
3
4
5
vpar(object, getv = TRUE, forceCheck = TRUE)
## S3 method for class 'graphNEL'
vpar(object, getv = TRUE, forceCheck = TRUE)
## S3 method for class 'matrix'
vpar(object, getv = TRUE, forceCheck = TRUE)

Arguments

object

An object representing a graph. Valid objects are an adjacency matrix or as a graphNEL.

getv

The result is by default a list of vectors of the form (v, pa1, pa2, ... paN) where pa1, pa2, ... paN are the parents of v. If getv is FALSE then the vectors will have the form (pa1, pa2, ... paN).

forceCheck

Logical indicating if it should be checked that the object is a DAG.

Value

A list of vectors where each vector will have the form (v, pa1, pa2, ... paN) where pa1, pa2, ... paN are the parents of v.

Author(s)

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

See Also

dag ug

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
26
27
28
29
30
31
## DAGs
dagMAT <- dag(~a:b:c+c:d:e, result="matrix")
dagNEL <- dag(~a:b:c+c:d:e, result="NEL")

vpar(dagMAT)
vpar(dagNEL)
vpar(dagMAT, getv=FALSE)
vpar(dagNEL, getv=FALSE)

## Undirected graphs
ugMAT <- ug(~a:b:c+c:d:e, result="matrix")
ugNEL <- ug(~a:b:c+c:d:e, result="NEL")

## Not run: 
## This will fail because the adjacency matrix is symmetric and the
## graphNEL has undirected edges
vpar(ugMAT)
vpar(ugNEL)

## End(Not run)

## When forceCheck is FALSE, it will not be detected that the graphs are undirected.
vpar(ugMAT, forceCheck=FALSE)
vpar(ugNEL, forceCheck=FALSE)

## Bidirected graphs
## This is, for graphNEL's, the same as working with bidirected edges:
edgemode(ugNEL)
edgemode(ugNEL) <- "directed"
edgemode(ugNEL)
vpar(ugNEL,FALSE)

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