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 45 46 47 48
|
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/components.R
\name{decompose}
\alias{decompose}
\alias{decompose.graph}
\title{Decompose a graph into components}
\usage{
decompose(graph, mode = c("weak", "strong"), max.comps = NA,
min.vertices = 0)
}
\arguments{
\item{graph}{The original graph.}
\item{mode}{Character constant giving the type of the components, wither
\code{weak} for weakly connected components or \code{strong} for strongly
connected components.}
\item{max.comps}{The maximum number of components to return. The first
\code{max.comps} components will be returned (which hold at least
\code{min.vertices} vertices, see the next parameter), the others will be
ignored. Supply \code{NA} here if you don't want to limit the number of
components.}
\item{min.vertices}{The minimum number of vertices a component should
contain in order to place it in the result list. Eg. supply 2 here to ignore
isolate vertices.}
}
\value{
A list of graph objects.
}
\description{
Creates a separate graph for each component of a graph.
}
\examples{
# the diameter of each component in a random graph
g <- sample_gnp(1000, 1/1000)
components <- decompose(g, min.vertices=2)
sapply(components, diameter)
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\seealso{
\code{\link{is_connected}} to decide whether a graph is connected,
\code{\link{components}} to calculate the connected components of a graph.
}
\keyword{graphs}
|