graph-create | R Documentation |

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

package.

```
ug(..., result = "igraph")
ugi(...)
ugList(x, result = "igraph")
dag(..., result = "igraph", forceCheck = FALSE)
dagi(..., forceCheck = FALSE)
dagList(x, result = "igraph", forceCheck = FALSE)
```

`...` |
A generating class for a graph, see examples below |

`result` |
The format of the graph. The possible choices are
"graphNEL" (for a |

`x` |
A list or individual components from which a graph can be created. |

`forceCheck` |
Logical determining if it should be checked if
the graph is acyclical. Yes, one can specify graphs with cycles
using the |

Functions `ug()`

, and `dag()`

can return a
`graphNEL`

object, an `igraph`

object, a sparse or a dense
adjacency matrix.

Søren Højsgaard, sorenh@math.aau.dk

```
## The following specifications of undirected graphs are equivalent:
uG1 <- ug(~ a:b:c + c:d)
uG2 <- ug(c("a", "b", "c"), c("c", "d"))
uG3 <- ug(c("a", "b"), c("a", "c"), c("b", "c"), c("c", "d"))
## The following specifications of directed acyclig graphs are equivalent:
daG1 <- dag(~ a:b:c + b:c + c:d)
daG2 <- dag(c("a", "b", "c"), c("b", "c"), c("c", "d"))
## dag() allows to specify directed graphs with cycles:
daG4 <- dag(~ a:b + b:c + c:a) # A directed graph but with cycles
## A check for acyclicity can be done with
## daG5 <- dag(~ a:b + b:c + c:a, forceCheck=TRUE)
## A check for acyclicity is provided by topoSort
topo_sort( daG2 )
topo_sort( daG4 )
## Different representations
uG7 <- ug(~a:b:c + c:d, result="igraph") # igraph
uG8 <- ug(~a:b:c + c:d, result="matrix") # dense matrix
uG9 <- ug(~a:b:c + c:d, result="dgCMatrix") # sparse matrix
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.