a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / Graph
Represents a graph data structure.
• T
The type of value stored in the graph nodes.
IGraph
<T
>new Graph<
T
>():Graph
<T
>
Graph
<T
>
addEdge(
edge
):void
Adds an edge to the graph.
• edge: IGraphEdge
<T
>
The edge to be added to the graph. Must be an instance of IGraphEdge<T>
.
void
void
Error if the source node of the edge is not found in the graph.
addNode(
node
):void
Adds a node to the graph.
• node: IGraphNode
<T
>
The node to be added to the graph.
void
displayGraph():
void
Displays the graph by invoking the graph printing function.
void
getEdges(
node
):IGraphEdge
<T
>[]
Retrieves a list of edges connected to the specified node.
• node: IGraphNode
<T
>
The node for which to get the edges.
IGraphEdge
<T
>[]
An array of edges connected to the specified node.
getNeighbors(
node
):IGraphNode
<T
>[]
Retrieves the neighboring nodes of a given node in the graph.
• node: IGraphNode
<T
>
The node for which to find neighbors.
IGraphNode
<T
>[]
An array of neighboring nodes.