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.

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 edge to the graph.

    Parameters

    • source: NodeIdentification

      The ID of the source node of the edge.

    • target: NodeIdentification

      The ID of the target node of the edge.

    • Optionalattrs: Record<string, string>

      The list of attributes of the edge.

    Returns this

    This graph, for chaining.

  • 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