hexlet / graphs
图实现
v1.1.0
2022-01-16 12:30 UTC
Requires
- php: >=7.4 || >=8.1
- tightenco/collect: ^8.79
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
This package is not auto-updated.
Last update: 2024-09-23 01:16:51 UTC
README
用于处理图的函数。
示例
<?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'], // ]];
此存储库由Hexlet团队和社区创建和维护,Hexlet是一个教育项目。了解更多关于Hexlet。
在 hexlet-friends 上查看最活跃的贡献者。