fivem-ts

a library to speed up the development of Fivem scripts and frameworks


Project maintained by Purpose-Dev Hosted on GitHub Pages — Theme by mattgraham

fivem-ts - Documentation v0.7.5Docs


fivem-ts - Documentation v0.7.5 / Shared / Graph

Class: Graph<T>

Represents a graph data structure.

Type Parameters

T

The type of value stored in the graph nodes.

Implements

Constructors

new Graph()

new Graph<T>(): Graph<T>

Returns

Graph<T>

Methods

addEdge()

addEdge(edge): void

Adds an edge to the graph.

Parameters

edge: IGraphEdge<T>

The edge to be added to the graph. Must be an instance of IGraphEdge<T>.

Returns

void

void

Throws

Error if the source node of the edge is not found in the graph.

Implementation of

IGraph.addEdge

Defined in

shared/ds/graph/Graph.ts:32


addNode()

addNode(node): void

Adds a node to the graph.

Parameters

node: IGraphNode<T>

The node to be added to the graph.

Returns

void

Implementation of

IGraph.addNode

Defined in

shared/ds/graph/Graph.ts:18


displayGraph()

displayGraph(): void

Displays the graph by invoking the graph printing function.

Returns

void

Defined in

shared/ds/graph/Graph.ts:65


getEdges()

getEdges(node): IGraphEdge<T>[]

Retrieves a list of edges connected to the specified node.

Parameters

node: IGraphNode<T>

The node for which to get the edges.

Returns

IGraphEdge<T>[]

An array of edges connected to the specified node.

Implementation of

IGraph.getEdges

Defined in

shared/ds/graph/Graph.ts:56


getNeighbors()

getNeighbors(node): IGraphNode<T>[]

Retrieves the neighboring nodes of a given node in the graph.

Parameters

node: IGraphNode<T>

The node for which to find neighbors.

Returns

IGraphNode<T>[]

An array of neighboring nodes.

Implementation of

IGraph.getNeighbors

Defined in

shared/ds/graph/Graph.ts:46