DOT model representing a subgraph.

interface SubgraphModel {
    $$type: "Subgraph";
    attributes: Readonly<GraphCommonAttributes>;
    comment?: string;
    edges: readonly EdgeModel[];
    id?: string;
    nodes: readonly NodeModel[];
    size: number;
    subgraphs: readonly SubgraphModel[];
    values: readonly ["rank" | values, Attribute<"rank" | values>][];
    addEdge(edge): void;
    addNode(node): void;
    addSubgraph(subgraph): void;
    apply(attributes): void;
    clear(): void;
    createEdge(targets, attributes?): EdgeModel;
    createNode(id, attributes?): NodeModel;
    createSubgraph(id?, attributes?): SubgraphModel;
    createSubgraph(attributes?): SubgraphModel;
    delete(key): void;
    edge(targets, callback?): EdgeModel;
    edge(targets, attributes, callback?): EdgeModel;
    edge(attributes): void;
    existEdge(edge): boolean;
    existNode(nodeId): boolean;
    existSubgraph(subgraph): boolean;
    get<K>(key): undefined | Attribute<K>;
    getNode(id): undefined | NodeModel;
    getSubgraph(id): undefined | SubgraphModel;
    graph(attributes): void;
    isSubgraphCluster(): boolean;
    node(id, callback?): NodeModel;
    node(id, attributes, callback?): NodeModel;
    node(attributes): void;
    removeEdge(edge): void;
    removeNode(node): void;
    removeSubgraph(subgraph): void;
    set<K>(key, value): void;
    subgraph(id, callback?): SubgraphModel;
    subgraph(id, attributes, callback?): SubgraphModel;
    subgraph(attributes, callback?): SubgraphModel;
    subgraph(callback?): SubgraphModel;
    with(models): void;
}

Hierarchy (view full)

Properties

$$type: "Subgraph"

The type of the DotObjectType.

attributes: Readonly<GraphCommonAttributes>
comment?: string

Comments to include when outputting with toDot.

edges: readonly EdgeModel[]

Edge objects in the graph.

id?: string
nodes: readonly NodeModel[]

Node objects in the graph.

size: number

Size of the set of keys and values held by the DOT object.

subgraphs: readonly SubgraphModel[]

Subgraph objects in the graph.

values: readonly ["rank" | values, Attribute<"rank" | values>][]

The key/value tuples of the object attributes.

Methods

  • Delete the value of an attribute from a DOT object by specifying a key.

    Parameters

    • key: "rank" | values

    Returns void

  • Create a edge.

    By specifying a callback function, the target edge can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a edge.
    g.edge(['a', 'b']);
    });

    console.log(toDot(G));
    // digraph "G" {
    // "a" -> "b";
    // }

    Parameters

    • targets: EdgeTargetLikeTuple

      Nodes.

    • Optional callback: ((edge) => void)

      Callbacks for manipulating created or retrieved edge.

        • (edge): void
        • Parameters

          Returns void

    Returns EdgeModel

  • Create a edge and adapt the attributes.

    By specifying a callback function, the target edge can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a edge and specifying its attributes.
    g.edge(['a', 'b'], {
    [attribute.color]: 'red',
    [attribute.label]: 'my label',
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // "a" -> "b" [
    // color = "red",
    // label = "my label",
    // ];
    // }

    Parameters

    • targets: EdgeTargetLikeTuple
    • attributes: EdgeAttributesObject

      Object of attributes to be adapted to the edge.

    • Optional callback: ((edge) => void)

      Callbacks for manipulating created or retrieved edge.

        • (edge): void
        • Parameters

          Returns void

    Returns EdgeModel

  • Set a common attribute for the edges in the graph.

    const G = digraph('G', (g) => {
    // Set a common attribute for the edges in the graph.
    g.edge({
    [attribute.color]: 'red',
    [attribute.label]: 'my label',
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // edge [
    // color = "red",
    // label = "my label",
    // ];
    // }

    Parameters

    Returns void

  • Get the value of an attribute by a DOT object by specifying its key.

    If the value corresponding to the key does not exist, undefined is returned.

    Type Parameters

    • K extends "rank" | values

    Parameters

    • key: K

    Returns undefined | Attribute<K>

  • Get Node in cluster by specifying id.

    Parameters

    • id: string

    Returns undefined | NodeModel

    Description

    If there is no Node with the specified id in the graph, return undefined.

  • Set a common attribute for the graph in the graph.

    const G = digraph('G', (g) => {
    g.graph({
    [attribute.color]: 'red',
    [attribute.label]: 'my label',
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // graph [
    // color = "red",
    // label = "my label",
    // ];
    // }

    Parameters

    Returns void

  • Determines whether the Subgraph is a SubgraphCluster.

    Returns boolean

  • Create a node by specifying its id (or get it if it already exists).

    By specifying a callback function, the target node can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a node with id as A.
    g.node('A');
    });

    console.log(toDot(G));
    // digraph "G" {
    // "A";
    // }

    Parameters

    • id: string

      Node ID.

    • Optional callback: ((node) => void)

      Callbacks for manipulating created or retrieved node.

        • (node): void
        • Parameters

          Returns void

    Returns NodeModel

  • Create a node (or get one if it already exists) and adapt the attributes.

    By specifying a callback function, the target node can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a node by specifying its id and specifying its attributes.
    g.node('A', {
    [attribute.color]: 'red',
    [attribute.label]: 'my label',
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // "A" [
    // color = "red",
    // label = "my label",
    // ];
    // }

    Parameters

    • id: string

      Node ID.

    • attributes: NodeAttributesObject

      Object of attributes to be adapted to the node.

    • Optional callback: ((node) => void)

      Callbacks for manipulating created or retrieved node.

        • (node): void
        • Parameters

          Returns void

    Returns NodeModel

  • Set a common attribute for the nodes in the graph.

    const G = digraph('G', (g) => {
    // Set a common attribute for the nodes in the graph.
    g.node({
    [attribute.color]: 'red',
    [attribute.label]: 'my label',
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // node [
    // color = "red",
    // label = "my label",
    // ];
    // }

    Parameters

    Returns void

  • Set a value, by specifying the key of the attributes in the DOT object.

    Type Parameters

    • K extends "rank" | values

    Parameters

    Returns void

  • Create a subgraph by specifying its id (or get it if it already exists).

    By specifying a callback function, the target subgraph can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a cluster with id as A.
    g.subgraph('A', (A) => {
    // Create a node with id as A1 in cluster A.
    A.node('A1');
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // subgraph "A" {
    // "A1";
    // }
    // }

    Parameters

    • id: string

      Subgraph ID.

    • Optional callback: ((subgraph) => void)

      Callbacks for manipulating created or retrieved subgraph.

    Returns SubgraphModel

  • Create a subgraph (or get one if it already exists) and adapt the attributes.

    By specifying a callback function, the target subgraph can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a cluster with id as A and specifying its attributes.
    g.subgraph('A', { [attribute.color]: 'red', [attribute.label]: 'my label' }, (A) => {
    // Create a node with id as A1 in cluster A.
    A.node('A1');
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // subgraph "A" {
    // color = "red";
    // label = "my label";
    // "A1";
    // }
    // }

    Parameters

    • id: string

      Subgraph ID.

    • attributes: SubgraphAttributesObject

      Object of attributes to be adapted to the subgraph.

    • Optional callback: ((subgraph) => void)

      Callbacks for manipulating created or retrieved subgraph.

    Returns SubgraphModel

  • Create anonymous subgraphs and and adapt the attributes.

    By specifying a callback function, the target subgraph can be received and manipulated as an argument.

    const G = digraph('G', (g) => {
    // Create a anonymous cluster and specifying its attributes.
    g.subgraph({ [attribute.color]: 'red', [attribute.label]: 'my label' }, (A) => {
    // Create a node with id as A1 in anonymous cluster.
    A.node('A1');
    });
    });

    console.log(toDot(G));
    // digraph "G" {
    // subgraph {
    // color = "red";
    // label = "my label";
    // "A1";
    // }
    // }

    Parameters

    • attributes: SubgraphAttributesObject

      Object of attributes to be adapted to the subgraph.

    • Optional callback: ((subgraph) => void)

      Callbacks for manipulating created or retrieved subgraph.

    Returns SubgraphModel

  • Create anonymous subgraphs and manipulate them with callback functions.

    By specifying a callback function, the target subgraph can be received and manipulated as an argument.

    Parameters

    • Optional callback: ((subgraph) => void)

      Callbacks for manipulating created or retrieved subgraph.

    Returns SubgraphModel

Generated using TypeDoc