Pairs are processed to produce a graph with the elements
of the pairs as vertices and the pairs as undirected edges.
The result can be displayed using plot() if the
Bioconductor packages graph (for the graphNEL object)
and optionally Rgraphviz (for plotting) are installed.
Usage
graph_pairs(x, var.names = NULL, edgemode = c("undirected", "directed"))Arguments
- x
matrixorlistof pairs along a zenpath. Can also be a list containing vectors representing paths in the graph. Every path must be of length at least 2 (i.e. each vector element of the list).- var.names
names of the variables appearing in
x.- edgemode
type of edges to be used: either
"undirected"(the default) or"directed"(in which case the order of the nodes in each pair matters).
Note
This function requires the Bioconductor package graph.
If graph is not installed, an informative error is raised.
Plotting also requires Rgraphviz, but all functionality of
graph_pairs() is available without it.
See also
zenplot() which provides the zenplot.
Other tools related to constructing zenpaths:
connect_pairs(),
extract_pairs(),
groupData(),
indexData(),
zenpath()
Examples
has_Rgraphviz <- requireNamespace("Rgraphviz", quietly = TRUE)
pairs <- matrix(c(1,2, 5,1, 3,4, 2,3, 4,2), ncol = 2, byrow = TRUE)
g <- graph_pairs(pairs)
if (has_Rgraphviz){
Rgraphviz::plot(g)
}
