Learn R Programming

igraph (version 1.3.5)

make_from_prufer: Create an undirected tree graph from its Prufer sequence

Description

make_from_prufer creates an undirected tree graph from its Prufer sequence.

Usage

make_from_prufer(prufer)

from_prufer(...)

Value

A graph object.

Arguments

prufer

The Prufer sequence to convert into a graph

...

Passed to make_from_prufer

Details

The Prufer 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.

See Also

to_prufer to convert a graph into its Prufer sequence

Examples

Run this code

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

Run the code above in your browser using DataLab