Skip to content

Takes random tree structure and makes it balanced via find-center algorithm

Notifications You must be signed in to change notification settings

phomm/TreeBalancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TreeBalancer

Takes random tree structure and makes it balanced via find-center algorithm Center of tree is the node from which greatest way to all leaves is minimal, or center of diameter (greatest distance between nodes)

Center of tree could be found with 2 (or more, esp. as graph cases) algorithms:

Here we implement second one - by shrinking tree from leaf nodes

Example tree used in algorithm:

With this example tree algorithm finds node 10 as center BUT there are 2 centers, 6 and 10, and the next approach would be analysing subtree sizes if 2 centers found and claim final center the one of two which has "heavier" subtree.

About

Takes random tree structure and makes it balanced via find-center algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages