title: Creating Graph class in C#
body: <p>I have a task to create <code>Graph</code> class in C#, that would have following properties:</p>
  
  <pre><code>private List&lt;string&gt; vertices;
  private List&lt;List&lt;int&gt;&gt; adjacencyMatrix;
  private int n;
  </code></pre>
  
  <p><code>n</code> is the number of nodes, the rest is self explanatory I believe.
  The class should also have two methods that look like this:</p>
  
  <p><code>Add(string vertex){}</code></p>
  
  <p><code>AddConnection(string vertex1, string vertex2, int value){}</code></p>
  
  <p>So far, I figured out the <code>Add</code> method (assuming that 0 represents no connection between vertices):</p>
  
  <pre><code>public void Add(string vertex)
  {
       this.vertices.Add(vertex);
      List&lt;int&gt; temp = new List&lt;int&gt;();
      foreach(List&lt;int&gt; element in this.adjacencyMatrix)
      {
          element.Add(0);
      }
      foreach(string element in vertices)
      {
          temp.Add(0);
      }
      this.adjacencyMatrix.Add(temp);
  
      this.n++;
  }
  </code></pre>
  
  <p>But I still dont know how to add connection.
  Any help would be appreciated</p>