[ccan] [PATCH 4/4] agar: Re-entrant Abstract Graph Algorithms

Rusty Russell rusty at rustcorp.com.au
Tue Jul 8 21:22:37 EST 2014


David Gibson <david at gibson.dropbear.id.au> writes:
> The graph algorithms in the aga module require some node-local storage.
> This means that the calling code:
>     a) Needs to actually allocate memory per node.  That may or may not
>        be natural depending on its internal representation.
>     b) Multiple algorithms can't run at once (easily), since they all need
>        to use the aga_node structures.
>
> This patch adds a new "agar" module which uses the aga module to provide
> versions without those restrictions, by allocating per-node storage itself
> for each run, and associating those with the caller's representation of
> nodes via a hash table.

Bonus points for the cute name :)

I've thought about a 'tag' module which would provide dynamic struct
fields (ie. allow you to tag arbitrary memory).  This is essentially
what you've implemented.

You could almost roll this into ccan/aga if you allowed for callbacks
on aga_start and aga_finish?

Cheers,
Rusty.


More information about the ccan mailing list