title: Is this a correct way to analyze a graph? Warshall algorithm
body: <p>Here's an implementation of Warshall algorithm copied from this site 
  <a href="https://rosettacode.org/wiki/Floyd-Warshall_algorithm#Java" rel="nofollow noreferrer">https://rosettacode.org/wiki/Floyd-Warshall_algorithm#Java</a></p>
  
  <p>What I need is to analyze this algorithm.I already did but I want to make sure everything is correct. </p>
  
  <pre><code>   for (int i = 0; i &lt; weights.length; i++) { //O(E)?
  dist[weights[i][0] - 1][weights[i][1] - 1] = weights[i][2];}
  
  
      for (int i = 0; i &lt; next.length; i++) {//O(v^2)
          for (int j = 0; j &lt; next.length; j++)
              if (i != j)
                  next[i][j] = j + 1;
      }
  
      for (int k = 0; k &lt; numVertices; k++)//O(v^3)
          for (int i = 0; i &lt; numVertices; i++)
              for (int j = 0; j &lt; numVertices; j++)
                  if (dist[i][k] + dist[k][j] &lt; dist[i][j]) {
                      dist[i][j] = dist[i][k] + dist[k][j];
                      next[i][j] = next[i][k];
                  }
  
  //Finally  takes O(v^3)
  </code></pre>