@antv/graphlib / Exports / GraphOptions
Options to create a graph.
Name | Type |
---|---|
N |
extends PlainObject |
E |
extends PlainObject |
• Optional
edges: Edge
<E
>[]
An array of edge data representing the initial edges.
Each edge must have a unique ID.
The source and target of each edge must be present in nodes
.
Example
[
{ id: 9, source: 1, target: 2, weight: 10 },
]
• Optional
nodes: Node
<N
>[]
An array of node data representing the initial nodes.
Each node must have a unique ID.
Example
[
{ id: 1, color: 'red' },
{ id: 2, color: 'blue' },
]
• Optional
onChanged: (event
: GraphChangedEvent
<N
, E
>) => void
▸ (event
): void
A listener function which will be called with a GraphChangedEvent whenever a graph change happened.
Name | Type |
---|---|
event |
GraphChangedEvent <N , E > |
void