Skip to main content
Module

x/graphviz/mod.ts>Cluster

🦕 Simple Graphviz library for Deno.
Latest
class Cluster
implements ICluster<T>
extends AttributesBase<T>
Re-export
Abstract
import { Cluster } from "https://deno.land/x/graphviz@v0.2.1/mod.ts";

Base class for clusters.

Type Parameters

T extends string

Properties

private
readonly
objects: Readonly<{ nodes: Map<string, INode>; edges: Set<IEdge>; subgraphs: Set<ISubgraph>; }>
abstract
readonly
attributes: Readonly<IClusterCommonAttributes>

Common attributes of objects in the cluster.

optional
comment: string

Comments to include when outputting with toDot.

readonly
edges: ReadonlyArray<IEdge>

Edges in the cluster.

readonly
optional
id: string

Cluster ID

readonly
nodes: ReadonlyArray<INode>

Nodes in the cluster.

readonly
subgraphs: ReadonlyArray<ISubgraph>

Subgraphs in the cluster.

Methods

addEdge(edge: IEdge): void

Add Edge to the cluster.

addNode(node: INode): void

Add a Node to the cluster.

addSubgraph(subgraph: ISubgraph): void

Add a Subgraph to the cluster.

Create Edge and add it to the cluster.

createNode(id: string, attributes?: NodeAttributes): INode

Create a Node in the cluster.

Create a Subgraph and add it to the cluster.

edge(targets: EdgeTargetLike[], callback?: (edge: IEdge) => void): IEdge

Declarative API for Edge.

edge(
targets: EdgeTargetLike[],
attributes?: EdgeAttributes,
callback?: (edge: IEdge) => void,
): IEdge
existEdge(edge: IEdge): boolean

Check if the Edge exists in the cluster.

existNode(nodeId: string): boolean

Check if the Node exists in the cluster.

existSubgraph(subgraph: ISubgraph): boolean

Check if the Subgraph exists in the cluster.

getNode(id: string): INode | undefined

Get Node in cluster by specifying id.

getSubgraph(id: string): ISubgraph | undefined

Get Subgraph in cluster by specifying id.

If there is no Subgraph with the specified id in the cluster, return undefined.

node(id: string, callback?: (node: INode) => void): INode

Declarative API for Node.

node(
id: string,
attributes?: NodeAttributes,
callback?: (node: INode) => void,
): INode
removeEdge(edge: IEdge): void

Remove Edge from the cluster.

removeNode(node: INode | string): void

Remove Node from the cluster.

removeSubgraph(subgraph: ISubgraph): void

Remove Subgraph from the cluster.

subgraph(id?: string, callback?: (subgraph: ISubgraph) => void): ISubgraph

Declarative API for Subgraph.

subgraph(
id?: string,
callback?: (subgraph: ISubgraph) => void,
): ISubgraph
subgraph(attributes?: ClusterSubgraphAttributes, callback?: (subgraph: ISubgraph) => void): ISubgraph
subgraph(callback?: (subgraph: ISubgraph) => void): ISubgraph