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 40 41 42 43 44
|
\name{subGraph}
\alias{subGraph}
\alias{subGraph,character,graphNEL-method}
\alias{subGraph,character,clusterGraph-method}
\alias{subGraph,character,distGraph-method}
\alias{subGraph,character,MultiGraph-method}
\alias{subGraph,character,graphBAM-method}
\title{Create a Subgraph }
\description{
Given a set of nodes and a graph this function creates
and returns subgraph with only the supplied nodes and any edges
between them.
}
\usage{
subGraph(snodes, graph)
}
\arguments{
\item{snodes}{A \code{character} vector of node labels. }
\item{graph}{A graph object, it must inherit from the \code{graph} class. }
}
\details{
The returned subgraph is a copy of the graph. Implementations for
Implementations for \code{graphNEL}, \code{distGraph} and
\code{clusterGraph}.
}
\value{
A graph of the same class as the \code{graph} argument but with only
the supplied nodes.
}
\author{R. Gentleman }
\seealso{ \code{\link{nodes}},\code{\link{edges}} }
\examples{
set.seed(123)
x <- rnorm(26)
names(x) <- letters
library(stats)
d1 <- dist(x)
g1 <- new("distGraph", Dist=d1)
subGraph(letters[1:5], g1)
}
\keyword{manip}
|