This class represents the control flow graph of an R program. The control flow may be hierarchical when confronted with function definitions (see CfgSimpleVertex and CFG#rootVertexIds|rootVertexIds()).

There are two very simple visitors to traverse a CFG:

  • visitCfgInOrder visits the graph in the order of the vertices
  • visitCfgInReverseOrder visits the graph in reverse order

If you want to prohibit modification, please refer to the ReadOnlyControlFlowGraph interface.

Type Parameters

Implements

Constructors

Methods

  • Check if a vertex with the given id exists in the graph.

    Parameters

    • id: NodeId

      the id of the vertex to check

    • includeBlocks: boolean = true

      if true, the elements of basic block elements are included in the check, otherwise this will only check the basic blocks themselves

      This is the pendant of DataflowGraph#hasVertex|hasVertex() on a DataflowGraph.

    Returns boolean

  • Merge another control flow graph into this one.

    Parameters

    • other: ControlFlowGraph<Vertex>

      the other control flow graph to merge into this one

    • forceNested: boolean = false

      should the other graph be assumed to be fully nested (e.g., within a function definition).

      This is the pendant of DataflowGraph#mergeWith|mergeWith() on a DataflowGraph.

    Returns this

  • Provide a view of all vertices in the graph.

    Parameters

    • includeBasicBlockElements: boolean = true

      if true, the elements of basic block elements are included in the result, otherwise this will only the basic blocks themselves

    Returns ReadonlyMap<NodeId, CfgSimpleVertex>

    • ReadOnlyControlFlowGraph#rootVertexIds|rootVertexIds() - for a way to get the root vertices of the graph.
    • getVertex() - for a way to get a specific vertex by its id.
    • edges() - for a way to get all edges in the graph.