Learn R Programming

multigraph (version 0.40)

multigraph: Multigraph

Description

A function to create and manipulate multigraphs with different layouts

Usage

multigraph(net, layout = c("circ", "force", "rand"), directed = TRUE, collRecip = TRUE, coord = NULL, tcol = 1, bwd = 1, clu = NULL, cex = NULL, tcex = NULL, showLbs = TRUE, showAtts = TRUE, att = NULL, lbat = "1", seed = NULL, maxiter = 100, alpha = c(1, 1, 1), main = NULL, cex.main, bg, mar, pos, asp, lwd, pch, lty, ecol, vcol, vcol0, hds, vedist, rot, mirrorX, mirrorY, col, ...)

Arguments

net
an array; usually with three dimensions of stacked matrices where the multiple relations are placed.
layout
the layout for the visualization:

circ circular

force force-directed algorithm

rand random

directed
(logical) whether or not graph is directed or unidrected
collRecip
(logical) whether or not collapse reciprocated edges in the unidrected graph
coord
(optional) data frame with the coordinates of the vertices. If given layout is ignored
tcol
(optional) the color of the vertices' labels
bwd
(optional) the width of the bundle edges. Ranges from 0 (edges collapsed) to the default 1 (depending on the vertices' size)
clu
(optional) the clustering of the vertices (see details)
cex
(optional) the size of the vertices
tcex
size of the vertex labels. If NULL, it depends on the value of cex
showLbs
(logical) whether or not show the vertex labels
showAtts
(logical) whether or not show the vertex attribute labels
att
(optional) a vector or an array representing the vertices' attributes
lbat
(optional) the labels for the vertices' attributes
seed
(optional) the random seed number for the vertices' initial coordinates. Ignored for other than force or rand
maxiter
(optional) the maximum number of iterations in the force directed algorithm (default 60 plus number of elements)
alpha
vector (vertex, edge, bg) with the alpha color transparecy
main
(optional) title of the plot
cex.main
(optional) the size of the plot's title
bg
(optional) the background color of the plot
mar
(optional) the margins of the plot
pos
(optional) the position of the vertices' labels (0 means ``in the middle of the vertex'')
asp
(optional) the aspect ratio of the plot
lwd
(optional) the width of the edges
pch
(optional) the symbol representing the vertices
lty
(optional) the shape of the edges
ecol
(optional) the color of the edges
vcol
(optional) the color of the vertices
vcol0
(optional) the color of the vertices' contour (only works for pch 21 through 25
hds
(optional, experimental) arcs' head scale
vedist
(optional, experimental) a real with vertex - edge distance
rot
(optional) rotation of the graph in degrees
mirrorX
(optional) mirror of the X axis
mirrorY
(optional) mirror of the Y axis
col
(optional) same as vcol
...
Additional items

Value

A plot of the network as a multigraph.

Details

Multigraph are graph having parallel edges depicting different types of relations in a network. By default a circular layout is applied where each type of tie has a distinctive shape and gray color scale. For a better visualization, undirected multigraphs automatically collapse the reciprocal ties, and there as an argument to prevent this to happen. It is possible to combine the symbols and color of vertices by assigning a class to each network member in the clustering option. Vertices can also have different sizes by specifying the argument with a vector with a length size similar to the network order.

See Also

bmgraph

Examples

Run this code
## Create the data: two binary relations among three elements
arr <- round( replace( array(runif(18), c(3,3,2)), array(runif(18),
       c(3,3,2))>.5, 3 ) )

## Plot the multigraph of this network
multigraph(arr)

## Now with a force directed algorithm
multigraph(arr, layout = "force")

Run the code above in your browser using DataLab