make_from_prufer: Create an undirected tree graph from its Prüfer sequence

make_from_pruferR Documentation

Create an undirected tree graph from its Prüfer sequence

Description

make_from_prufer() creates an undirected tree graph from its Prüfer sequence.

Usage

make_from_prufer(prufer)

from_prufer(...)

Arguments

prufer

The Prüfer sequence to convert into a graph

...

Passed to make_from_prufer()

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.

Value

A graph object.

Related documentation in the C library

igraph_from_prufer().

See Also

to_prufer() to convert a graph into its Prüfer sequence

Other trees: is_forest(), is_tree(), sample_spanning_tree(), to_prufer()

Examples


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

igraph documentation built on Oct. 20, 2024, 1:06 a.m.