graphH-class {graph}R Documentation

Class "graphH"

Description

This is a class of graphs that are represented in terms of nodes, a list of in-edge identifiers and a list of out-edge identifiers for the nodes. and a hashtable for the edges. This is a suitable representation for a graph with a large number of nodes and relatively few edges.

Objects from the Class

Objects can be created by calls of the form new("graphH", graphID, nodes, edges, edgemode, ...).

Slots

graphID:
Object of class "Ruuid". This is an unique identifier for the graph. Modifying the graph results in a modification of the graph ID.
nodes:
Object of class "list" with each element an object of class "gNode". The name of each element is its node ID.
label2nodeID:
Object of class "character", this is used internally to map between the node labels and the node IDs.
edges:
Object of class "environment", this is used as hashtable to store the edges (with edge IDs as keys).
edgemode:
Indicates whether edges are "directed" or "undirected"

Extends

Class "graph", directly.

Methods

degree
signature(object = "graphH", Nodes = "missing"): find the degree of the graph nodes (number of coincident edges).
degree
signature(object = "graphH", Nodes = "character"): find the degree of the specified graph nodes.
edges
signature(object = "graphNEL", which="missing"): A method for obtaining the out edges of the nodes as list, each element of the list representing the out edges for a particular node. Each such element is a character vector of end node labels of the out edges for the corresponding begin nodes.
edges
signature(object = "graphNEL", which="character"): A method for obtaining the out edges of the specified nodes.
getNodes
signature(x = "graphH", which = "missing"): A method for obtaining all the nodes of a graph as a list of "gNode" objects.
getNodes
signature(x = "graphH", which = "character"): A method for obtaining the specified nodes of a graph as a list of "gNode" objects.
idstring
signature(x = "graphH"): A method that returns the graph identifier as a character string.
initialize
signature(.Object = "graphH"): Initializer for "graphH" objects.
nodes
signature(object = "graphH"): A method for obtaining the node labels of a graph.
nodes<-
signature(object="graphH", value="character"): A method for replacing the node labels in a graph object. It checks to be sure the values are the right length and unique.

Author(s)

Saikat DebRoy

See Also

graphNEL-class

Examples

v <- lapply(letters[1:5], function(l) new("gNode", label=l))
e <- vector("list", 2)
e[[1]] <- new("gEdge", bNode=v[[1]], eNode=v[[2]])
e[[2]] <- new("gEdge", bNode=v[[2]], eNode=v[[3]])
g <- new("graphH", nodes=v, edges=e)
nodes(g)
edges(g)

[Package graph version 1.8.0 Index]