DynamicGraph          package:dynamicGraph          R Documentation

_S_i_m_p_l_e _i_n_t_e_r_f_a_c_e _t_o _d_y_n_a_m_i_c_G_r_a_p_h

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

     A simple interface to 'dynamicGraph' in the sense that the graph
     should not be given as list of objects as to 'dynamicGraphMain'.
     Here vertices can be  specified by a vector of text strings with
     names, and/or edges by pairs of the indices of the vertices.

     The function is also used to add models and views to an existing
     'dynamicGraph'.

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

     DynamicGraph(names = NULL, types = NULL, from = NULL, to = NULL, 
         edge.types = NULL, edge.list = NULL, labels = names,  
         blocks = NULL, block.tree = NULL, oriented = FALSE, factors = NULL, 
         texts = NULL, extra.from = NULL, extra.to = NULL, extra.edge.list = NULL, 
         object = NULL, viewType = "Simple", 
         vertexClasses = validVertexClasses(), factorClasses = validFactorClasses(),
         edgeClasses = validEdgeClasses(), viewClasses = validViewClasses(), 
         N = 3, drawblocks = TRUE, right.to.left = FALSE, nested.blocks = FALSE, 
         overlaying = TRUE, vertexColor = "red", extraVertexColor = "white", 
         edgeColor = "black", factorVertexColor = "default", factorEdgeColor = "brown", 
         blockEdgeColor = "default", blockColors = NULL, extraEdgeColor = "peru", 
         frameModels = NULL, frameViews = NULL, graphWindow = NULL, addModel = FALSE, 
         addView = FALSE, overwrite = FALSE, returnNewMaster = FALSE, 
         redraw = FALSE, ...) 

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

   names: A vector with text strings for the 'names'  of the vertices. 

   types: A vector with text strings for the 'types', labels of
          'dg.Vertex', of the vertices. 

    from: If not 'edge.list' is given: The indices of the first
          endpoints of the edges. 

      to: If not 'edge.list' is given: The indices of the second
          endpoints of the edges. 

edge.types: A vector of text strings giving the 'types' of the edges,
          identify which classes the edges should be of, containing the
          'dg.VertexEdge'. 

edge.list: If not 'from' and 'to' are given: A list where each item
          specifies an edge by a vector of the indices or names of the
          vertices. 

  labels: A vector with text strings for the 'labels'  of the vertices. 

  blocks: A list defining the 'blocks': Each item is the vector of the
          indices of the vertices of the block, or the vector with text
          strings for the names of the vertices of the block.  The
          arguments 'right.to.left', 'nested.blocks'  and 'blockColors'
          are here used in 'setBlocks' to control the layout of the
          blocks. 

block.tree: If not the argument 'blocks' is used: A structure with the
          blocks in a 'block.tree'. The arguments 'overlaying' and
          'blockColors' are here used in 'setTreeBlocks' to control the
          layout of the blocks. 

oriented: Logical. If 'oriented' is set to TRUE then the edges are
          oriented, also when no block structure is given. 

 factors: A list defining the 'factor vertices': Each item is the
          vector of the indices of the vertices of a factor. 

   texts: A vector of text strings, for additional labels.  These
          labels will be set by ''ExtraVertices'' of class
          'dg.TextVertex-class'. 

extra.from: If not 'extra.edge.list' is given: The indices of the first
          endpoints of the extra edges, negative for extra vertices. 

extra.to: If not 'extra.edge.list' is given: The indices of the second
          endpoints of the extra edges, negative for extra vertices. 

extra.edge.list: If not 'extra.from' and 'extra.to' are given: A list
          where each item specifies an extra edge by a vector of the
          indices or names of the vertices or extra vertices, negative
          indices for extra vertices. 

  object: The model 'object', or NULL, see 'dg.Model-class'. 

vertexClasses: Returned value from 'validVertexClasses', or extension
          of this matrix. Used when creating new vertices in
          'dynamicGraphMain'. 

factorClasses: Returned value from 'validFactorClasses', or extension
          of this matrix. Used when creating new factor vertices in
          'dynamicGraphMain'. 

edgeClasses: Returned value from 'validEdgeClasses', or extension of
          this matrix. Used when creating new edges in
          'dynamicGraphMain'. 

viewClasses: Returned value from 'validViewClasses', or extension of
          this matrix. Used when creating new views in
          'dynamicGraphMain'. 

viewType: A text string with the type of view. 

       N: The number, 'N' > 1, of coordinates for the positions of the
          vertices and block corners. 

drawblocks: Logical. If 'drawblocks' is set to FALSE, then the blocks
          are not drawn. The strata of the vertices are then not
          updated when the vertices are moved. 

right.to.left: Logical. If 'right.to.left' is set to TRUE then the
          explanatory blocks are drawn to the right. See 'setBlocks'. 

nested.blocks: Logical. If 'nested.blocks' is set to TRUE then the
          blocks are drawn nested. See 'setBlocks'. 

overlaying: Logical. If 'overlaying' is set to FALSE then children of a
          block are not drawn inside the block. See 'setTreeBlocks'. 

vertexColor: Single text string with the 'vertexColor' of the vertices. 

extraVertexColor: Single text string with the 'extraVertexColor' of the
          nodes for text labels. 

edgeColor: Single text string with the 'edgeColor' of the edges. 

factorVertexColor: Single text string with the 'factorVertexColor' of
          the factor vertices.  If 'factorVertexColor' is "default"
          then the color of a factor vertex will depend on the type of
          the generator of the factor.

factorEdgeColor: Single text string with the 'factorEdgeColor' of the
          factor edges. 

blockEdgeColor: "default", or list with two text strings for colors.
          The two colors are used for respectively edges between blocks
          and for edges between blocks  and vertices.

blockColors: Vector of text string with the 'blockColors' of the
          blocks. See 'setBlocks' and 'setTreeBlocks'.  

extraEdgeColor: Single text string with the 'extraEdgeColor' of the
          extra edges. 

frameModels: An object of class 'DynamicGraph-class'. 'frameModels' is
          the object for a dataset and the models on that dataset. 

frameViews: An object of class 'DynamicGraphModel-class'. 'frameViews'
          is the object for a model and the views of that model. 

graphWindow: An object of class 'DynamicGraphView-class'. 'graphWindow'
          is the object for a view of a model. 

addModel: Logical, if 'addModel' then a model is added to the argument
          'frameModels', and a view of the model is drawn.  If the
          argument 'overwrite' is TRUE and the argument 'graphWindow'
          is given  then the model of 'graphWindow' is replaced by the
          model argument 'object'. If the argument 'overwrite' is TRUE
          and the argument 'frameViews' is given  then the model of
          'frame'\-{Views} is replaced by the model argument 'object'. 

 addView: Logical, if 'addView' then a view of type set by the argument
          'viewType' for the model of the argument 'frameViews' is
          added. 

overwrite: Logical, see the argument 'addModel'.  The argument
          'returnLink' must be set to TRUE to overwrite a view. 

  redraw: Logical. If TRUE then the dynamicGraph of the arguments
          'frameModels' is 'redrawn'. New instances of the windows are
          made. 

returnNewMaster: Logical. Alternative implementation of  'addModel',
          using the code of 'redraw'. As 'redraw', but the windows of 
          'frameModels' exists,  and a new model is added. 

     ...: Additional arguments to 'dynamicGraphMain'. 

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

     After converting the first arguments to lists of objects the
     'dynamicGraphMain' does all the work.

     You can look into the source code of 'DynamicGraph' about how to
     create these lists of objects for building your applications. The
     list of objects can be exported from 'dynamicGraphMain', also
     after modifying the graph.

     If the argument 'returnLink' is set to TRUE then the returned
     value can be use in subsequential call to 'DynamicGraph' to add
     models and views to the created graph window.

_V_a_l_u_e:

     The returned value from 'dynamicGraphMain'.

_A_u_t_h_o_r(_s):

     Jens Henrik Badsberg

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

     require(tcltk); require(dynamicGraph)

     # Example 1:

     Z <- DynamicGraph(paste("", 1:5), title = "Very simple")

     # Example 2:

     Z <- DynamicGraph(from = 1:4, to = c(2:4, 1), title = "Simply edges")

     # Example 3:

     V.Types <- c("Discrete", "Ordinal", "Discrete",
                  "Continuous", "Discrete", "Continuous")

     V.Names  <- c("Sex", "Age", "Eye", "FEV", "Hair", "Shosize")
     V.Labels <- paste(V.Names, 1:6, sep ="/")

     From <- c(1, 2, 3, 4, 5, 6)
     To   <- c(2, 3, 4, 5, 6, 1)

     Z <- DynamicGraph(V.Names, V.Types, From, To, texts = c("Gryf", "Gaf"),
                       labels = V.Labels, title = "With labels (extraVertices)")

     # Example 4: Oriented (cyclic) edges, without causal structure:

     Z <- DynamicGraph(V.Names, V.Types, From, To, oriented = TRUE,
                       labels = V.Labels, title = "Oriented edges")

     # Example 5: A factor graph:

     Factors <- list(c(1, 2, 3, 4), c(3, 4, 5), c(4, 5, 6))

     Z <- DynamicGraph(V.Names, V.Types, from = NULL, to = NULL, factors = Factors,
                       title = "Factorgraph", namesOnEdges = FALSE)

     # Example 6: Edges with more than two vertices:

     EdgeList <- list(c(1, 2, 3, 4), c(3, 4, 5), c(4, 5, 6))

     Z <- DynamicGraph(V.Names, V.Types, edge.list = EdgeList, 
                       title = "Multiple edges", namesOnEdges = FALSE)

     Z

