You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-1Lines changed: 24 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,39 @@
1
1
# Xi Algorithm
2
2
3
+
A collection of miscellaneous algorithms.
4
+
3
5
## Luhn
4
6
5
7
Usage:
6
8
7
-
```
9
+
```php
8
10
use Xi\Algorithm\Luhn;
9
11
10
12
$luhn = new Luhn();
11
13
$luhn->generate(123); // 1230
12
14
```
13
15
16
+
## Topological sort
17
+
18
+
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.](http://en.wikipedia.org/wiki/Topological_sorting)
19
+
20
+
Basically, it's useful for resolving a dependency graph.
21
+
22
+
Usage:
23
+
24
+
```php
25
+
// A description of a graph:
26
+
$edges = array(
27
+
'B' => array('C', 'D'), // Node B points to nodes C and D
0 commit comments