multigraph | R Documentation |
A function to create and manipulate multigraphs and valued multigraphs with different layout options
multigraph(net, layout = c("circ", "force", "stress", "conc", "rand"), scope,
directed=TRUE, loops, signed, valued, values, lbs, showLbs, att, lbat,
showAtts, main=NULL, cex.main, col.main, font.main, coord, collRecip, undRecip,
seed=NULL, maxiter=100, clu, cex, cex2, pch, lwd, lty, vcol, vcol0, col, ecol,
bwd, bwd2, pos, bg, bg2, asp, drp, add, swp, swp2, alpha=c(1, 1, 1, 1), rot,
mirrorX, mirrorY, mirrorD, mirrorL, mirrorV, mirrorH, scl, hds, vedist, mar,
ffamily, fstyle, fsize, fsize2, fcol, fcol2, lclu, sel, new, mai, lscl,
rm.isol, ...)
net |
an array; usually with three dimensions of stacked matrices where the multiple relations are placed. |
layout |
the visualization layout:
|
scope |
(optional) the scope of the graph (see details) |
directed |
(logical) whether or not the graph is directed or unidrected |
loops |
(optional, logical, and experimental) plot graph loops? |
signed |
(optional and logical) whether or not the graph is a signed structure |
valued |
(optional and logical) whether the graph is depicyed as valued or not |
values |
(optional and logical) print the values of the bonds in edges? |
lbs |
(optional) the vertices labels |
showLbs |
(optional and logical) whether or not show the vertex labels |
att |
(optional) a vector or an array representing the vertex attributes |
lbat |
(optional) the labels for the vertices' attributes |
showAtts |
(optional and logical) whether or not show the vertex attribute labels |
main |
(optional) title of the plot |
cex.main |
(optional) the size of the plot's title |
col.main |
(optional) the color of the plot's title |
font.main |
(optional) the font of the plot's title |
coord |
(optional) data frame with the coordinates of the vertices. If coordinates are given then the |
collRecip |
(optional and logical) whether or not collapse reciprocated edges in the unidrected graph |
undRecip |
(optional and logical) whether or not plot reciprocated edges as undirected |
seed |
(optional) the random seed number for the vertices' initial coordinates. Ignored for |
maxiter |
(optional) the maximum number of iterations in layout algorithms. Only for |
clu |
(optional) the clustering of the vertices (see details) |
cex |
(optional) the size of the vertices |
cex2 |
the size of the background for the values with the |
pch |
(optional) the symbol representing the vertices |
lwd |
(optional) the width of the edges; ignored if |
lty |
(optional) the shape of the edges |
vcol |
(optional) the color of the vertices |
vcol0 |
(optional) the color of the vertices' contour (only works for |
col |
(optional) alias for |
ecol |
(optional) the color of the edges |
bwd |
(optional) the width of the bundle edges. |
bwd2 |
(optional) the width of the bundle loop edges. |
pos |
(optional) the position of the vertices' labels ( |
bg |
(optional) the background color of the plot |
bg2 |
(optional) the background color for |
asp |
(optional) the aspect ratio of the plot |
drp |
(optional) for |
add |
(optional) nodes to add to the graph |
swp |
(optional and logical) whether or not swap the bundle patterns |
swp2 |
(optional and logical) whether or not swap reciprocals |
alpha |
vector (vertex, edge, |
rot |
(optional) clockwise rotation of the graph in degrees |
mirrorX |
(optional) mirror of the |
mirrorY |
(optional) mirror of the |
mirrorD |
(optional) mirror reflection across diagonal |
mirrorL |
(optional) mirror reflection across diagonal |
mirrorV |
same as |
mirrorH |
same as |
scl |
(optional and experimental) numerical scalar ( |
hds |
(optional and experimental) arcs' head scale |
vedist |
(optional and experimental) a real number with vertex - edge distance |
mar |
(optional) the margins of the plot |
ffamily |
the font family |
fstyle |
the font style |
fsize |
the font size |
fsize2 |
the font size for |
fcol |
the font color |
fcol2 |
the font color for |
lclu |
(optional, vector) “levels” in |
sel |
(optional, vector) selection of node's labels to plot |
new |
(optional, logical) new graph on an existing plot? |
mai |
(optional, vector) plot inner margins |
lscl |
(optional for valued graphs) loop scale |
rm.isol |
(optional) remove isolated vertices? |
... |
Additional argument items (see e.g. |
Multigraphs are graphs 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 better visualization, undirected multigraphs automatically collapse the reciprocal relations, and there is an argument to prevent this from happening. It is possible to combine the symbols and colors 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.
Since this function can handle a large number of arguments, these can be stored as a list object that is passed through the scope
option. In this case, a vector made of lists and scalars or combinations of these is accepted for describing characteristics.
The bundle width specified by bwd
(and bwd2
for loops) ranges from 0
(edges collapsed) to the default 1
(depending on the vertices' size). For the valued
option, numbers higher than one are possible.
Use vedist
to adjust vertex–edge distance for large and dense networks.
In some cases, such as when working with dynamic networks, it is needed to specify the ordering of the “levels” of the clustering information given in clu
, and this is done in argument lclu
.
When using new
for plotting the graph with a background image, the previous plot(s), however, can require having an equivalent command to graphics::plot.new()
(cf. e.g. sdam::plot.map()
function).
A plot of the network as a multigraph or a valued multigraph.
Antonio Rivero Ostoic
bmgraph
, ccgraph
, frcd
, stsm
, conc
## 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")
## As weighted graph
multigraph(arr, weighted = TRUE)
## As signed graph
multigraph(arr, signed = TRUE)
## With loops and a costumized vertex size
multigraph(arr, cex = 3, loops = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.