Graph
Graph<V, E>
Overview needed
Template Parameters
V
– The type for the vertices of the graph.E
– The type for the weight of the edges of the graph.
Constructor
public Graph
new Graph()
*Description needed*Properties
No publicly accessible properties on Graph
private list: Map<V, Edge<V, E>[]>
Description needed
private reverseList: Map<V, Edge<V, E>[]>
Description needed
Methods
private dfs
dfs(visited, v) => void
Description needed
Parameters
visited: Map<V, false | true>
– Description neededv: V
– Description needed
public createNode
createNode(value) => void
Description needed
Parameters
-
value: V
– Description needed
public createEdge
createEdge(source, target, weight) => void
Description needed
Parameters
source: V
– Description neededtarget: V
– Description neededweight: E
– Description needed
public isConnected
isConnected() => false | true
Description needed
Returns
-
false | true
– Description needed
public getDegree
getDegree(node) => number
Description needed
Parameters
-
node: V
– Description needed
Returns
-
number
– Description needed
public getConnections
getConnections(value) => Edge<V, E>[]
Description needed
Parameters
-
value: V
– Description needed
Returns
-
Edge<V, E>[]
– Description needed
private getNodeDepths
getNodeDepths(max) => V[][]
Description needed
Parameters
-
max: false | true
– Description needed
Returns
-
V[][]
– Description needed
public getMaxNodeDepths
getMaxNodeDepths() => V[][]
Used to get the max "depth" of each node where the source nodes have a depth of 0 and each additional layer adds +1 to the depth. If a node has parents at multiple depths such as 1 and 3, then it inherits from the "deeper" one, so the node would have a depth of 4. This should only be called if the isConnected() is true and the graph is acyclic.
Returns
-
V[][]
– A map where each key is each node and the value is the max depth of that node.
public getMinNodeDepths
getMinNodeDepths() => V[][]
Used to get the min "depth" of each node where the source nodes have a depth of 0 and each additional layer adds +1 to the depth. If a node has parents at multiple depths such as 1 and 3, then it inherits from the "shallower" one, so the node would have a depth of 2. This should only be called if the isConnected() is true and the graph is acyclic.
Returns
-
V[][]
– A map where each key is each node and the value is the max depth of that node.
Static Methods
No static methods for Graph
Edge<V, E>
Overview needed
Template Parameters
V
– The type for the vertices of the edge.E
– The type for weight of the edge.
Constructor
public Edge
new Edge(target, weight)
*Description needed*Parameters
target: V
– Description neededweight: E
– Description needed
Properties
No publicly accessible properties on Edge
private target: V
Description needed
private weight: E
Description needed
Methods
Static Methods
No static methods for Edge