Extends
Members
adj
Returns an immutable copy of the adjacency list.
- Inherited From:
- Source:
Methods
addEdge()
- Overrides:
- Source:
addPath(path)
Adds all the edges in the path to the graph.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Array.<V> | the path to add. |
- Inherited From:
- Source:
addVertex()
- Inherited From:
- Source:
edges()
- Overrides:
- Source:
fromEdgeList(edgeList)
Adds all the edges in the edge list to the graph
Parameters:
| Name | Type | Description |
|---|---|---|
edgeList |
Array.<Array.<V>> | the list of edges to add. |
- Inherited From:
- Source:
(protected) getSmallestEdge(v, w) → {Array.<V>}
Orders the edge (u', v') such that u' < v'.
Parameters:
| Name | Type | Description |
|---|---|---|
v |
V | the first vertex. |
w |
V | the second vertex. |
- Source:
Returns:
the ordered edge.
- Type
- Array.<V>
hasEdge()
- Inherited From:
- Source:
hasVertex(v) → {boolean}
Determines if the graph contains the vertex v.
Parameters:
| Name | Type | Description |
|---|---|---|
v |
V | the vertex to check.\ |
- Inherited From:
- Source:
Returns:
true if the graph contains the vertex v, false otherwise.
- Type
- boolean
inDegree()
- Inherited From:
- Source:
isDirected()
- Overrides:
- Source:
neighbors()
- Inherited From:
- Source:
numberOfNodes() → {number}
Returns the number of vertices in the graph.
- Inherited From:
- Source:
Returns:
the number of vertices in the graph.
- Type
- number
outDegree()
- Inherited From:
- Source:
removeEdge()
- Overrides:
- Source:
removeVertex(v)
Removes a vertex from the graph.
Parameters:
| Name | Type | Description |
|---|---|---|
v |
V | the vertex to remove. |
- Inherited From:
- Source:
toString() → {string}
Returns a string representation of the graph.
Just calls the toString() method of the underlying adjacency list.
- Inherited From:
- Source:
Returns:
a string representation of the graph.
- Type
- string
validateEdge(v, w)
Validates that the edge (v, w) exists in the graph.
Parameters:
| Name | Type | Description |
|---|---|---|
v |
V | |
w |
V |
- Inherited From:
- Source:
Throws:
EdgeDoesNotExistError if the edge does not exist.
validateVertex(v)
Validates that the vertex v exists in the graph.
Parameters:
| Name | Type | Description |
|---|---|---|
v |
V |
- Inherited From:
- Source:
Throws:
VertexDoesNotExistError if the vertex does not exist.
vertices() → {Array.<V>}
Returns an array of all the vertices in the graph.
- Inherited From:
- Source:
Returns:
an array of all the vertices in the graph.
- Type
- Array.<V>