hexlet / graphs
Graphs implementation
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 1
Open Issues: 0
pkg:composer/hexlet/graphs
Requires
- php: >=7.4 || >=8.1
- tightenco/collect: ^8.79
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
README
Functions for working with Graphs.
Examples
<?php use function Php\Graphs\graphs\makeJoints; use function Php\Graphs\graphs\buildTreeFromLeaf; use function Php\Graphs\graphs\sortJoints; $tree = ['B', [ ['D'], ['A', [ ['C', [ ['F'], ['E'], ]], ]], ]]; $joints = makeJoints($tree); $transformed = buildTreeFromLeaf($joints, 'C'); // ['C', [ // ['F'], // ['E'], // ['A', [ // ['B', [ // ['D'], // ]], // ]], // ]]; sortTree($transformed); // ['C', [ // ['A', [ // ['B', [ // ['D'], // ]], // ]], // ['E'], // ['F'], // ]];
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.
