The default formatter for converting a graph into a DOT string.

All nodes and all edges are present in the resulting graph. Nodes that are parents are represented as clusters, with an appropriate hack (invisible point node) to make the edges connect correctly.

Type Parameters

  • G extends BaseGraph.Class = BaseGraph.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.

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.