Title: | Visualizing Hypergaphs |
---|---|
Description: | Functions for visualizing hypergraphs. |
Authors: | Paul Murrell |
Maintainer: | Paul Murrell <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.59.0 |
Built: | 2024-10-30 08:27:44 UTC |
Source: | https://github.com/bioc/hyperdraw |
A convenience constructor for graphBPH-class
objects. This is a generic function.
graphBPH(graph, edgeNodePattern, ...)
graphBPH(graph, edgeNodePattern, ...)
graph |
Some form of graph that is to be converted into a
|
edgeNodePattern |
A regular expression used to distinguish between normal nodes and edge nodes. |
... |
Potential arguments to other methods. |
An object of class graphBPH-class
signature(graph = "graphNEL", edgeNodePattern = "character")
:
create a graphBPH
object from a (directed) graphNEL
object.
signature(graph = "Hypergraph", edgeNodePattern = "missing")
:
create a graphBPH
object from a Hypergraph
object (where all Hyperedges
are
DirectedHyperedges
).
Paul Murrell
Falcon, S. and Gentleman, R. hypergraph: A package providing hypergraph data structures.
Gentleman, R. and Whalen, E. and Huber, W. and Falcon, S. graph: A package to handle graph data structures.
A bipartite representation of a hypergraph. The purpose of this class is to support visualization of the hypergraph; it is not intended for analysis or manipulation of the hypergraph.
Objects can be created by calls of the form new("graphBPH",
graph, edgeNodePattern, ...)
.
There is also a convenience function graphBPH()
.
A graphBPH
object consists of a graphNEL
object, which must obey some strict rules:
nodes in the graph are divided into two sets: normal nodes and edge-nodes,
all edges in the graph must connect a normal node to an edge node,
the graph must be a directed graph.
The edgeNodePattern
is a regular expression that is
used to define the set of edge-nodes.
graph
:Object of class graphNEL
. This graph
must obey the constraints described above.
edgeNodePattern
:Object of class character
.
The regular expression used to define edge-nodes.
nodes
:Object of class character
.
Records which nodes in the graph are normal nodes.
edgeNodes
:Object of class character
.
Records which nodes in the graph are edge-nodes.
edgeNodeIO
:Object of class list
.
Records information about which edges enter and exit
each edge-node.
signature(x = "graphBPH", y = "ANY")
:
draw a representation of the hypergraph where edges between
normal nodes in the graph pass through an intermediate
edge-node in a nice smooth curve.
signature(graph = "graphBPH",
layoutType = "missing")
:
convert the graphBPH
object to a
RagraphBPH
object (using a default layout method).
signature(graph = "graphBPH",
layoutType = "character")
:
convert the graphBPH
object to a
RagraphBPH
object (using the specified layout method).
Paul Murrell
Gansner, E.R. and and North, S.C. (1999) An open graph visualization system and its applications to software engineering, Software - Practice and Experience, 30:1203–1233.
Gentleman, R. and Whalen, E. and Huber, W. and Falcon, S. graph: A package to handle graph data structures.
Gentry, J. and Long, L. and Gentleman, R. and Falcon, S. and Hahne, F. and Sarkar, D. and Hansen, K. Rgraphviz: Provides plotting capabilities for R graph objects.
agopen
,
graphLayout
and
graphNEL
RagraphBPH
nodes <- c(LETTERS[1:5], paste("R", 1:3, sep="")) testgnel <- new("graphNEL", nodes=nodes, edgeL=list( A=list(edges=c("R1", "R2")), B=list(edges="R2"), C=list(), D=list(edges="R3"), E=list(), R1=list(edges="B"), R2=list(edges=c("C", "D")), R3=list(edges="E")), edgemode="directed") testbph <- graphBPH(testgnel, "^R") plot(testbph) # A Hypergraph equivalent require(hypergraph) dh1 <- DirectedHyperedge("A", "B", "R1") dh2 <- DirectedHyperedge(c("A", "B"), c("C", "D"), "R2") dh3 <- DirectedHyperedge("D", "E", "R3") hg <- Hypergraph(LETTERS[1:5], list(dh1, dh2, dh3)) plot(graphBPH(hg))
nodes <- c(LETTERS[1:5], paste("R", 1:3, sep="")) testgnel <- new("graphNEL", nodes=nodes, edgeL=list( A=list(edges=c("R1", "R2")), B=list(edges="R2"), C=list(), D=list(edges="R3"), E=list(), R1=list(edges="B"), R2=list(edges=c("C", "D")), R3=list(edges="E")), edgemode="directed") testbph <- graphBPH(testgnel, "^R") plot(testbph) # A Hypergraph equivalent require(hypergraph) dh1 <- DirectedHyperedge("A", "B", "R1") dh2 <- DirectedHyperedge(c("A", "B"), c("C", "D"), "R2") dh3 <- DirectedHyperedge("D", "E", "R3") hg <- Hypergraph(LETTERS[1:5], list(dh1, dh2, dh3)) plot(graphBPH(hg))
This function is designed to layout a graph using
the Rgraphviz package.
The hyperdraw package makes this a generic function with a method for
graphBPH
objects.
The function of the same name in the Rgraphviz
package is used as a method for Ragraph
objects.
graphLayout(graph, layoutType, ...)
graphLayout(graph, layoutType, ...)
graph |
An |
layoutType |
The layout method (e.g., |
... |
These arguments will be passed to the |
An RagraphBPH
object.
Paul Murrell
Gansner, E.R. and and North, S.C. (1999) An open graph visualization system and its applications to software engineering, Software - Practice and Experience, 30:1203–1233.
Gentry, J. and Long, L. and Gentleman, R. and Falcon, S. and Hahne, F. and Sarkar, D. and Hansen, K. Rgraphviz: Provides plotting capabilities for R graph objects.
nodes <- c(LETTERS[1:5], paste("R", 1:3, sep="")) testgnel <- new("graphNEL", nodes=nodes, edgeL=list( A=list(edges=c("R1", "R2")), B=list(edges="R2"), C=list(), D=list(edges="R3"), E=list(), R1=list(edges="B"), R2=list(edges=c("C", "D")), R3=list(edges="E")), edgemode="directed") testbph <- new("graphBPH", testgnel, "^R") testrabph <- graphLayout(testbph)
nodes <- c(LETTERS[1:5], paste("R", 1:3, sep="")) testgnel <- new("graphNEL", nodes=nodes, edgeL=list( A=list(edges=c("R1", "R2")), B=list(edges="R2"), C=list(), D=list(edges="R3"), E=list(), R1=list(edges="B"), R2=list(edges=c("C", "D")), R3=list(edges="E")), edgemode="directed") testbph <- new("graphBPH", testgnel, "^R") testrabph <- graphLayout(testbph)
The purpose of this class is to represent a
laid out version of a graphBPH
object.
The laying out is performed by the Rgraphviz package.
This is an intermediate step in the process of drawing
a graphBPH
object.
Objects of this class should be created via the
graphLayout()
function.
graph
:Object of class Ragraph
.
The laid out graph.
allNodes
:Object of class character
.
The names of all nodes in the graph.
nodes
:Object of class character
.
Records normal nodes in the graph.
edgeNodes
:Object of class character
.
Records edge-nodes in the graph.
edgeNodeIO
:Object of class list
.
Records which edges enter and exit each edge-node.
signature(x = "RagraphBPH", y = "ANY")
:
draw a representation of the hypergraph where edges between
normal nodes in the graph pass through an intermediate
edge-node in a nice smooth curve.
signature(self = "RagraphBPH",
attr = "character", value = "ANY")
:
set the default drawing attributes for all edges.
signature(self = "RagraphBPH",
from = "character", to = "character", attr = "character",
value = "ANY")
:
set a specific drawing attribute for one or more edges.
signature(self = "RagraphBPH",
attr = "character", value = "ANY")
:
set the default drawing attributes for all nodes.
signature(self = "RagraphBPH",
n = "character", attr = "character", value = "ANY")
:
set a specific attribute for one or more nodes.
signature(self = "RagraphBPH",
attr = "character", value = "ANY")
:
set the default drawing attributes for the graph.
signature(self = "RagraphBPH",
n = "character", attr = "character", value = "ANY")
:
set a specific attribute for the graph.
Paul Murrell
graphLayout
,
graphBPH
,
and
Ragraph
nodes <- c(LETTERS[1:5], paste("R", 1:3, sep="")) testgnel <- new("graphNEL", nodes=nodes, edgeL=list( A=list(edges=c("R1", "R2")), B=list(edges="R2"), C=list(), D=list(edges="R3"), E=list(), R1=list(edges="B"), R2=list(edges=c("C", "D")), R3=list(edges="E")), edgemode="directed") testbph <- graphBPH(testgnel, "^R") testrabph <- graphLayout(testbph) edgeDataDefaults(testrabph, "lwd") <- 1 edgeData(testrabph, c("A", "R1"), c("R1", "B"), "lwd") <- c("3", 5) edgeDataDefaults(testrabph, "color") <- "black" edgeData(testrabph, c("A", "R1"), c("R1", "B"), "color") <- "red" nodeDataDefaults(testrabph, "margin") <- 'unit(2, "mm")' nodeDataDefaults(testrabph, "shape") <- "circle" plot(testrabph) graphDataDefaults(testrabph, "arrowLoc") <- "middle" graphData(testrabph, "arrowLoc") <- "end" plot(testrabph) graphData(testrabph, "arrowLoc") <- "none" plot(testrabph)
nodes <- c(LETTERS[1:5], paste("R", 1:3, sep="")) testgnel <- new("graphNEL", nodes=nodes, edgeL=list( A=list(edges=c("R1", "R2")), B=list(edges="R2"), C=list(), D=list(edges="R3"), E=list(), R1=list(edges="B"), R2=list(edges=c("C", "D")), R3=list(edges="E")), edgemode="directed") testbph <- graphBPH(testgnel, "^R") testrabph <- graphLayout(testbph) edgeDataDefaults(testrabph, "lwd") <- 1 edgeData(testrabph, c("A", "R1"), c("R1", "B"), "lwd") <- c("3", 5) edgeDataDefaults(testrabph, "color") <- "black" edgeData(testrabph, c("A", "R1"), c("R1", "B"), "color") <- "red" nodeDataDefaults(testrabph, "margin") <- 'unit(2, "mm")' nodeDataDefaults(testrabph, "shape") <- "circle" plot(testrabph) graphDataDefaults(testrabph, "arrowLoc") <- "middle" graphData(testrabph, "arrowLoc") <- "end" plot(testrabph) graphData(testrabph, "arrowLoc") <- "none" plot(testrabph)