Class TopologicalScheduler<ID, FROM, TO>

Type Parameters

  • ID
  • FROM extends ID = ID
  • TO extends ID = ID

Constructors

Properties

edges: GraphEdges<ID, FROM, TO>

the edges depict the directed edge from an id (key: FROM) to a set of ids (value: Set<TO>)

stack: ID[]

after a source id is fired, this stack will get filled up with dependent node ids in topological order.
the top item in the stack will correspond to the first node id that must be processed (least dependency), while the bottom one will be the last to be resolved (most dependencies).
use the pop method to pop out the top from this stack, or use the seek method just to view the top without popping.

fire: ((...source_ids) => void)

declare ids that need to be fired simultaneously. once the ids are fired, the function will topologically traverse the edges (via DFS), and eventually push the order of resoluion into the stack.
make sure that the source ids are NOT dependent on one another, because that will break the topological ordering of the output stack.

Type declaration

    • (...source_ids): void
    • declare ids that need to be fired simultaneously. once the ids are fired, the function will topologically traverse the edges (via DFS), and eventually push the order of resoluion into the stack.
      make sure that the source ids are NOT dependent on one another, because that will break the topological ordering of the output stack.

      Parameters

      • Rest ...source_ids: FROM[]

      Returns void

block: ((...block_ids) => void)

while processing topologically ordered stack, you may block certain ids so that they and their (pure) dependents down the line are removed from the stack.
if no id is provided (no arguments), then we will assume that you wish to block the most recently popped id.

Type declaration

    • (...block_ids): void
    • while processing topologically ordered stack, you may block certain ids so that they and their (pure) dependents down the line are removed from the stack.
      if no id is provided (no arguments), then we will assume that you wish to block the most recently popped id.

      Parameters

      • Rest ...block_ids: never[] | FROM[]

      Returns void

clear: (() => void)

clear the topologically ordered stack, perhaps to restart the traversal.

Type declaration

    • (): void
    • clear the topologically ordered stack, perhaps to restart the traversal.

      Returns void

pop: (() => undefined | ID)

pop the top element from the topologically ordered stack.

Type declaration

    • (): undefined | ID
    • pop the top element from the topologically ordered stack.

      Returns undefined | ID

seek: (() => undefined | ID)

view the top element from the topologically ordered stack without popping it.

Type declaration

    • (): undefined | ID
    • view the top element from the topologically ordered stack without popping it.

      Returns undefined | ID

[iterator]: (() => IterableIterator<ID>)

iterate over the topologically ordered stack of ids

Type declaration

    • (): IterableIterator<ID>
    • iterate over the topologically ordered stack of ids

      Returns IterableIterator<ID>

Generated using TypeDoc