The type of the vertices in the graph.
Creates a new graph structure with the given vertex.
The vertex to add to the graph.
Protected
mapReturns the number of vertices in the graph.
The number of vertices in the graph.
Returns an array of vertices in the graph.
An array of vertices.
Adds an edge between two vertices with an optional weight.
The first vertex.
The second vertex.
The weight of the edge (default is 0).
The updated weighted graph.
An error if the first vertex is not found or if the edge already exists.
Returns the weight of the edge between the first vertex and the second vertex, and optionally additional vertices if provided.
The first vertex.
The second vertex.
Rest
...vn: K[]Additional vertices (optional).
The weight of the edge between the vertices.
Error if the first or second vertex is not found.
Removes an edge between two vertices in the graph.
The first vertex.
The second vertex.
The graph structure instance.
Removes a vertex from the graph.
The vertex to remove.
The graph structure instance.
A weighted graph data structure.