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
|
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{subcomponent}
\alias{subcomponent}
\title{In- or out- component of a vertex}
\usage{
subcomponent(graph, v, mode = c("all", "out", "in"))
}
\arguments{
\item{graph}{The graph to analyze.}
\item{v}{The vertex to start the search from.}
\item{mode}{Character string, either \dQuote{in}, \dQuote{out} or
\dQuote{all}. If \dQuote{in} all vertices from which \code{v} is reachable
are listed. If \dQuote{out} all vertices reachable from \code{v} are
returned. If \dQuote{all} returns the union of these. It is ignored for
undirected graphs.}
}
\value{
Numeric vector, the ids of the vertices in the same component as
\code{v}.
}
\description{
Finds all vertices reachable from a given vertex, or the opposite: all
vertices from which a given vertex is reachable via a directed path.
}
\details{
A breadh-first search is conducted starting from vertex \code{v}.
}
\examples{
g <- sample_gnp(100, 1/200)
subcomponent(g, 1, "in")
subcomponent(g, 1, "out")
subcomponent(g, 1, "all")
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\seealso{
\code{\link{components}}
}
\keyword{graphs}
|