2017 © Pedro PelĂĄez
 

library algorithm

General purpose algorithms

image

xi/algorithm

General purpose algorithms

  • Friday, November 8, 2013
  • by xi-project
  • Repository
  • 19 Watchers
  • 12 Stars
  • 2,985 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

Xi Algorithm

A collection of miscellaneous algorithms., (*1)

Luhn

Usage:, (*2)

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., (*3)

Basically, it's useful for resolving a dependency graph., (*4)

Usage:, (*5)

// 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, (*6)

composer.phar install --dev

and then run the tests with, (*7)

phpunit -c tests

The Versions

08/11 2013

dev-master

9999999-dev http://github.com/xi-project/xi-algorithm

General purpose algorithms

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3

 

The Development Requires

by Mikko Hirvonen
by Joonas Pajunen
by Martin PĂ€rtel

algorithm luhn

08/02 2013

dev-HarmonicSorting

dev-HarmonicSorting http://github.com/xi-project/xi-algorithm

General purpose algorithms

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3

 

by Mikko Hirvonen
by Joonas Pajunen

algorithm luhn