AbstractOptionalattributes: AttributesObject<K>ReadonlyattributesOptionalcommentComments to include when outputting with toDot.
Optional ReadonlyidAbstract$$typeThe type of the DotObjectType.
Edge objects in the graph.
Node objects in the graph.
Size of the set of keys and values held by the DOT object.
Subgraph objects in the graph.
Apply keys and values that can be specified for DOT objects collectively.
An array of objects or tuples of attribute key/value pairs.
Delete all attributes specified for the DOT object.
Create Edge and add it to the graph.
Optionalattributes: EdgeAttributesObjectCreate a Node in the graph.
Optionalattributes: NodeAttributesObjectCreate a Subgraph and add it to the graph.
Optionalid: stringSubgraph ID
Optionalattributes: SubgraphAttributesObjectSubgraph attribute object
Optionalattributes: SubgraphAttributesObjectDelete the value of an attribute from a DOT object by specifying a key.
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";
// }
Nodes.
Optionalcallback: (edge: EdgeModel) => voidCallbacks for manipulating created or retrieved edge.
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",
// ];
// }
Object of attributes to be adapted to the edge.
Optionalcallback: (edge: EdgeModel) => voidCallbacks for manipulating created or retrieved edge.
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",
// ];
// }
Object of attributes to be adapted to the edges.
Check if the Node exists in the graph.
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.
Get Node in cluster by specifying id.
If there is no Node with the specified id in the graph, return undefined.
Get Subgraph in cluster by specifying id.
If there is no Subgraph 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",
// ];
// }
Object of attributes to be adapted to the graph.
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";
// }
Node ID.
Optionalcallback: (node: NodeModel) => voidCallbacks for manipulating created or retrieved node.
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",
// ];
// }
Node ID.
Object of attributes to be adapted to the node.
Optionalcallback: (node: NodeModel) => voidCallbacks for manipulating created or retrieved node.
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",
// ];
// }
Object of attributes to be adapted to the nodes.
Set a value, by specifying the key of the attributes in the DOT object.
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";
// }
// }
Subgraph ID.
Optionalcallback: (subgraph: SubgraphModel) => voidCallbacks for manipulating created or retrieved subgraph.
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";
// }
// }
Subgraph ID.
Object of attributes to be adapted to the subgraph.
Optionalcallback: (subgraph: SubgraphModel) => voidCallbacks for manipulating created or retrieved subgraph.
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";
// }
// }
Object of attributes to be adapted to the subgraph.
Optionalcallback: (subgraph: SubgraphModel) => voidCallbacks for manipulating created or retrieved subgraph.
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.
Optionalcallback: (subgraph: SubgraphModel) => voidCallbacks for manipulating created or retrieved subgraph.
Base class for Graph objects.