private int getShortestNodeIndex(int[] heights) {
        int minHeight = heights[0];
        int minHeightIndex = 0;
        for (int i = 0; i < heights.length; i++) {
            if ( heights[i] < minHeight )
                minHeight = heights[i];
            minHeightIndex = i;
        }
        return minHeightIndex;
    }