https://github.com/hexlet-components/python-graphs
https://github.com/hexlet-components/python-graphs
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet-components/python-graphs
- Owner: hexlet-components
- License: isc
- Created: 2022-01-15T15:38:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-06T14:39:55.000Z (over 1 year ago)
- Last Synced: 2025-08-24T00:42:46.352Z (10 months ago)
- Language: Python
- Size: 22.5 KB
- Stars: 0
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-graphs
[](../../actions)
## Install
```bash
pip install hexlet-graphs
```
## Usage example
```python
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](docs)
[](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=python-graphs)
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=python-graphs).
See most active contributors on [hexlet-friends](https://friends.hexlet.io/).