How to represent a graph in c++
<p>I would like to write prims and dijkstra algoritms that create a MST. But I do not know what is the best way to represent graph in c++.</p>

<p>I could represent an edge by pair of two ints for example vector 0 to 1 would be pair(0,1);</p>

<pre><code>typedef pair&lt;int, int&gt; Edge;
</code></pre>

<p>And then the prims function would take Vector of pairs that consist of an edge and its weight.</p>

<pre><code>void prims(vector&lt;pair&lt;Edge, int&gt;&gt;);
</code></pre>

<p>I think that this way is not the best one, could anyone tell me what way would be the best to represent a graph?</p>