title: Implementation of Adjacent Matrix with 2D vectors c++
body: <p>I am a beginner in c++ and I have worked on vectors just not on 2D vectors. I have surfed a lot, but data on internet is very specific related to 2D vectors.
  I need to build a graph given an input file and then apply Kruskal's algorithm for minimum spanning tree.</p>
  
  <p>My approach:</p>
  
  <pre><code>A1, A2, A3.....An would be the first row and col of my 2d Vectors and they will
   contain name. I will read the input file and start matching the names.
   And then at graph[i][j] I will put the weight.
  
       A1 A2 A3......  
  
  A1   w  w  w ....... 
  A2   w  w  w .......
  A3   w  w  w .......
  </code></pre>
  
  <p>.
  .
  .
  .
  Now I am trying something like this: </p>
  
  <pre><code>struct mat{
         string name;
  }
  
  int main(){
  vector&lt;vector&lt;mat&gt;&gt; matrix;
  // In order to insert
  vector&lt;mat&gt; tempVec;
  tempVec[0].name = "stack";
  matrix.push_back(tempVec);
  }   
  </code></pre>
  
  <p>Now I have no idea that when I do <code>tempVec[0].name</code>, 0 indicates which row or col of Matrix. If it indicates row then how do I know which col is being accessed. 
  I mean <code>vector.push_back(tempVec)</code>, assigns which position in my Matrix to data. I know I can access individual elements like Matrix[i][j]. But How can I assign weight to a particular row, col position and then access it.</p>
  
  <p>Further do you think will be a good implementation for Kruskal's Method. </p>
  
  <p>Please be simple in your code and explanatory. 
  And thanks in advance.</p>