A sortable precedence graph for reactions.

Hierarchy (view full)

Constructors

Properties

adjacencyMap: Map<Reaction<Variable[]>, Set<Reaction<Variable[]>>> = ...

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

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

    Parameters

    • OptionaledgesWithIssue: [Reaction<Variable[]>, Reaction<Variable[]>][]

      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

  • Assign priorities to the nodes of the graph such that any two nodes of which one has precedence over the other, the priority of the one node is lower than the other.

    Parameters

    • destructive: boolean = false

      Destroy the graph structure if true, leave it in tact by working on a copy if false (the default).

    • spacing: number = 100

      The minimum spacing between the priorities of two nodes that are in a precedence relationship. The default is 100.

    Returns boolean

    True if priorities were assigned successfully, false if the graph has one or more cycles.