Skip to content

hexlet-components/python-graphs

Repository files navigation

python-graphs

github action status

Install

pip install hexlet-graphs

Usage example

from hexlet.graphs import (
    build_tree_from_leaf,
    make_joints,
    sort_tree
)

tree = ['B', [
    ['D'],
    ['A', [
        ['C', [
            ['F'],
            ['E'],
        ]],
    ]],
]]

joints = make_joints(tree)
transformed = build_tree_from_leaf(joints, 'C')
# ['C', [
#     ['F'],
#     ['E'],
#     ['A', [
#         ['B', [
#             ['D'],
#         ]],
#     ]],
# ]]

sort_tree(transformed)
# ['C', [
#     ['A', [
#         ['B', [
#             ['D'],
#         ]],
#     ]],
#     ['E'],
#     ['F'],
# ]]

For more information, see the Full Documentation

Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.

See most active contributors on hexlet-friends.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •