DynamicGraph {dynamicGraph} | R Documentation |
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.
DynamicGraph(names = NULL, types = NULL, from = NULL, to = NULL, edge.list = NULL, blocks = NULL, block.tree = NULL, oriented = FALSE, factors = NULL, texts = NULL, object = NULL, vertexClasses = validVertexClasses(), factorClasses = validFactorClasses(), 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, ...)
names |
A vector with text strings for the names
of the vertices. |
types |
A vector with text strings for the types ,
labels of VertexProto , 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.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. |
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. |
object |
The model object , or NULL,
see newDefaultModelObject . |
vertexClasses |
The valid vertexClasses . |
factorClasses |
The valid factorClasses . |
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 childern 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 . |
... |
Additional arguments to dynamicGraphMain . |
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.
The returned value from dynamicGraphMain
.
Jens Henrik Badsberg
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.Names <- 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"), title = "With labels") # Example 4: Oriented (cyclic) edges, without causal structure: Z <- DynamicGraph(V.Names, V.Types, From, To, oriented = TRUE, 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)