Description Usage Arguments Details Value Author(s) See Also Examples
Given an adjacency matrix, this function displays the corresponding Hasse diagram. This is a wrapper function for graph creation using the Rgraphviz package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
e |
An adjacency matrix, with e_{i,j} indicating the edge size between vertices i and j (e_{i,j} = 0 means no edge between i and j). The matrix must be rectangular with non-negative non-missing values. |
v |
Vector of names of the vertices. If null, the vertex names will be obtained from column names of adjacency matrix e. |
elab |
Labels of the edges. If it is a scalar value, all edges would have the same label. Otherwise, elab must be a rectangular matrix (similar to adjacency matrix e). A value on i-th row and j-th column is a label of the edge between vertex i and vertex j. |
ecol |
Edge label color. If scalar, all edge labels have the same color. Otherwise, ecol must be in the form of adjacency matrix: a value on i-th row and j-th column is a color of the label of the edge between vertex i and vertex j. |
ebg |
Edge line color. If scalar, all edges have the same color. Otherwise, ebg must be in the form of adjacency matrix: a value on i-th row and j-th column is a color of the edge between vertex i and vertex j. |
vcol |
Vertex label color. If scalar, all vertices have the same label color. Otherwise, vcol must be a vector of the size corresponding to the number of vertices. |
vbg |
Vertex background color. If scalar, all vertices have the same background color. Otherwise, vcol must be a vector of the size corresponding to the number of vertices. |
vsize |
Vertex sizes. If scalar, all vertices have the same size in the image. Otherwise, vsize must be a vector of the size corresponding to the number of vertices. |
fvlab |
Labels of "dot" vertices. Must be scalar. |
fvcol |
"dot" vertex label color. Must be scalar. |
fvbg |
"dot" vertex background color. Must be scalar. |
fvsize |
"dot" vertex size. Must be scalar. |
febg |
Color of edges introduced by edge compression. Must be scalar. |
fesize |
Thickness of edges introduced by edge compression. Must be scalar and non-negative. |
main |
Main title of the diagram. |
compress |
|
This function depicts a Hasse diagram specified with an adjacency matrix e. Hasse diagram is a visualization of partially ordered set, by drawing its transitive reduction as an oriented graph. Each vertex corresponds to an element of the set. There is an edge between vertex i and vertex j iff i < j and there is no z such that i < z < j.
The function is also capable of edge compression via introducing the "dot" edges:
Let U, V be two disjoint non-empty sets of edges,
such that for each u from U and v from V, there exists an edge
from u to v. (The number of such edges equals |U| \cdot |V|.) Starting from
|U| > 2 and |V| > 2, the Hasse diagram may become too complicated and hence confusing.
Therefore a compress
argument exists in this function that enables “compression” of
the edges in such a way that a new “dot” node w is introduced and |U| \cdot |V|
edges between sets U and V are replaced with |U|+|V| edges from set U
to node w and from node w to set V.
Nothing.
Michal Burda
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # linear order
e <- matrix(c(0, 1, 1, 0, 0, 1, 0, 0, 0), nrow=3, byrow=TRUE)
hasse(e)
# prepare adjacency matrix
m <- matrix(0, byrow=TRUE, nrow=5, ncol=5)
m[3, 1] <- 1
m[3, 2] <- 1
m[4, 1] <- 9
m[4, 2] <- 1
m[5, 1] <- 1
m[5, 2] <- 1
m
mc <- m
mc[mc > 0] <- "red"
ms <- m
ms[ms > 0] <- "blue"
# view m with default settings
hasse(m, ebg="black")
# view m WITHOUT edge compression and some fancy adjustments
hasse(v=c("a", "b", "c", "d", "e"),
vcol=c(gray(0.5), gray(1), rep(gray(0), 3)),
vbg=gray(5:1/5), vsize=1:5, e=m, ecol=mc, ebg=ms, elab=m,
compress=FALSE)
# view m WITH edge compression and some fancy adjustments
hasse(v=c("a", "b", "c", "d", "e"),
vcol=c(gray(0.5), gray(1), rep(gray(0), 3)),
vbg=gray(5:1/5), vsize=1:5, e=m, ecol=mc, ebg=ms, elab=m,
compress=TRUE)
|
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, colnames, do.call,
duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 0
[2,] 0 0 0 0 0
[3,] 1 1 0 0 0
[4,] 9 1 0 0 0
[5,] 1 1 0 0 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.