Learn R Programming

dynamicGraph (version 0.1.6.6)

returnBlockEdgeList: The block edge list

Description

Return a list of block edges, each of class BlockEdgeProto.

Usage

returnBlockEdgeList(edge.list, vertices, blocks, width = 2, 
                    color = "default", oriented = FALSE, type = NULL)

Arguments

edge.list
A list of vectors identifying the edges (between vertices). Each vector of edge.list should be a vector of integers giving the indices of the vertices of an edge, or a vector of tex
vertices
The list of vertices, each of a class containing VertexProto.
blocks
The list of blocks, each of a class BlockProto.
width
A numeric with the initial width of block edges.
color
"default", or list with one or two text strings for colors giving the initial color of block edges. The two colors are used for respectively edges between blocks and for edges between blocks and vertices.
oriented
Logical, if TRUE then the edges are oriented.
type
A text string giving the type of block edges.

Value

  • A list of block edges, each of class BlockEdgeProto.

Examples

Run this code
Block.tree <- list(label = "W", Vertices = c("country"),
                   X = list(Vertices = c("sex", "race"),
                            A = list(Vertices = c("hair", "eye"),
                                     horizontal = FALSE),
                            B = list(Vertices = c("age"),
                                     C = list(Vertices = c("education")))))
Names <- unlist(Block.tree)
Names <- Names[grep("Vertices", names(Names))]
Types <- rep("Discrete", length(Names))
vertices <- returnVertexList(Names, types = Types)
blocktree <- setTreeBlocks(Block.tree, vertices)
blocks <- blockTreeToList(blocktree$BlockTree)
from <- c("country", "country", "race", "race",       "sex", "sex")
to   <- c(    "sex",    "race", "hair",  "eye", "education", "age")
from <- match(from, Names)
to <- match(to, Names)
edge.list <- vector("list", length(to))
for (j in seq(along = to)) edge.list[[j]] <- c(from[j], to[j])
edges <- returnEdgeList(edge.list, vertices, color = "red", oriented = TRUE)
vertices <- blocktree$Vertices
blockedges <- returnBlockEdgeList(edge.list, vertices, blocks,
                                  color = "red", oriented = TRUE)

Names(blockedges)
Colors(blockedges)
Labels(blockedges)
LabelPositions(blockedges)
# Positions(blockedges)
# Strata(blockedges)
# Indices(blockedges)
str(NodeTypes(blockedges))
str(NodeIndices(blockedges))
Widths(blockedges)
Oriented(blockedges)
Widths(blockedges) <- rep(1,  7)
Widths(blockedges) <- rep(1, 14)
Widths(blockedges)

Run the code above in your browser using DataLab