Appearance
A subgraph (cluster) inside a Graph.
Obtain via Graph.addSubgraph or Subgraph.addSubgraph. All mutation methods return this for chaining. Call Subgraph.delete (or use the using keyword) when finished to free the underlying WASM wrapper — the actual subgraph data is owned by the parent Graph and is freed with it.
Every subgraph is automatically rendered as a cluster (the cluster_ prefix is added to the id when communicating with the underlying cgraph library). The id Graphviz attribute on the subgraph is set to the user-supplied id (without the prefix):
ts
using cluster = graph.addSubgraph("0");
cluster
.setAttr("label", "My Cluster")
.setAttr("style", "filled")
.setAttr("color", "lightblue")
.addEdge("a", "b");Constructors
Constructor
new Subgraph(
sg):Subgraph
Internal
Parameters
sg
CSubgraph
Returns
Subgraph
Methods
addNode()
Call Signature
addNode(
id,attrs?,htmlAttrs?):this
Create (or find) a node and add it to this subgraph. The node's id Graphviz attribute is automatically set to match id.
Parameters
id
string
attrs?
Partial<{ area?: number; class?: string; color?: string; colorscheme?: string; comment?: string; distortion?: number; fillcolor?: string; fixedsize?: NonNullable<string | boolean | undefined>; fontcolor?: string; fontname?: string; fontsize?: number; gradientangle?: number; group?: string; height?: number; href?: string; id?: string; image?: string; imagepos?: string; imagescale?: NonNullable<string | boolean | undefined>; label?: string; labelloc?: NonNullable<LabelLoc | undefined>; layer?: string; margin?: NonNullable<string | number | undefined>; nojustify?: NonNullable<boolean | undefined>; ordering?: string; orientation?: number; penwidth?: number; peripheries?: number; pin?: NonNullable<boolean | undefined>; pos?: string; rects?: string; regular?: NonNullable<boolean | undefined>; root?: NonNullable<string | boolean | undefined>; samplepoints?: number; shape?: NonNullable<Shape | undefined>; shapefile?: string; showboxes?: number; sides?: number; skew?: number; sortv?: number; style?: string; target?: string; tooltip?: string; URL?: string; vertices?: string; width?: number; xlabel?: string; xlp?: string; z?: number; }>
htmlAttrs?
Partial<{ area?: number; class?: string; color?: string; colorscheme?: string; comment?: string; distortion?: number; fillcolor?: string; fixedsize?: NonNullable<string | boolean | undefined>; fontcolor?: string; fontname?: string; fontsize?: number; gradientangle?: number; group?: string; height?: number; href?: string; id?: string; image?: string; imagepos?: string; imagescale?: NonNullable<string | boolean | undefined>; label?: string; labelloc?: NonNullable<LabelLoc | undefined>; layer?: string; margin?: NonNullable<string | number | undefined>; nojustify?: NonNullable<boolean | undefined>; ordering?: string; orientation?: number; penwidth?: number; peripheries?: number; pin?: NonNullable<boolean | undefined>; pos?: string; rects?: string; regular?: NonNullable<boolean | undefined>; root?: NonNullable<string | boolean | undefined>; samplepoints?: number; shape?: NonNullable<Shape | undefined>; shapefile?: string; showboxes?: number; sides?: number; skew?: number; sortv?: number; style?: string; target?: string; tooltip?: string; URL?: string; vertices?: string; width?: number; xlabel?: string; xlp?: string; z?: number; }>
Returns
this
Call Signature
addNode(
init):this
Create (or find) a node and add it to this subgraph. The node's id Graphviz attribute is automatically set to match id.
Parameters
init
Returns
this
addVertex()
Call Signature
addVertex(
id,attrs?,htmlAttrs?):this
Alias for addNode.
Parameters
id
string
attrs?
Partial<{ area?: number; class?: string; color?: string; colorscheme?: string; comment?: string; distortion?: number; fillcolor?: string; fixedsize?: NonNullable<string | boolean | undefined>; fontcolor?: string; fontname?: string; fontsize?: number; gradientangle?: number; group?: string; height?: number; href?: string; id?: string; image?: string; imagepos?: string; imagescale?: NonNullable<string | boolean | undefined>; label?: string; labelloc?: NonNullable<LabelLoc | undefined>; layer?: string; margin?: NonNullable<string | number | undefined>; nojustify?: NonNullable<boolean | undefined>; ordering?: string; orientation?: number; penwidth?: number; peripheries?: number; pin?: NonNullable<boolean | undefined>; pos?: string; rects?: string; regular?: NonNullable<boolean | undefined>; root?: NonNullable<string | boolean | undefined>; samplepoints?: number; shape?: NonNullable<Shape | undefined>; shapefile?: string; showboxes?: number; sides?: number; skew?: number; sortv?: number; style?: string; target?: string; tooltip?: string; URL?: string; vertices?: string; width?: number; xlabel?: string; xlp?: string; z?: number; }>
htmlAttrs?
Partial<{ area?: number; class?: string; color?: string; colorscheme?: string; comment?: string; distortion?: number; fillcolor?: string; fixedsize?: NonNullable<string | boolean | undefined>; fontcolor?: string; fontname?: string; fontsize?: number; gradientangle?: number; group?: string; height?: number; href?: string; id?: string; image?: string; imagepos?: string; imagescale?: NonNullable<string | boolean | undefined>; label?: string; labelloc?: NonNullable<LabelLoc | undefined>; layer?: string; margin?: NonNullable<string | number | undefined>; nojustify?: NonNullable<boolean | undefined>; ordering?: string; orientation?: number; penwidth?: number; peripheries?: number; pin?: NonNullable<boolean | undefined>; pos?: string; rects?: string; regular?: NonNullable<boolean | undefined>; root?: NonNullable<string | boolean | undefined>; samplepoints?: number; shape?: NonNullable<Shape | undefined>; shapefile?: string; showboxes?: number; sides?: number; skew?: number; sortv?: number; style?: string; target?: string; tooltip?: string; URL?: string; vertices?: string; width?: number; xlabel?: string; xlp?: string; z?: number; }>
Returns
this
Call Signature
addVertex(
init):this
Alias for addNode.
Parameters
init
Returns
this
addEdge()
Call Signature
addEdge(
tail,head,attrs?,htmlAttrs?):this
Create an edge inside this subgraph. Both endpoints are created
- automatically if they do not already exist.
Parameters
tail
string
head
string
attrs?
Partial<{ arrowhead?: NonNullable<ArrowType | undefined>; arrowsize?: number; arrowtail?: NonNullable<ArrowType | undefined>; class?: string; color?: string; colorscheme?: string; comment?: string; constraint?: NonNullable<boolean | undefined>; decorate?: NonNullable<boolean | undefined>; dir?: NonNullable<DirType | undefined>; edgehref?: string; edgetarget?: string; edgetooltip?: string; edgeURL?: string; fillcolor?: string; fontcolor?: string; fontname?: string; fontsize?: number; head_lp?: string; headclip?: NonNullable<boolean | undefined>; headhref?: string; headlabel?: string; headport?: string; headtarget?: string; headtooltip?: string; headURL?: string; href?: string; id?: string; label?: string; labelangle?: number; labeldistance?: number; labelfloat?: NonNullable<boolean | undefined>; labelfontcolor?: string; labelfontname?: string; labelfontsize?: number; labelhref?: string; labeltarget?: string; labeltooltip?: string; labelURL?: string; layer?: string; len?: number; lhead?: string; lp?: string; ltail?: string; minlen?: number; nojustify?: NonNullable<boolean | undefined>; penwidth?: number; pos?: string; radius?: number; samehead?: string; sametail?: string; showboxes?: number; style?: string; tail_lp?: string; tailclip?: NonNullable<boolean | undefined>; tailhref?: string; taillabel?: string; tailport?: string; tailtarget?: string; tailtooltip?: string; tailURL?: string; target?: string; tooltip?: string; URL?: string; weight?: number; xlabel?: string; xlp?: string; }>
htmlAttrs?
Partial<{ arrowhead?: NonNullable<ArrowType | undefined>; arrowsize?: number; arrowtail?: NonNullable<ArrowType | undefined>; class?: string; color?: string; colorscheme?: string; comment?: string; constraint?: NonNullable<boolean | undefined>; decorate?: NonNullable<boolean | undefined>; dir?: NonNullable<DirType | undefined>; edgehref?: string; edgetarget?: string; edgetooltip?: string; edgeURL?: string; fillcolor?: string; fontcolor?: string; fontname?: string; fontsize?: number; head_lp?: string; headclip?: NonNullable<boolean | undefined>; headhref?: string; headlabel?: string; headport?: string; headtarget?: string; headtooltip?: string; headURL?: string; href?: string; id?: string; label?: string; labelangle?: number; labeldistance?: number; labelfloat?: NonNullable<boolean | undefined>; labelfontcolor?: string; labelfontname?: string; labelfontsize?: number; labelhref?: string; labeltarget?: string; labeltooltip?: string; labelURL?: string; layer?: string; len?: number; lhead?: string; lp?: string; ltail?: string; minlen?: number; nojustify?: NonNullable<boolean | undefined>; penwidth?: number; pos?: string; radius?: number; samehead?: string; sametail?: string; showboxes?: number; style?: string; tail_lp?: string; tailclip?: NonNullable<boolean | undefined>; tailhref?: string; taillabel?: string; tailport?: string; tailtarget?: string; tailtooltip?: string; tailURL?: string; target?: string; tooltip?: string; URL?: string; weight?: number; xlabel?: string; xlp?: string; }>
Returns
this
Call Signature
addEdge(
tail,head,key,attrs?,htmlAttrs?):this
Create an edge inside this subgraph. Both endpoints are created
- automatically if they do not already exist.
Parameters
tail
string
head
string
key
string
attrs?
Partial<{ arrowhead?: NonNullable<ArrowType | undefined>; arrowsize?: number; arrowtail?: NonNullable<ArrowType | undefined>; class?: string; color?: string; colorscheme?: string; comment?: string; constraint?: NonNullable<boolean | undefined>; decorate?: NonNullable<boolean | undefined>; dir?: NonNullable<DirType | undefined>; edgehref?: string; edgetarget?: string; edgetooltip?: string; edgeURL?: string; fillcolor?: string; fontcolor?: string; fontname?: string; fontsize?: number; head_lp?: string; headclip?: NonNullable<boolean | undefined>; headhref?: string; headlabel?: string; headport?: string; headtarget?: string; headtooltip?: string; headURL?: string; href?: string; id?: string; label?: string; labelangle?: number; labeldistance?: number; labelfloat?: NonNullable<boolean | undefined>; labelfontcolor?: string; labelfontname?: string; labelfontsize?: number; labelhref?: string; labeltarget?: string; labeltooltip?: string; labelURL?: string; layer?: string; len?: number; lhead?: string; lp?: string; ltail?: string; minlen?: number; nojustify?: NonNullable<boolean | undefined>; penwidth?: number; pos?: string; radius?: number; samehead?: string; sametail?: string; showboxes?: number; style?: string; tail_lp?: string; tailclip?: NonNullable<boolean | undefined>; tailhref?: string; taillabel?: string; tailport?: string; tailtarget?: string; tailtooltip?: string; tailURL?: string; target?: string; tooltip?: string; URL?: string; weight?: number; xlabel?: string; xlp?: string; }>
htmlAttrs?
Partial<{ arrowhead?: NonNullable<ArrowType | undefined>; arrowsize?: number; arrowtail?: NonNullable<ArrowType | undefined>; class?: string; color?: string; colorscheme?: string; comment?: string; constraint?: NonNullable<boolean | undefined>; decorate?: NonNullable<boolean | undefined>; dir?: NonNullable<DirType | undefined>; edgehref?: string; edgetarget?: string; edgetooltip?: string; edgeURL?: string; fillcolor?: string; fontcolor?: string; fontname?: string; fontsize?: number; head_lp?: string; headclip?: NonNullable<boolean | undefined>; headhref?: string; headlabel?: string; headport?: string; headtarget?: string; headtooltip?: string; headURL?: string; href?: string; id?: string; label?: string; labelangle?: number; labeldistance?: number; labelfloat?: NonNullable<boolean | undefined>; labelfontcolor?: string; labelfontname?: string; labelfontsize?: number; labelhref?: string; labeltarget?: string; labeltooltip?: string; labelURL?: string; layer?: string; len?: number; lhead?: string; lp?: string; ltail?: string; minlen?: number; nojustify?: NonNullable<boolean | undefined>; penwidth?: number; pos?: string; radius?: number; samehead?: string; sametail?: string; showboxes?: number; style?: string; tail_lp?: string; tailclip?: NonNullable<boolean | undefined>; tailhref?: string; taillabel?: string; tailport?: string; tailtarget?: string; tailtooltip?: string; tailURL?: string; target?: string; tooltip?: string; URL?: string; weight?: number; xlabel?: string; xlp?: string; }>
Returns
this
Call Signature
addEdge(
init):this
Create an edge inside this subgraph. Both endpoints are created
- automatically if they do not already exist.
Parameters
init
Returns
this
addSubgraph()
Call Signature
addSubgraph(
id,attrs?,htmlAttrs?):Subgraph
Create (or return an existing) subgraph under this subgraph. The cluster_ prefix is added to id internally so that layout engines render it as a bounded cluster. The subgraph's id Graphviz attribute is set to the user-supplied id (without the prefix).
Parameters
id
string
attrs?
Partial<{ area?: number; bb?: string; bgcolor?: string; class?: string; cluster?: NonNullable<boolean | undefined>; color?: string; colorscheme?: string; fillcolor?: string; fontcolor?: string; fontname?: string; fontsize?: number; gradientangle?: number; href?: string; id?: string; K?: number; label?: string; labeljust?: string; labelloc?: NonNullable<LabelLoc | undefined>; layer?: string; lheight?: number; lp?: string; lwidth?: number; margin?: NonNullable<string | number | undefined>; nojustify?: NonNullable<boolean | undefined>; pencolor?: string; penwidth?: number; peripheries?: number; rank?: NonNullable<RankType | undefined>; sortv?: number; style?: string; target?: string; tooltip?: string; URL?: string; }>
htmlAttrs?
Partial<{ area?: number; bb?: string; bgcolor?: string; class?: string; cluster?: NonNullable<boolean | undefined>; color?: string; colorscheme?: string; fillcolor?: string; fontcolor?: string; fontname?: string; fontsize?: number; gradientangle?: number; href?: string; id?: string; K?: number; label?: string; labeljust?: string; labelloc?: NonNullable<LabelLoc | undefined>; layer?: string; lheight?: number; lp?: string; lwidth?: number; margin?: NonNullable<string | number | undefined>; nojustify?: NonNullable<boolean | undefined>; pencolor?: string; penwidth?: number; peripheries?: number; rank?: NonNullable<RankType | undefined>; sortv?: number; style?: string; target?: string; tooltip?: string; URL?: string; }>
Returns
Subgraph
Call Signature
addSubgraph(
init):Subgraph
Create (or return an existing) subgraph under this subgraph. The cluster_ prefix is added to id internally so that layout engines render it as a bounded cluster. The subgraph's id Graphviz attribute is set to the user-supplied id (without the prefix).
Parameters
init
Returns
Subgraph
applyInit()
applyInit(
init):this
Parameters
init
Returns
this
removeNode()
removeNode(
id):this
Remove a node from this subgraph only. The node (and any edges connecting it) remains in the root graph and all other subgraphs. No-op if the node is not in this subgraph.
Parameters
id
string
Returns
this
removeVertex()
removeVertex(
id):this
Alias for removeNode.
Parameters
id
string
Returns
this
removeEdge()
removeEdge(
tail,head,key?):this
Remove a single edge from this subgraph only. The edge remains in the root graph and all other subgraphs. No-op if the edge is not present.
Parameters
tail
string
head
string
key?
string = ""
Returns
this
setAttr()
Call Signature
setAttr<
K>(attr,value?,defaultValue?):this
Set an attribute on the subgraph itself (e.g. "label", "style", "color", "bgcolor"). See the official Graphviz attribute reference for supported attributes and values.
When attr is a known cluster attribute the value type is inferred automatically. A generic string | number | boolean fallback is provided for custom or less-common attributes. Omit value to reset the attribute to Graphviz's default empty value. defaultValue is passed to Graphviz as the default for this attribute if it has not already been declared.
Type Parameters
K
K extends ClusterDotAttr
Parameters
attr
K
value?
NonNullable<ClusterAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setAttr(
attr,value?,defaultValue?):this
Set an attribute on the subgraph itself (e.g. "label", "style", "color", "bgcolor"). See the official Graphviz attribute reference for supported attributes and values.
When attr is a known cluster attribute the value type is inferred automatically. A generic string | number | boolean fallback is provided for custom or less-common attributes. Omit value to reset the attribute to Graphviz's default empty value. defaultValue is passed to Graphviz as the default for this attribute if it has not already been declared.
Parameters
attr
string
value?
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setHtmlAttr()
Call Signature
setHtmlAttr<
K>(attr,value,defaultValue?):this
Type Parameters
K
K extends ClusterDotAttr
Parameters
attr
K
value
NonNullable<ClusterAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setHtmlAttr(
attr,value,defaultValue?):this
Parameters
attr
string
value
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setDefaultAttr()
Call Signature
setDefaultAttr<
K>(attr,value):this
Type Parameters
K
K extends ClusterDotAttr
Parameters
attr
K
value
NonNullable<ClusterAttrs[K]>
Returns
this
Call Signature
setDefaultAttr(
attr,value):this
Parameters
attr
string
value
string | number | boolean
Returns
this
setDefaultHtmlAttr()
Call Signature
setDefaultHtmlAttr<
K>(attr,value):this
Type Parameters
K
K extends ClusterDotAttr
Parameters
attr
K
value
NonNullable<ClusterAttrs[K]>
Returns
this
Call Signature
setDefaultHtmlAttr(
attr,value):this
Parameters
attr
string
value
string | number | boolean
Returns
this
removeAttr()
removeAttr(
attr):this
Clear a subgraph-level attribute by resetting it to its default (empty) value. Equivalent to setAttr(attr, "").
Parameters
attr
string
Returns
this
setNodeAttr()
Call Signature
setNodeAttr<
K>(node,attr,value?,defaultValue?):this
Set an attribute on a node inside this subgraph.
When attr is a known node attribute the value type is inferred automatically. A generic string | number | boolean fallback is provided for custom attributes. Omit value to reset the attribute to Graphviz's default empty value. defaultValue is passed to Graphviz as the default for this attribute if it has not already been declared.
Type Parameters
K
K extends NodeDotAttr
Parameters
node
string
attr
K
value?
NonNullable<NodeAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setNodeAttr(
node,attr,value?,defaultValue?):this
Set an attribute on a node inside this subgraph.
When attr is a known node attribute the value type is inferred automatically. A generic string | number | boolean fallback is provided for custom attributes. Omit value to reset the attribute to Graphviz's default empty value. defaultValue is passed to Graphviz as the default for this attribute if it has not already been declared.
Parameters
node
string
attr
string
value?
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setVertexAttr()
Call Signature
setVertexAttr<
K>(node,attr,value?,defaultValue?):this
Alias for setNodeAttr.
Type Parameters
K
K extends NodeDotAttr
Parameters
node
string
attr
K
value?
NonNullable<NodeAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setVertexAttr(
node,attr,value?,defaultValue?):this
Alias for setNodeAttr.
Parameters
node
string
attr
string
value?
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setNodeHtmlAttr()
Call Signature
setNodeHtmlAttr<
K>(node,attr,value,defaultValue?):this
Type Parameters
K
K extends NodeDotAttr
Parameters
node
string
attr
K
value
NonNullable<NodeAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setNodeHtmlAttr(
node,attr,value,defaultValue?):this
Parameters
node
string
attr
string
value
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setVertexHtmlAttr()
Call Signature
setVertexHtmlAttr<
K>(node,attr,value,defaultValue?):this
Alias for setNodeHtmlAttr.
Type Parameters
K
K extends NodeDotAttr
Parameters
node
string
attr
K
value
NonNullable<NodeAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setVertexHtmlAttr(
node,attr,value,defaultValue?):this
Alias for setNodeHtmlAttr.
Parameters
node
string
attr
string
value
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setDefaultNodeAttr()
Call Signature
setDefaultNodeAttr<
K>(attr,value):this
Type Parameters
K
K extends NodeDotAttr
Parameters
attr
K
value
NonNullable<NodeAttrs[K]>
Returns
this
Call Signature
setDefaultNodeAttr(
attr,value):this
Parameters
attr
string
value
string | number | boolean
Returns
this
setDefaultVertexAttr()
Call Signature
setDefaultVertexAttr<
K>(attr,value):this
Alias for setDefaultNodeAttr.
Type Parameters
K
K extends NodeDotAttr
Parameters
attr
K
value
NonNullable<NodeAttrs[K]>
Returns
this
Call Signature
setDefaultVertexAttr(
attr,value):this
Alias for setDefaultNodeAttr.
Parameters
attr
string
value
string | number | boolean
Returns
this
setDefaultNodeHtmlAttr()
Call Signature
setDefaultNodeHtmlAttr<
K>(attr,value):this
Type Parameters
K
K extends NodeDotAttr
Parameters
attr
K
value
NonNullable<NodeAttrs[K]>
Returns
this
Call Signature
setDefaultNodeHtmlAttr(
attr,value):this
Parameters
attr
string
value
string | number | boolean
Returns
this
setDefaultVertexHtmlAttr()
Call Signature
setDefaultVertexHtmlAttr<
K>(attr,value):this
Alias for setDefaultNodeHtmlAttr.
Type Parameters
K
K extends NodeDotAttr
Parameters
attr
K
value
NonNullable<NodeAttrs[K]>
Returns
this
Call Signature
setDefaultVertexHtmlAttr(
attr,value):this
Alias for setDefaultNodeHtmlAttr.
Parameters
attr
string
value
string | number | boolean
Returns
this
removeNodeAttr()
removeNodeAttr(
node,attr):this
Clear a node attribute inside this subgraph by resetting it to its default (empty) value. Equivalent to setNodeAttr(node, attr, "").
Parameters
node
string
attr
string
Returns
this
removeVertexAttr()
removeVertexAttr(
node,attr):this
Alias for removeNodeAttr.
Parameters
node
string
attr
string
Returns
this
setEdgeAttr()
Call Signature
setEdgeAttr<
K>(tail,head,key,attr,value?,defaultValue?):this
Set an attribute on an edge inside this subgraph (identified by tail, head, and key).
When attr is a known edge attribute the value type is inferred automatically. A generic string | number | boolean fallback is provided for custom attributes. Omit value to reset the attribute to Graphviz's default empty value. defaultValue is passed to Graphviz as the default for this attribute if it has not already been declared.
Type Parameters
K
K extends EdgeDotAttr
Parameters
tail
string
head
string
key
string
attr
K
value?
NonNullable<EdgeAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setEdgeAttr(
tail,head,key,attr,value?,defaultValue?):this
Set an attribute on an edge inside this subgraph (identified by tail, head, and key).
When attr is a known edge attribute the value type is inferred automatically. A generic string | number | boolean fallback is provided for custom attributes. Omit value to reset the attribute to Graphviz's default empty value. defaultValue is passed to Graphviz as the default for this attribute if it has not already been declared.
Parameters
tail
string
head
string
key
string
attr
string
value?
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setEdgeHtmlAttr()
Call Signature
setEdgeHtmlAttr<
K>(tail,head,key,attr,value,defaultValue?):this
Type Parameters
K
K extends EdgeDotAttr
Parameters
tail
string
head
string
key
string
attr
K
value
NonNullable<EdgeAttrs[K]>
defaultValue?
string | number | boolean
Returns
this
Call Signature
setEdgeHtmlAttr(
tail,head,key,attr,value,defaultValue?):this
Parameters
tail
string
head
string
key
string
attr
string
value
string | number | boolean
defaultValue?
string | number | boolean
Returns
this
setDefaultEdgeAttr()
Call Signature
setDefaultEdgeAttr<
K>(attr,value):this
Type Parameters
K
K extends EdgeDotAttr
Parameters
attr
K
value
NonNullable<EdgeAttrs[K]>
Returns
this
Call Signature
setDefaultEdgeAttr(
attr,value):this
Parameters
attr
string
value
string | number | boolean
Returns
this
setDefaultEdgeHtmlAttr()
Call Signature
setDefaultEdgeHtmlAttr<
K>(attr,value):this
Type Parameters
K
K extends EdgeDotAttr
Parameters
attr
K
value
NonNullable<EdgeAttrs[K]>
Returns
this
Call Signature
setDefaultEdgeHtmlAttr(
attr,value):this
Parameters
attr
string
value
string | number | boolean
Returns
this
removeEdgeAttr()
removeEdgeAttr(
tail,head,key,attr):this
Clear an edge attribute inside this subgraph by resetting it to its default (empty) value. Equivalent to setEdgeAttr(tail, head, key, attr, "").
Parameters
tail
string
head
string
key
string
attr
string
Returns
this
hasNode()
hasNode(
id):boolean
Returns true if a node with the given id exists in this subgraph.
Parameters
id
string
Returns
boolean
hasVertex()
hasVertex(
id):boolean
Alias for hasNode.
Parameters
id
string
Returns
boolean
hasEdge()
hasEdge(
tail,head,key?):boolean
Returns true if an edge from tail to head exists in this subgraph. Pass key to check for a specific parallel edge; omit (or pass "") to check for any edge between the two nodes.
Parameters
tail
string
head
string
key?
string = ""
Returns
boolean
nodeCount()
nodeCount():
number
Returns the number of nodes in this subgraph.
Returns
number
vertexCount()
vertexCount():
number
Alias for nodeCount.
Returns
number
edgeCount()
edgeCount():
number
Returns the number of edges in this subgraph.
Returns
number
nodeDegree()
nodeDegree(
node,inDegree?,outDegree?):number
Returns the degree of the node with the given id in this subgraph.
Parameters
node
string
inDegree?
number = 1
outDegree?
number = 1
Returns
number
vertexDegree()
vertexDegree(
node,inDegree?,outDegree?):number
Alias for nodeDegree.
Parameters
node
string
inDegree?
number = 1
outDegree?
number = 1
Returns
number
getAttr()
getAttr(
attr):string
Returns the current value of a subgraph-level attribute, or "" if the attribute has not been set.
Parameters
attr
string
Returns
string
getNodeAttr()
getNodeAttr(
node,attr):string
Returns the current value of the named attribute on a node in this subgraph, or "" if the node or attribute does not exist.
Parameters
node
string
attr
string
Returns
string
getVertexAttr()
getVertexAttr(
node,attr):string
Alias for getNodeAttr.
Parameters
node
string
attr
string
Returns
string
getEdgeAttr()
getEdgeAttr(
tail,head,key,attr):string
Returns the current value of the named attribute on an edge in this subgraph, or "" if the edge or attribute does not exist. Pass key = "" for the first (or only) edge between tail and head.
Parameters
tail
string
head
string
key
string
attr
string
Returns
string
nodeNames()
nodeNames():
string[]
Returns the ids of all nodes in this subgraph (in internal iteration order).
Returns
string[]
vertexNames()
vertexNames():
string[]
Alias for nodeNames.
Returns
string[]
edges()
edges():
EdgeInfo[]
Returns all edges in this subgraph. Each unique edge is listed exactly once.
Returns
EdgeInfo[]
outEdges()
outEdges(
node):EdgeInfo[]
Returns the out-edges of the node with the given id in this subgraph. Returns [] if the node does not exist.
Parameters
node
string
Returns
EdgeInfo[]
inEdges()
inEdges(
node):EdgeInfo[]
Returns the in-edges of the node with the given id in this subgraph. Returns [] if the node does not exist.
Parameters
node
string
Returns
EdgeInfo[]
nodeEdges()
nodeEdges(
node):EdgeInfo[]
Returns all edges incident to the node with the given id in this subgraph (both in and out). Returns [] if the node does not exist.
Parameters
node
string
Returns
EdgeInfo[]
delete()
delete():
void
Release the WASM wrapper. The subgraph data itself is freed when the parent Graph is deleted.
Returns
void
[dispose]()
[dispose]():
void
Internal
– supports the using keyword (explicit resource management).
Returns
void