SPeCS Packages Documentation
    Preparing search index...

    A dot graph.

    While it would be convenient for DotGraph to extend DotSubgraph, that would violate the Liskov Substitution Principle: you may not use a DotGraph wherever a DotSubgraph is expected.

    Index

    Constructors

    • Creates a new dot graph.

      Parameters

      • Optionallabel: string

        The label of the graph.

      • directed: boolean = true

        Whether the graph is directed.

      • strict: boolean = false

        Whether the graph is strict. A strict graph may not have multiple edges between the same nodes: they are merged into a single edge.

      • statements: DotStatement[] = []

        The list of statements inside the graph.

      Returns DotGraph

    Properties

    directed: boolean

    Whether the graph is directed.

    label?: string

    The label of the graph

    statementList: DotStatement[]

    The list of statements inside the graph.

    strict: boolean

    Whether the graph is marked with the strict keyword.

    A strict graph may not have multiple edges between the same nodes: they are merged into a single edge.

    Methods

    • Adds an attribute to the edges of the graph.

      Parameters

      • key: string

        The key of the attribute.

      • value: string

        The value of the attribute.

      Returns this

      This graph, for chaining.

    • Adds multiple attributes to the edges of the graph.

      Parameters

      • attrs: Record<string, string>

        The attributes to add.

      Returns this

      This graph, for chaining.

    • Adds an attribute to the graph.

      Parameters

      • key: string

        The key of the attribute.

      • value: string

        The value of the attribute.

      Returns this

      This graph, for chaining.

    • Adds multiple attributes to the graph.

      Parameters

      • attrs: Record<string, string>

        The attributes to add.

      Returns this

      This graph, for chaining.

    • Adds an attribute to the nodes of the graph.

      Parameters

      • key: string

        The key of the attribute.

      • value: string

        The value of the attribute.

      Returns this

    • Adds multiple attributes to the nodes of the graph.

      Parameters

      • attrs: Record<string, string>

        The attributes to add.

      Returns this

      This graph, for chaining

    • Converts the graph to a dot string.

      Returns string

      The dot string representation of the graph.