Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ugraph

Underlying Graph


Description

For a directed graph the underlying graph is the graph that is constructed where all edge orientation is ignored. This function carries out such a transformation on graphNEL instances.

Usage

ugraph(graph)

Arguments

graph

a graph object.

Details

If graph is already undirected then it is simply returned.

If graph is a multi-graph (has multiple edges) an error is thrown as it is unclear how to compute the underlying graph in that context.

The method will work for any graph subclass for which an edgeMatrix method exists.

Value

An instance of graphNEL with the same nodes as the input but which is undirected.

Author(s)

R. Gentleman

References

Graph Theory and its Applications, J. Gross and J. Yellen.

See Also

Examples

V <- letters[1:4]
edL2 <- vector("list", length=4)
names(edL2) <- V
for(i in 1:4)
  edL2[[i]] <- list(edges=c(2,1,2,1)[i], weights=sqrt(i))
gR2 <- graphNEL(nodes=V, edgeL=edL2, edgemode="directed")

ugraph(gR2)

graph

graph: A package to handle graph data structures

v1.68.0
Artistic-2.0
Authors
R. Gentleman, Elizabeth Whalen, W. Huber, S. Falcon
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.