Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

6 watching

Forks

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'],
# ]]

Hexlet Ltd. logo

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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages