File: reverseEdgeDirections.Rd

package info (click to toggle)
r-bioc-graph 1.60.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,076 kB
  • sloc: ansic: 842; makefile: 12; sh: 3
file content (39 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (6)
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
34
35
36
37
38
39
\name{reverseEdgeDirections}
\alias{reverseEdgeDirections}

\title{Reverse the edges of a directed graph}
\description{
  Return a new directed graph instance with each edge oriented in the
  opposite direction relative to the corresponding edge in the input
  graph.
}
\usage{
reverseEdgeDirections(g)
}
\arguments{
  \item{g}{A \code{graph} subclass that can be coerced to \code{graphAM}}
}
\details{
  WARNING: this doesn't handle edge attributes properly.  It is a
  preliminary implementation and subject to change.
}
\value{
  A \code{graphNEL} instance
}
\author{S. Falcon}
\examples{
g <- graphNEL(nodes=c("a", "b", "c"),
         edgeL=list(a=c("b", "c"), b=character(0), c=character(0)),
         edgemode="directed")

stopifnot(isAdjacent(g, "a", "b"))
stopifnot(!isAdjacent(g, "b", "a"))

grev <- reverseEdgeDirections(g)
stopifnot(!isAdjacent(grev, "a", "b"))
stopifnot(isAdjacent(grev, "b", "a"))

}

\keyword{manip}