File: sample_spanning_tree.Rd

package info (click to toggle)
r-cran-igraph 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,044 kB
  • sloc: ansic: 204,981; cpp: 21,711; fortran: 4,090; yacc: 1,229; lex: 519; sh: 52; makefile: 8
file content (47 lines) | stat: -rw-r--r-- 1,676 bytes parent folder | download
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trees.R
\name{sample_spanning_tree}
\alias{sample_spanning_tree}
\title{Samples from the spanning trees of a graph randomly and uniformly}
\usage{
sample_spanning_tree(graph, vid = 0)
}
\arguments{
\item{graph}{The input graph to sample from. Edge directions are ignored if
the graph is directed.}

\item{vid}{When the graph is disconnected, this argument specifies how to
handle the situation. When the argument is zero (the default), the sampling
will be performed component-wise, and the result will be a spanning forest.
When the argument contains a vertex ID, only the component containing the
given vertex will be processed, and the result will be a spanning tree of the
component of the graph.}
}
\value{
An edge sequence containing the edges of the spanning tree. Use
\code{\link[=subgraph_from_edges]{subgraph_from_edges()}} to extract the corresponding subgraph.
}
\description{
\code{sample_spanning_tree()} picks a spanning tree of an undirected graph
randomly and uniformly, using loop-erased random walks.
}
\examples{

g <- make_full_graph(10) \%du\% make_full_graph(5)
edges <- sample_spanning_tree(g)
forest <- subgraph_from_edges(g, edges)

}
\seealso{
\code{\link[=subgraph_from_edges]{subgraph_from_edges()}} to extract the tree itself

Other trees: 
\code{\link{is_forest}()},
\code{\link{is_tree}()},
\code{\link{make_from_prufer}()},
\code{\link{to_prufer}()}
}
\concept{trees}
\keyword{graph}
\section{Related documentation in the C library}{\href{https://igraph.org/c/html/latest/igraph-Structural.html#igraph_random_spanning_tree}{\code{igraph_random_spanning_tree()}}.}