D graph library

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


On 05/15/2013 08:34 PM, w0rp wrote:
> On the subject of possibly making addNode nothrow, I think it may be difficult
> or impossible at current to make the Graph functions pure, which I think is
> rather unfortunate. At my last try in D, I backed my graphs with
> Weight[Node][Node] exactly as mentioned before, but this ruined the purity. This
> was all because the properties for associative arrays are not pure, which is one
> of my top change requests for D. I really would like to see a graph type that is
> usable inside pure functions.

I don't think that associative arrays are the right storage class anyway.  My
feeling is that if you're going to have public labels for nodes, the best way to
do that is to have an associative array mapping those labels to underlying node
IDs (and back again), and for the labels to not be used at all internally.



More information about the Digitalmars-d mailing list