A formatter for converting a flow graph into a DOT string.

ControlFlowNodes are visualized as contained inside their respective FunctionNode, unless an explicit parent is specified.

The ControlFlowEndNode is visualized as a distinguished special symbol. The entry control-flow node is represented like a regular control-flow node, but with a double border. If a ControlFlowNode has more than one non-fake outgoing edge, it appears diamond-shaped to represent its conditional nature.

A FunctionNode has its name as the label, while a ControlFlowNode has its id as the label. These labels may (and usually should) be overridden by a subclass or an instance.

Colors help distinguish between different types of nodes and edges. fake edges appear with a dashed line.

Type Parameters

  • G extends FlowGraph.Class = FlowGraph.Class

    The type of the graph. This parameter exists so that the formatter may be extended into a formatter that requires a more specific graph type.

Hierarchy (view full)

Constructors

Properties

Given a node, returns the node that will contain it. By default that is the parent of the node, but subclasses may override this method to visualize other parent-like relationships.

getEdgeAttrs: ((edge: BaseEdge.Class<BaseEdge.Data, BaseEdge.ScratchData>) => Record<string, string>)

The attributes to add to each edge.

getGraphAttrs: (() => Record<string, string>)

The attributes to add to the graph.

getNodeAttrs: ((node: BaseNode.Class<BaseNode.Data, BaseNode.ScratchData>) => Record<string, string>)

The attributes to add to each node.

cfgDefaultEdgeColor: string = "#4e7f02"
cfgEdgeTransparency: string = "2f"
cfgEndNodeSize: string = "0.25"
cfgNodeColor: string = "#f29e1f"
cfgNodeDarkColor: string = "#d68e20"
functionColor: string = "#a020f0"
functionDarkColor: string = "#7719b3"
functionFontSize: string = "20"

Methods

  • Adds attributes to the graph. Only overrides the attributes that are explicitly set by the function, leaving the others unchanged.

    For completely overriding the previous attributes, just set getGraphAttrs directly.

    Parameters

    • f: (() => Record<string, string>)

      The function that adds attributes to the graph.

        • (): Record<string, string>
        • Returns Record<string, string>

    Returns this

    The same formatter, for chaining.