diff --git a/src/data-structures/graph/Graph.js b/src/data-structures/graph/Graph.js index 8e603c38..ae123ca1 100644 --- a/src/data-structures/graph/Graph.js +++ b/src/data-structures/graph/Graph.js @@ -115,9 +115,11 @@ export default class Graph { */ findEdge(startVertex, endVertex) { const vertex = this.getVertexByKey(startVertex.getKey()); + if (!vertex) { return null; } + return vertex.findEdge(endVertex); }