xi/algorithm
Composer 安装命令:
composer require xi/algorithm
包简介
General purpose algorithms
关键字:
README 文档
README
A collection of miscellaneous algorithms.
Luhn
Usage:
use Xi\Algorithm\Luhn; $luhn = new Luhn(); $luhn->generate(123); // 1230
Topological sort
Sorts the nodes of an acyclic graph so that if node X points to node Y then Y appears before X in the list. Read more.
Basically, it's useful for resolving a dependency graph.
Usage:
// A description of a graph: $edges = array( 'B' => array('C', 'D'), // Node B points to nodes C and D 'A' => array('B'), // Node A points to node B 'C' => array('D'), // Node C points to node D ); $nodesSorted = \Xi\Algorithm\TopologicalSort::apply($edges); // $nodesSorted is now array('D', 'C', 'B', 'A')
Running the tests
No dependencies to other libraries exist, but in order to generate an autoloader first run
composer.phar install --dev
and then run the tests with
phpunit -c tests
统计信息
- 总下载量: 3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-02-06