[][src]Module algorithms_edu::algo::graph::tree

Modules

center

This algorithm finds the center(s) of a tree.

height

Tree height Example

height1

Tree height Example

isomorphism

Determines if two unrooted trees are isomorphic. This algorithm can easily be modified to support checking if two rooted trees are isomorphic.

lca

Implementation of finding the Lowest Common Ancestor (LCA) of a tree. This impl first finds an Euler tour from the root node which visits all the nodes in the tree. The node height values obtained from the Euler tour can then be used in combination with a sparse table to find the LCA in O(1).

rooting

Often when working with trees we are given them as a graph with undirected edges, however sometimes a better representation is a rooted tree.

rooting1

An improved implementation of Tree Rooting, in which each node has an pointer to its parent.

sum

Tree Sum Example