SPeCS Packages Documentation
    Preparing search index...

    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 Summary)

    Index

    Constructors

    Properties

    getContainer: (
        node: BaseNode.Class,
    ) => BaseNode.Class<BaseNode.Data, BaseNode.ScratchData> | undefined

    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) => 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) => Record<string, string>

    The attributes to add to each node.

    Methods

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

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

      Parameters

      • f: (edge: BaseEdge.Class) => Record<string, string>

        The function that adds attributes to each edge.

      Returns this

      The same formatter, for chaining.

    • 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.

      Returns this

      The same formatter, for chaining.

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

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

      Parameters

      • f: (node: BaseNode.Class) => Record<string, string>

        The function that adds attributes to each node.

      Returns this

      The same formatter, for chaining.