getTreeDepth(vertexId, parentVertexId) {
    if (vertexId === null || parentVertexId === null) {
      return 0;
    }

    let neighbours = this.vertices[vertexId].getSpanningTreeNeighbours(parentVertexId);
    let max = 0;

    for (var i = 0; i < neighbours.length; i++) {
      let childId = neighbours[i];
      let d = this.getTreeDepth(childId, vertexId);

      if (d > max) {
        max = d;
      }
    }

    return max + 1;
  }
Get the depth of a subtree in the direction opposite to the vertex specified as the parent vertex.

@param {Number} vertexId A vertex id.
@param {Number} parentVertexId The id of a neighbouring vertex.
@returns {Number} The depth of the sub-tree.