toDot-methods {Rgraphviz} | R Documentation

## A Generic For Converting Objects To Dot

### Description

This generic is used to convert objects of varying classes to the Dot language. Currently, only the `graph` class is supported.

### Usage

      toDot(graph, filename, ...)

### Arguments

`graph` | The `graph` to output to Dot
`filename` | The name of the file to output to.
`...` | Any arguments to pass on to `agopen`

### details

The method defined for `graph` objects is a convenience wrapper around `agopen` and `agwrite` in that order. It will take an object of class `graph` (or one of its subclasses), call `agopen` (any extra arguments besides the graph and the `name` parameter should be passed in via `...`) and then write the resulting information via `agwrite` in the file specified by `filename`.

### author

Jeff Gentry

### seealso

`agopen`, `agwrite`, `graph-class`

### Examples

      set.seed(123)
      V <- letters[1:10]
      M <- 1:4
      g1 <- randomGraph(V, M, .2)

      nAttrs <- list()
      eAttrs <- list()
      nAttrs$label <- c(a="lab1", b="lab2", g="lab3", d="lab4")
      eAttrs$label <- c("a~h"="test", "c~h"="test2")
      nAttrs$color <- c(a="red", b="red", g="green", d="blue")
      eAttrs$color <- c("a~d"="blue", "c~h"="purple")

      toDot(g1, tempfile(), nodeAttrs=nAttrs, edgeAttrs=eAttrs)

[Package Rgraphviz version 1.8.0 Index]