This DataflowGraphBuilder extends DataflowGraph with builder methods to easily and compactly add vertices and edges to a dataflow graph. Its usage thus simplifies writing tests for dataflow graphs.

Hierarchy (View Summary)

Hierarchy-Diagram

UML class diagram of DataflowGraphBuilder

Constructors

Properties

rootVertices: Set<NodeId> = ...

Contains the vertices of the root level graph (i.e., included those vertices from the complete graph, that are nested within function definitions)

Accessors

Methods

  • Adds a new vertex to the graph, for ease of use, some arguments are optional and filled automatically.

    Parameters

    • vertex: DataflowGraphVertexArgument & Omit<DataflowGraphVertexInfo, string | number>

      The vertex to add

    • asRoot: boolean = true

      If false, this will only add the vertex but do not add it to the rootIds|root vertices of the graph. This is probably only of use, when you construct dataflow graphs for tests.

    • overwrite: boolean = false

      If true, this will overwrite the vertex if it already exists in the graph (based on the id).

    Returns this

    • DataflowGraphVertexInfo
    • DataflowGraphVertexArgument
  • Given a node in the normalized AST this either: returns the id if the node directly exists in the DFG returns the ids of all vertices in the DFG that are linked to this returns undefined if the node is not part of the DFG and not linked to any node

    Parameters

    Returns undefined | NodeId[]

  • Returns true if the graph contains a node with the given id.

    Parameters

    • id: NodeId

      The id to check for

    • includeDefinedFunctions: boolean = true

      If true this will check function definitions as well and not just the toplevel

    Returns boolean