A subgraph statement in a dot graph.

A subgraph label may start with 'cluster' to represent a cluster, which is a special kind of subgraph that is visible in rendering.

A cluster acts like a container of nodes, and may be used to model nodes with children.

Implements

Constructors

Properties

label?: string

The label of the subgraph.

statementList: DotStatement[]

The list of statements inside the subgraph.

Accessors

  • get isCluster(): boolean
  • Whether the subgraph may be interpreted as a cluster by the rendering engine.

    For that, it must have a label that starts with 'cluster'.

    Returns boolean

    Whether the subgraph is a cluster.

Methods

  • Adds an edge to the subgraph.

    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 subgraph statement, for chaining.

  • Adds an attribute to the edges of the subgraph.

    Parameters

    • key: string

      The key of the attribute.

    • value: string

      The value of the attribute.

    Returns this

    This subgraph statement, for chaining.

  • Adds multiple attributes to the edges of the subgraph.

    Parameters

    • attrs: Record<string, string>

      The attributes to add.

    Returns this

    This subgraph statement, for chaining.

  • Adds an attribute to the subgraph.

    Parameters

    • key: string

      The key of the attribute.

    • value: string

      The value of the attribute.

    Returns this

    This subgraph statement, for chaining.

  • Adds multiple attributes to the subgraph.

    Parameters

    • attrs: Record<string, string>

      The attributes to add.

    Returns this

    This subgraph statement, for chaining.

  • Adds a node to the subgraph.

    Parameters

    • id: NodeIdentification

      The ID of the node.

    • Optionalattrs: Record<string, string>

      The list of attributes of the node.

    Returns this

    This subgraph statement, for chaining.

  • Adds an attribute to the nodes of the subgraph.

    Parameters

    • key: string

      The key of the attribute.

    • value: string

      The value of the attribute.

    Returns this

    This subgraph statement, for chaining.

  • Adds multiple attributes to the nodes of the subgraph.

    Parameters

    • attrs: Record<string, string>

      The attributes to add.

    Returns this

    This subgraph statement, for chaining.

  • Adds statements to the subgraph, nested.

    Parameters

    Returns this

    This subgraph statement, for chaining.

  • Converts the subgraph statement to a dot string.

    Parameters

    • directed: boolean

      Whether the graph is directed.

    • indentation: number = 0

      The number of spaces to indent.

    Returns string

    The dot string of the subgraph statement.