File: to_prufer.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 (45 lines) | stat: -rw-r--r-- 1,317 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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trees.R
\name{to_prufer}
\alias{to_prufer}
\title{Convert a tree graph to its Prüfer sequence}
\usage{
to_prufer(graph)
}
\arguments{
\item{graph}{The graph to convert to a Prüfer sequence}
}
\value{
The Prüfer sequence of the graph, represented as a numeric vector of
vertex IDs in the sequence.
}
\description{
\code{to_prufer()} converts a tree graph into its Prüfer sequence.
}
\details{
The Prüfer sequence of a tree graph with n labeled vertices is a sequence of
n-2 numbers, constructed as follows. If the graph has more than two vertices,
find a vertex with degree one, remove it from the tree and add the label of
the vertex that it was connected to to the sequence. Repeat until there are
only two vertices in the remaining graph.
}
\examples{

g <- make_tree(13, 3)
to_prufer(g)

}
\seealso{
\code{\link[=make_from_prufer]{make_from_prufer()}} to construct a graph from its
Prüfer sequence

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