toDot-methods: A Generic For Converting Objects To Dot

Description Usage Arguments details author seealso Examples

Description

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

Usage

1
  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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  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)

Example output

Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: grid
NULL

Rgraphviz documentation built on Nov. 8, 2020, 8:21 p.m.