Home > @hz-9/algorithm > Graph
Graph class
Graph class
图类。(邻接表)
Signature:
export declare class Graph<T> implements Base<IGraphToArrayItem<T>>Implements: Base<IGraphToArrayItem<T>>
Constructors
Constructor | Modifiers | Description |
|---|---|---|
Constructs a new instance of the |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| (a?: T, b?: T) => boolean | Function to determine if two values are equal. 判断两个值是否相等的函数。 | |
| Map of adjacency lists. 邻接表的映射。 | ||
| boolean | Whether the graph is directed. 图是否为有向图。 | |
| boolean | ||
| number | ||
| Array<Vertice<T>> | Array of vertices. 顶点数组。 |
Methods
Method | Modifiers | Description |
|---|---|---|
Add an edge to the graph. 添加边到图中。 | ||
Add a vertex to the graph. 添加顶点到图中。 | ||
Get a vertex object from the graph. 从图中获取顶点对象。 | ||
Check if an edge exists in the graph. 检查边是否存在于图中。 | ||
Check if a vertex exists in the graph. 检查顶点是否存在于图中。 | ||
Remove an edge from the graph. 从图中删除边。 | ||
Remove a vertex from the graph. 从图中删除顶点。 | ||