Description Usage Arguments Author(s) See Also Examples
Check if a graph is 1) a directed acyclic graph (DAG), 2) an undirected graph (UG), 3) a triangulated (chordal) undirected graph (TUG). A graph represented as 1) graphNEL (from the graph package), 2) an adjacency matrix, 3) a sparse adjacency matrix (a dgCMatrix from the Matrix package).
1 2 3 4 |
object |
A graph represented as 1) graphNEL (from the graph package), 2) an adjacency matrix, 3) a sparse adjacency matrix (a dgCMatrix from the Matrix package). |
x |
Any object. If the object is a quadratic matrix with 0's on the diagonal then it is an adjacency matrix. |
S<f8>ren H<f8>jsgaard, sorenh@math.aau.dk
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## DAGs
dagNEL <- dag(~a:b:c+c:d:e, result="NEL")
dagMAT <- dag(~a:b:c+c:d:e, result="matrix")
dagMATS <- dag(~a:b:c+c:d:e, result="Matrix")
## Undirected graphs
ugNEL <- ug(~a:b:c+c:d:e, result="NEL")
ugMAT <- ug(~a:b:c+c:d:e, result="matrix")
ugMATS <- ug(~a:b:c+c:d:e, result="Matrix")
## Is it a DAG?
is.DAG(dagNEL)
is.DAG(dagMAT)
is.DAG(dagMATS)
is.DAG(ugNEL)
is.DAG(ugMAT)
is.DAG(ugMATS)
## Is it an undirected graph
is.UG(dagNEL)
is.UG(dagMAT)
is.UG(dagMATS)
is.UG(ugNEL)
is.UG(ugMAT)
is.UG(ugMATS)
## Is it a triangulated (i.e. chordal) undirected graph
is.TUG(dagNEL)
is.TUG(dagMAT)
is.TUG(dagMATS)
is.TUG(ugNEL)
is.TUG(ugMAT)
is.TUG(ugMATS)
## Example where the graph is not triangulated
ug2NEL <- ug(~a:b+b:c+c:d+d:a, result="NEL")
ug2MAT <- ug(~a:b+b:c+c:d+d:a, result="matrix")
ug2MATS <- ug(~a:b+b:c+c:d+d:a, result="Matrix")
is.TUG(ug2NEL)
is.TUG(ug2MAT)
is.TUG(ug2MATS)
## Bidirected graphs
edgemode(ugNEL)
edgemode(ugNEL) <- "directed"
edgemode(ugNEL)
is.DAG(ugNEL)
is.UG(ugNEL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.