[Haskell-cafe] Re: What do _you_ want to see in FGL?

Ivan Miljenovic ivan.miljenovic at gmail.com
Mon May 10 20:42:56 EDT 2010


On 11 May 2010 00:22, Henning Thielemann <lemming at henning-thielemann.de> wrote:
>
> On Tue, 11 May 2010, Ivan Miljenovic wrote:
>
>> You're splitting apart related data into _three_ different data
>> structures (the graph, vertex labels and edge labels)?  _That_ doesn't
>> make sense.
>
> There are no edge labels, only vertex labels. And yes, I find separation of
> data structures for separation of concerns a good strategy.

Think about it this way: you want to delete a vertex.  With your
approach, you have to do the following:

1) Delete it from the graph (which takes care of deleting any edges
incident with that vertex)

2) Delete it from your vertex-label mapping

3) If you also have edge labels, delete it from your edge-label
mapping for all edges incident with that vertex.

As such, you have to do a lot of bookkeeping to keep your graph +
associated mappings in a consistent state which FGL currently provides
for you _for free_.

These mappings are an integral part _of_ the graph, not just something
extra that tags along.  Keeping them all together helps avoid an
inconsistent state.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list