CommitOrderCalculator
class CommitOrderCalculator (View source)
CommitOrderCalculator implements topological sorting, which is an ordering algorithm for directed graphs (DG) and/or directed acyclic graphs (DAG) by using a depthfirst searching (DFS) to traverse the graph built in memory.
This algorithm have a linear running time based on nodes (V) and dependency between the nodes (E), resulting in a computational complexity of O(V + E).
Constants
NOT_VISITED 

IN_PROGRESS 

VISITED 

Methods
Checks for node (vertex) existence in graph.
Adds a new node (vertex) to the graph, assigning its hash and value.
Adds a new dependency (edge) to the graph using their hashes.
Return a valid order list of all current nodes.
Details
at line 73
boolean
hasNode(string $hash)
Checks for node (vertex) existence in graph.
at line 86
void
addNode(string $hash, object $node)
Adds a new node (vertex) to the graph, assigning its hash and value.
at line 107
void
addDependency(string $fromHash, string $toHash, integer $weight)
Adds a new dependency (edge) to the graph using their hashes.
at line 127
array
sort()
Return a valid order list of all current nodes.
The desired topological sorting is the reverse post order of these searches.
{@internal Highly performancesensitive method.}