Home Manual Reference Source

Function

Static Public Summary
public

freeVertices(graph: any): Iterable

Compute the free vertices of the input graph.

public

* kahn1962(queue: any, graph: any): Iterable<any>

Kahn's algorithm for topological sorting.

See https://en.wikipedia.org/wiki/Topological_sorting#CITEREFKahn1962

public

* sorted(edges: Iterable<any>, breakTies: Function): Iterable<any>

Sort the vertices topologically breaking ties according to a given function.

public

subroutine(queue: any, graph: any): Iterable<any>

Sort the vertices topologically using a queue to order the free vertices.

Static Public

public freeVertices(graph: any): Iterable source

Compute the free vertices of the input graph.

Params:

NameTypeAttributeDescription
graph any

The input graph as a list of edges.

Return:

Iterable

The free vertices of the input graph.

public * kahn1962(queue: any, graph: any): Iterable<any> source

Kahn's algorithm for topological sorting.

See https://en.wikipedia.org/wiki/Topological_sorting#CITEREFKahn1962

Params:

NameTypeAttributeDescription
queue any

Free vertices.

graph any

Edges of the graph.

Return:

Iterable<any>

The vertices in topological order.

public * sorted(edges: Iterable<any>, breakTies: Function): Iterable<any> source

Sort the vertices topologically breaking ties according to a given function.

Params:

NameTypeAttributeDescription
edges Iterable<any>

The input graph as a list of edges.

breakTies Function

The function to break ties.

Return:

Iterable<any>

The vertices sorted in topological order.

Throw:

Error

If the input graph contains a cycle.

public subroutine(queue: any, graph: any): Iterable<any> source

Sort the vertices topologically using a queue to order the free vertices.

Params:

NameTypeAttributeDescription
queue any

The queue that will be used.

graph any

The input graph as a list of edges.

Return:

Iterable<any>

The vertices sorted in topological order.