Description Usage Arguments Details Value All object in the graph window: Vertices (vertices and factor vertices): Edges (edges to/from vertices, blocks and factors): Blocks, opened: Blocks, closed: Factor vertices: Factor edges: The panel for vertices: The panel for blocks in tree and vertices: The graph: Rotation: Acknowledgments Note Author(s) References See Also Examples
Interactive plot for manipulating graphs.
1 2 3
List of vertices
(each of class containing the class
List of blocks (each of class
NULL, or object with the methods
If set to a text string then the object is assigned with this name in .Global.Env when the object is updated.
This is a dynamic plotting tool for handling graphs. The lay out of the graph can be edited by moving the vertices of the graph by the mouse, and edges can be added by clicking vertices and dropping by clicking the edges.
The function is incremental in the sense that the user can add a method for updating the model object of the window when the graph is updated, and a method for computing the test of an edge when the edge is clicked by the mouse.
Edges can be oriented, drawn by arrows.
Blocks can be used to define a causal structure of the variables represented by vertices, and edges between blocks are then oriented. Blocks can be given in a structure such that descendant blocks of a blocks also are closed when a block is closed.
A secondary set of vertices, factor vertices, can be used to represent hypergraphs.
"Slave graph windows" can be created: The windows will share vertices and blocks, thus when a vertex is moved in one window, the position of the vertex will also change in all slave windows. The edges are not shared among windows, since the individual windows will typical represent different models. Thus factors (vertices and edges) are not shared between graph windows.
An object of class
returnNull is TRUE)
with the lists of vertices and blocks (block trees) of the dynamicGraph,
and list of models, each (of class
with the views of the model.
Each view (of class
DynamicGraphView-class) of a model
will hold the edges (edges between vertices, factors and blocks)
and factor- and extra-vertices of the view,
together with which vertices and blocks are visible in the view.
Left click, hold and drag:The object will move.
Left click:Action to the object: Vertices, edges, and blocks will highlight, at vertices and blocks edges are added after highlighting, tests are computed for edge labels.
Left or right click, with SHIFT or/and CONTROL:The object will be marked.
Double left click:Action to object: Vertices and edges are deleted, blocks will close, closed blocks will open.
Right click:The pop up menu of the object will appear.
Right click the vertex to get the pop up menu of the vertex:
Highlight a vertex:For adding an edge - Left click the vertex.
Highlight a vertex:For adding to "selectedNodes" - Left or right click the vertex while holding SHIFT or/and CONTROL down.
Mark a vertex:For adding edges, etc. - Left or right click the vertex while holding SHIFT or/and CONTROL down.
Cancel highlighting:Left click (or drag) the vertex.
Add an edge:After first highlighting a vertex - Left click the other vertex.
Move a vertex:Left click and drag the vertex.
Move a vertex label:Left click and drag the label of the vertex.
Delete a vertex:Double left click the vertex.
Create new graph:A slave window with the vertex delete - Select "Drop vertex" from pop up menu at the vertex.
Change a vertex label:Double left click the label, and enter the new label in the appearing dialog window.
Delete a vertex label:Select "Delete vertex label" from the pop up menu at the vertex or at the vertex label.
Create new vertex:At mouse position - Middle click the canvas.
Create new vertex:At mouse position with the edge to last vertex - Double middle click the canvas.
The main menu "Variables":
Create new variable:With setting the class of the new
vertex and defining an expression for updating the
object - Select "Create new variable".
Display, add, a vertex:In the current window - Select "Select vertex among variables not displayed (here)".
Display, add, a vertex:In a slave window - Select "Select vertex among variables not displayed (slave)".
Export the vertex list:Select "Assign 'vertexList' in .GlobalEnv".
Export the labels:Select "Assign 'extraList' in .GlobalEnv".
Right click the edge to get the pop up menu of the edge:
Highlight a edge:Left click the edge.
Highlight a edge:For adding to "selectedEdges" - Left or right click the edge while holding SHIFT or/and CONTROL down.
Add an edge:Left click first the vertex (or block) to highlight, and then left click other vertex (or block).
Delete an edge:And update in the current window - Double left click the edge.
Delete an edge:And create a slave graph with the resulting graph - Select "Drop edge" from the pop up menu at the edge.
Move an edge (2 vertices):Left click the edge and drag the edge.
Move an edge label:Left click the edge label and drag the label.
Set an edge label:Select "Set edge label" from the edge pop up menu.
Compute an edge label:Left click the edge label, or select "Compute edge label" from pop up menu at the edge.
Compute an edge label:Force computation for "harder models" - Double left click the edge label, or select "Force compute edge label" from pop up menu of the edge.
Delete an edge label:Triple left click the edge label, or select "Delete label of edge" from the pop up menu at the edge.
The main menu "Edges":
Delete all edge labels:Select "Delete all edge labels".
Export the edge list:Select "Assign 'edgeList' in .GlobalEnv".
Right click the block label (or colored block canvas if
drawBlockBackground is set to TRUE) to get the pop up
menu of opened block:
Move a block:With its sub blocks and vertices - Left click the block label or colored block canvas and drag the block. [ Slow !!!]
Resize a block:Left click a block corner or a block edge and drag.
Minimize a block:With its sub blocks and vertices - Double left click the block label or the colored block canvas.
Maximize a block:Zoom to the block - Right click the block label or colored the block canvas and select "Maximize" in the appering popup menu.
Zoom out to the full graph:Right click the block label or colored block canvas and select "Redraw (Zoom to) full graph" in the appearing block pop up menu.
Right click the block to get the pop up menu of the closed block:
Highlight a block:For adding edges from all vertices of the block to a vertex or a block - Left click the block.
Highlight a block:For adding to "selectedNodes" - Left or right click the block while holding SHIFT or/and CONTROL down.
Mark a block:For adding edges, etc. - Left or right click the block while holding SHIFT or/and CONTROL down.
Cancel highlighting:Of a block - Left click (or drag) the block.
Add edges:To all vertices of block after highlighting first a block or a vertex - Click the other block.
Move a closed block:Left click and drag the block.
Move a block label:Left click and drag the label of the block.
Open a closed block:Double left click the block.
Change a block label:Double left click the label of the closed block, and enter the new label in the appearing dialog window.
Delete a block label:Select "Delete label of block" from the pop up menu at the block or the block label.
The main menu "Blocks":
Export the block list:Select "Assign 'blockList' in .GlobalEnv".
Export the block edges:Select "Assign 'blockEdgeList' in .GlobalEnv".
Right click the factor vertex to get the pop up menu of the factor: Actions as for vertices. The main menu "Generators":
Export the factor vertices:Select "Assign 'factorVertexList' in .GlobalEnv".
Export the factor edges:Select "Assign 'factorEdgeList' in .GlobalEnv".
Right click the factor edge to get the pop up menu of the factor edge: Actions are as for edges.
Highlight vertex name for adding or deleting vertex: Left click the vertex name.
Delete or add vertices: Double left click a vertex name.
Popup menu for selected vertex: Click "Popup selected in panel" in "File Menu".
Dialog window for properties: Middle click vertex name.
Move vertex to other block: Left click the vertex name and drag to the other block.
Move block to other block: Left click the block name and drag to the other block.
Popup menu for selected vertex or block : Click "Popup selected in panel" in "File Menu".
Create a slave window:Select "Make slave window: Same model".
Create a slave window:Select "Make slave window: Copy model".
Switch class of view:Select "Set class of graph window".
Refresh:Faster fix of "corrupted" window: Select "Refresh view (set positions as 'stored')".
Redraw the view (zoom out):Select "Redraw graph window (more refreshing)".
Update model:Select "Update model and redraw (total refreshing)".
Enable rotation:Select "Rest (enable) rotation".
Disable rotation:Select "Disable rotation".
Zoom in:Select "Zoom in" from main menu, or hit <F1> in canvas.
Zoom out:Select "Zoom out" from main menu, or hit <F2> in canvas.
Export current arguments:Select "Assign 'Args' in .GlobalEnv".
Export the model lattice:Select "Assign 'frameModels' in .GlobalEnv".
Export the graph lattice:Select "Assign 'frameViews' in .GlobalEnv".
Export the graph window:Select "Assign 'graphWindow' in .GlobalEnv".
Export the object:Select "Assign 'object' in .GlobalEnv".
Enable rotation:Select "Enable (reset) transformation" from the main menu "Graph".
Rotate the graph:Middle click the canvas, and drag.
Disable rotation:Select "Disable transformation" from the main menu "Graph".
Export transformation:Export the projection matrix - Select "Assign 'transformation' in .GlobalEnv" from the main menu "Graph".
Many thanks to the gR-group for useful discussions, especially to Claus Dethlefsen for testing early versions of this package on DEAL.
Vertices, edges, blocks, block edges,
factors, and factor edges are objects of the following classes:
are implemented for objects of these classes.
For lists of vertices, edges, blocks, block edges,
factors, and factor edges the methods
NodeDescendants<- are available.
The model object of the call of
should have the methods
When the graph is modified, by adding or dropping vertices or edge,
modifyModel is called on the argument
dynamicGraphMain. If an
object is returned in
the list of the returned value from
dynamicGraphMain is replaced by this
object, and the object is also assigned in the top level environment,
objectName was given to
object should return an object with
width for labeling edges,
are used to communicate the graph components between several views
of the same model.
graphEdges of the model object is for
returning an object of class
to draw in the view, depending on the viewType.
setGraphEdges of the model object
is called on the model object when the model is modified.
Jens Henrik Badsberg
CoCo, with a guide at http://www.jstatsoft.org/v06/i04/,
has an interface to
DynamicGraph and all the other functions
of this package.
An example has been divided on the following 4 manual pages:
gives an example of a model object with test object.
The pages of
dg.graphedges-class show how the user
can add menu items with actions that redraws the graph
after modification of edges.
validVertexClasses show how to create
a new vertex class with a new symbol for drawing the vertex
and an item added to the pop up menu of the new vertex class.
will do this example collected from these 4 pages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
require(tcltk) require(dynamicGraph) V.Names <- paste(c("Sex", "Age", "Eye", "FEV", "Hair", "Shosize"), 1:6, sep ="/") V.Types <- c("Discrete", "Ordinal", "Discrete", "Continuous", "Discrete", "Continuous") Vertices <- returnVertexList(V.Names, types = V.Types, color = "red") From <- c(1, 2, 3, 4, 5, 6) To <- c(2, 3, 4, 5, 6, 1) EdgeList <- vector("list", length(To)) for (j in seq(along = To)) EdgeList[[j]] <- c(From[j], To[j]) Edges <- returnEdgeList(EdgeList, Vertices, color = "black") # Z <- dynamicGraphMain(Vertices, edgeList = Edges, control = dg.control(w = 4)) graph <- new("dg.graph", vertexList = Vertices, edgeList = Edges) W <- dg(graph, control = dg.control(w = 4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.