toDot-methods           package:Rgraphviz           R Documentation

_A _G_e_n_e_r_i_c _F_o_r _C_o_n_v_e_r_t_i_n_g _O_b_j_e_c_t_s _T_o _D_o_t

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

       toDot(graph, filename, ...)

_A_r_g_u_m_e_n_t_s:

   graph: The 'graph' to output to Dot

filename: The name of the file to output to.

     ...: Any arguments to pass on to 'agopen'

_d_e_t_a_i_l_s:

     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'.

_a_u_t_h_o_r:

     Jeff Gentry

_s_e_e_a_l_s_o:

     'agopen', 'agwrite', 'graph-class'

_E_x_a_m_p_l_e_s:

       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)

