Class PrecedenceGraph<T>

A generic precedence graph.

Type Parameters

  • T

Hierarchy (view full)

Constructors

Properties

adjacencyMap: Map<T, Set<T>> = ...

A map from nodes to the set of their upstream neighbors.

numberOfEdges: number = 0

The total number of edges in the graph.

toString: (() => string) = ...

Methods

  • Add all the nodes and edges from the given precedence graph to this one.

    Parameters

    • pg: this

      A precedence graph

    Returns void

  • Add an edge from an upstream node to a downstream one.

    Parameters

    • upstream: T

      The node at which the directed edge starts.

    • downstream: T

      The node at which the directed edge ends.

    Returns void

  • Add the given node to this graph.

    Parameters

    • node: T

    Returns void

  • Return the set of all downstream neighbors of the given node.

    Parameters

    • node: T

      The node to retrieve the outgoing nodes of.

    Returns Set<T>

  • Return an iterator over the nodes in the graph.

    Returns IterableIterator<T>

  • Return the nodes in the graph that have no downstream neighbors.

    Returns Set<T>

  • Return the nodes in the graph that have no upstream neighbors.

    Returns Set<T>

  • Return the set of all upstream neighbors of the given node.

    Parameters

    • node: T

      The node to retrieve the incoming nodes of.

    Returns Set<T>

  • Return true if the graph has a cycle in it.

    Returns boolean

  • Remove a directed edge from an upstream node to a downstream one.

    Parameters

    • upstream: T

      The node at which the directed edge starts.

    • downstream: T

      The node at which the directed edge ends.

    Returns void

  • Remove the given node from the graph.

    Parameters

    • node: T

      The node to remove.

    Returns void

  • Return the size of the graph in terms of number of nodes and edges.

    Returns [number, number]

  • Return a DOT representation of the graph.

    Returns string

  • Return a representation that conforms with the syntax of mermaid.js

    Parameters

    • OptionaledgesWithIssue: [T, T][]

      An array containing arrays with [origin, effect]. Denotes edges in the graph that causes issues to the execution, will be visualized as --x in mermaid.

    Returns string