@antv/graphlib / Exports / GraphView
| Name | Type |
|---|---|
N |
extends PlainObject |
E |
extends PlainObject |
- allEdgesMap
- allNodesMap
- bothEdgesMap
- cacheEnabled
- edgeFilter
- graph
- inEdgesMap
- nodeFilter
- outEdgesMap
- areNeighbors
- bfs
- checkNodeExistence
- clearCache
- dfs
- getAllEdges
- getAllNodes
- getChildren
- getDegree
- getEdge
- getEdgeDetail
- getNeighbors
- getNode
- getParent
- getPredecessors
- getRelatedEdges
- getRoots
- getSuccessors
- handleGraphChanged
- hasEdge
- hasNode
- hasTreeStructure
- refreshCache
- startAutoCache
- stopAutoCache
- updateCache
• new GraphView<N, E>(options)
| Name | Type |
|---|---|
N |
extends PlainObject |
E |
extends PlainObject |
| Name | Type |
|---|---|
options |
GraphViewOptions<N, E> |
• Private allEdgesMap: Map<ID, Edge<E>>
• Private allNodesMap: Map<ID, Node<N>>
• Private bothEdgesMap: Map<ID, Edge<E>[]>
• cacheEnabled: boolean
• Private edgeFilter: (edge: Edge<E>) => boolean
▸ (edge): boolean
| Name | Type |
|---|---|
edge |
Edge<E> |
boolean
• Private graph: Graph<N, E>
• Private inEdgesMap: Map<ID, Edge<E>[]>
• Private nodeFilter: (node: Node<N>) => boolean
▸ (node): boolean
| Name | Type |
|---|---|
node |
Node<N> |
boolean
• Private outEdgesMap: Map<ID, Edge<E>[]>
▸ areNeighbors(firstNodeId, secondNodeId): boolean
| Name | Type |
|---|---|
firstNodeId |
ID |
secondNodeId |
ID |
boolean
▸ bfs(id, fn, direction?): void
| Name | Type | Default value |
|---|---|---|
id |
ID |
undefined |
fn |
(node: Node<N>) => void |
undefined |
direction |
"in" | "out" | "both" |
'out' |
void
▸ Private checkNodeExistence(id): void
| Name | Type |
|---|---|
id |
ID |
void
▸ clearCache(): void
Clear all cache data. Therefore getAllNodes() will return [].
If you want to disable caching, use graphView.cacheEnabled = false instead.
void
▸ dfs(id, fn, direction?): void
| Name | Type | Default value |
|---|---|---|
id |
ID |
undefined |
fn |
(node: Node<N>) => void |
undefined |
direction |
"in" | "out" | "both" |
'out' |
void
▸ getAllEdges(): Edge<E>[]
Edge<E>[]
▸ getAllNodes(): Node<N>[]
Node<N>[]
▸ getChildren(id, treeKey?): Node<N>[]
| Name | Type |
|---|---|
id |
ID |
treeKey? |
string |
Node<N>[]
▸ getDegree(id, direction?): number
| Name | Type |
|---|---|
id |
ID |
direction? |
"in" | "out" | "both" |
number
▸ getEdge(id): Edge<E>
| Name | Type |
|---|---|
id |
ID |
Edge<E>
▸ getEdgeDetail(id): Object
| Name | Type |
|---|---|
id |
ID |
Object
| Name | Type |
|---|---|
edge |
Edge<E> |
source |
Node<N> |
target |
Node<N> |
▸ getNeighbors(id): Node<N>[]
| Name | Type |
|---|---|
id |
ID |
Node<N>[]
▸ getNode(id): Node<N>
| Name | Type |
|---|---|
id |
ID |
Node<N>
▸ getParent(id, treeKey?): null | Node<N>
| Name | Type |
|---|---|
id |
ID |
treeKey? |
string |
null | Node<N>
▸ getPredecessors(id): Node<N>[]
| Name | Type |
|---|---|
id |
ID |
Node<N>[]
▸ getRelatedEdges(id, direction?): Edge<E>[]
| Name | Type |
|---|---|
id |
ID |
direction? |
"in" | "out" | "both" |
Edge<E>[]
▸ getRoots(treeKey?): Node<N>[]
| Name | Type |
|---|---|
treeKey? |
string |
Node<N>[]
▸ getSuccessors(id): Node<N>[]
| Name | Type |
|---|---|
id |
ID |
Node<N>[]
▸ Private handleGraphChanged(event): void
| Name | Type |
|---|---|
event |
GraphChangedEvent<N, E> |
void
▸ hasEdge(id): boolean
| Name | Type |
|---|---|
id |
ID |
boolean
▸ hasNode(id): boolean
| Name | Type |
|---|---|
id |
ID |
boolean
▸ hasTreeStructure(treeKey): boolean
| Name | Type |
|---|---|
treeKey |
undefined | string |
boolean
▸ refreshCache(): void
Fully refresh all cache data to the current graph state.
void
▸ startAutoCache(): void
void
▸ stopAutoCache(): void
void
▸ updateCache(involvedNodeIds): void
Instead of a fully refreshment, this method partially update the cache data by specifying involved(added, removed, updated) nodes. It's more efficient when handling small changes on a large graph.
| Name | Type |
|---|---|
involvedNodeIds |
Set<ID> | ID[] |
void