A function to create and manipulate multigraphs and weighted multigraphs with different layout options
multigraph(net, layout = c("circ", "force", "stress", "conc", "rand"), scope,
directed = TRUE, main = NULL, lbs, seed = NULL, maxiter = 100,
alpha = c(1, 1, 1), collRecip, showLbs, showAtts, cex.main,
weighted, weights, coord, clu, cex, lwd, pch, lty, bwd, fcol, att,
bg, mar, pos, asp, ecol, vcol, vcol0, cex2, fsize2, fcol2, hds, vedist,
rot, mirrorX, mirrorY, col, lbat, drp, loops, swp, swp2, signed, scl,
add, mirrorD, mirrorL, opt, mirrorV, mirrorH, ffamily, fstyle, fsize, ...)
an array; usually with three dimensions of stacked matrices where the multiple relations are placed.
the visualization layout:
circ
circular
force
force-directed
stress
stress-majorization
conc
concentric
rand
random
(optional) the scope of the graph (see details)
(logical) whether or not the graph is directed or unidrected
(optional) title of the plot
(optional) the vertex labels
(optional) the random seed number for the vertices' initial coordinates. Ignored for circ
and conc
(optional) the maximum number of iterations in layout algorithms. Only for force
, stress
, and rand
vector (vertex, edge, bg
) with the alpha color transparecy
(optional and logical) whether or not collapse reciprocated edges in the unidrected graph
(optional and logical) whether or not show the vertex labels
(optional and logical) whether or not show the vertex attribute labels
(optional) the size of the plot's title
(optional and logical) whether or not the graph is weighted or dichotomous
(optional and logical) whether or not print the weights of the bonds
(optional) data frame with the coordinates of the vertices. If coordinates are given then the layout
option is ignored
(optional) the clustering of the vertices (see details)
(optional) the size of the vertices
(optional) the width of the edges. Ignored if weighted
is set to TRUE
(optional) the symbol representing the vertices
(optional) the shape of the edges
(optional) the width of the bundle edges. Ranges from 0
(edges collapsed) to the default 1
(depending on the vertices' size). For weighted
a value greater than one is possible
the font color
(optional) a vector or an array representing the vertex attributes
(optional) the background color of the plot
(optional) the margins of the plot
(optional) the position of the vertices' labels (0
means ``in the middle of the vertex'')
(optional) the aspect ratio of the plot
(optional) the color of the edges
(optional) the color of the vertices
(optional) the color of the vertices' contour (only works for pch 21
through 25
the size of the background for the weights
the font size of the weights
the font color of the weights
(optional and experimental) arcs' head scale
(optional and experimental) a real number with vertex - edge distance
(optional) clockwise rotation of the graph in degrees
(optional) mirror of the X axis
(optional) mirror of the Y axis
(optional) alias for vcol
(optional) the labels for the vertices' attributes
(optional) for weighted
networks, drop values less than specified
(optional, logical, and experimental) plot graph loops?
(optional and logical) whether or not swap the bundle patterns
(optional and logical) whether or not swap reciprocals
(optional and logical) whether or not the graph is a signed structure
(optional and experimental) numerical scalar (x and y) or vector (x, y) of the graph's scale
(optional) nodes to add to the graph
(optional) mirror reflection across diagonal Y=X
(optional) mirror reflection across diagonal Y=-X
(optional and experimental) optimize the plot margins
same as mirrorX
same as mirrorY
the font family
the font style
the font size
Additional argument items (see e.g. par
)
A plot of the network as a multigraph or a weighted multigraph.
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.
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 are accepted.
# NOT RUN {
## 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)
# }
Run the code above in your browser using DataLab