The dataflow graph holds the dataflow information found within the given AST. We differentiate the directed edges in EdgeType and the vertices indicated by DataflowGraphVertexArgument

The vertices of the graph are organized in a hierarchical fashion, with a function-definition node containing the node ids of its subgraph. However, all edges are hoisted at the top level in the form of an (attributed) adjacency list. After the dataflow analysis, all sources and targets of the edges must be part of the vertices. However, this does not have to hold during the construction as edges may point from or to vertices which are yet to be constructed.

All methods return the modified graph to allow for chaining.

Type Parameters

Hierarchy (view full)

Hierarchy-Diagram

UML class diagram of DataflowGraph

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

  • If you do not pass the to node, this will just mark the node as maybe

    Parameters

    Returns this

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

    Parameters

    • vertex: DataflowGraphVertexArgument & Omit<Vertex, 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.

    Returns this

    • DataflowGraphVertexInfo
    • DataflowGraphVertexArgument
  • Get the DataflowGraphVertexInfo attached to a vertex.

    Parameters

    • id: NodeId

      The id of the node to get

    • includeDefinedFunctions: boolean = true

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

    Returns undefined | Vertex

    the node info for the given id (if it exists)

    #get

  • 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

  • Merges the other graph into this one (in-place). The return value is only for convenience.

    Parameters

    • otherGraph: undefined | DataflowGraph<Vertex, Edge>

      The graph to merge into this one

    • mergeRootVertices: boolean = true

      If false, this will only merge the vertices and edges but exclude the root vertices this is probably only of use in the context of function definitions

    Returns this

  • Allows setting the id-map explicitly (which should only be used when, e.g., you plan to compare two dataflow graphs on the same AST-basis)

    Parameters

    Returns void

  • Parameters

    • includeDefinedFunctions: boolean

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

    Returns IterableIterator<[NodeId, Vertex], any, any>

    the ids of all toplevel vertices in the graph together with their vertex information

    #edges