Learn R Programming

dynamicGraph (version 0.2.2.6)

DynamicGraph: DEPRECATED: Simple interface to dynamicGraph

Description

A simple interface to dynamicGraph in the sense that the graph should not be given as an object 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 can also be used to add models and views to an existing dynamicGraph.

The interface is deprecated: Use the method dg on an object of class dg.simple.graph-class instead, or the methods addModel, addView, replaceModel, or replaceView.

Usage

DynamicGraph(names = character(), types = character(), from = vector(), to = vector(), edge.list = list(NULL), labels = names, edge.types = character(), blocks = list(NULL), block.tree = list(NULL), oriented = NA, factors = list(NULL), texts = character(), extra.from = vector(), extra.to = vector(), extra.edge.list = list(NULL), object = NULL, viewType = "Simple", frameModels = NULL, frameViews = NULL, graphWindow = NULL, addModel = FALSE, addView = FALSE, overwrite = FALSE, returnNewMaster = FALSE, redraw = FALSE, control = dg.control(...), ...)

Arguments

names
See vertex.names of dg.simple.graph-class.
edge.types
edge.list
block.tree
oriented
factors
extra.from
extra.to
extra.edge.list
viewType
object
The model object, or NULL, see dg.Model-class.
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.
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.
control
Options for DynamicGraph and dynamicGraphMain, see dg.control.
...
Additional arguments to dynamicGraphMain.

Value

The returned value from dynamicGraphMain.

Details

After converting the arguments for the graph first to an object of class dg.simple.graph-class then to an object of class dg.graph-class the function dynamicGraphMain does all the work.

The list of objects can be exported from dynamicGraphMain, also after modifying the graph.

Examples

Run this code
require(tcltk); require(dynamicGraph)

# Example 1:

W <- dg(as(new("dg.simple.graph", vertex.names = 1:5), "dg.graph"),
        control = dg.control(title = "Very simple"))

# Example 2:

W <- dg(new("dg.simple.graph", from = 1:4, to = c(2:4, 1)), 
        control = dg.control(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)

W <- dg(new("dg.simple.graph", vertex.names = V.Names, types = V.Types,
            labels = V.Labels, from = From, to = To), 
        control = dg.control(title = "With labels (extraVertices)"))


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

W <- dg(new("dg.simple.graph", vertex.names = V.Names, types = V.Types,
            labels = V.Labels, from = From, to = To, oriented = TRUE),
        control = dg.control(title = "Oriented edges"))


# Example 5: A factor graph:

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

W <- dg(new("dg.simple.graph", vertex.names = V.Names, types = V.Types,
          labels = V.Labels, factors = Factors, viewType = "Factor"),
        control = dg.control(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))

W <- dg(new("dg.simple.graph", vertex.names = V.Names, types = V.Types,
          labels = V.Labels, edge.list = EdgeList),
        control = dg.control(title = "Multiple edges", namesOnEdges = FALSE))

W

Run the code above in your browser using DataLab