D graph library

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed May 15 11:38:50 PDT 2013


On 05/15/2013 08:28 PM, w0rp wrote:
> I don't think that's too useful or necessary. A graph is at its heart a pair (V,
> E) where V is the vertex set and E is the edge set. So addNode is really just V'
> = V ∪ {n} for some node n. I think it's best to just allow redundantly adding a
> node, which ought to be an O(1) function.

In the same way as one could add a word to a dictionary, say?

Consider that it's possible to have multigraphs where there _can_ be multiple
edges from one node to another.  You might well want to explicitly enforce the
user's awareness of error if they try adding multiple edges to the wrong type of
graph.


More information about the Digitalmars-d mailing list