Constructors
constructor
- new Graph(params?): Graph
Parameters
Optional
params: {
edges: Edge[];
nodes: Record<string, Node>;
}edges: Edge[]
nodes: Record<string, Node>
Properties
nodes
nodes: Record<string, Node> = {} Methods
addEdge
- addEdge(source, target, data?, conditional?): Edge
Parameters
- source: Node
- target: Node
Optional
data: stringOptional
conditional: boolean
addNode
- addNode(data, id?, metadata?): Node
drawMermaid
- drawMermaid(params?): string
Parameters
Optional
params: {
curveStyle?: string;
nodeColors?: Record<string, string>;
withStyles?: boolean;
wrapLabelNWords?: number;
}Optional
curveStyle?: string
Optional
nodeColors?: Record<string, string>
Optional
withStyles?: boolean
Optional
wrapLabelNWords?: number
Returns string
drawMermaidPng
- drawMermaidPng(params?): Promise<Blob>
Parameters
Optional
params: {
backgroundColor?: string;
curveStyle?: string;
nodeColors?: Record<string, string>;
withStyles?: boolean;
wrapLabelNWords?: number;
}Optional
backgroundColor?: string
Optional
curveStyle?: string
Optional
nodeColors?: Record<string, string>
Optional
withStyles?: boolean
Optional
wrapLabelNWords?: number
Returns Promise<Blob>
firstNode
- firstNode(): undefined | Node
Returns undefined | Node
lastNode
- lastNode(): undefined | Node
Returns undefined | Node
removeNode
- removeNode(node): void
Returns void
toJSON
- toJSON(): Record<string, any>
Returns Record<string, any>
trimFirstNode
- trimFirstNode(): void
Returns void
trimLastNode
- trimLastNode(): void
Returns void
Add all nodes and edges from another graph. Note this doesn't check for duplicates, nor does it connect the graphs.