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 |
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
import freeVertices from '@graph-algorithm/topological-sorting/src/freeVertices.js'Compute the free vertices of the input graph.
Params:
| Name | Type | Attribute | Description |
| 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
import kahn1962 from '@graph-algorithm/topological-sorting/src/kahn1962.js'Kahn's algorithm for topological sorting.
See https://en.wikipedia.org/wiki/Topological_sorting#CITEREFKahn1962
Params:
| Name | Type | Attribute | Description |
| 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
import sorted from '@graph-algorithm/topological-sorting/src/sorted.js'Sort the vertices topologically breaking ties according to a given function.
Params:
| Name | Type | Attribute | Description |
| 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:
If the input graph contains a cycle. |
public subroutine(queue: any, graph: any): Iterable<any> source
import subroutine from '@graph-algorithm/topological-sorting/src/subroutine.js'Sort the vertices topologically using a queue to order the free vertices.
Params:
| Name | Type | Attribute | Description |
| 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. |
