Hello.
I have written a function that calculates maximum cardinality matchings
on bipartite graphs. It's only 24 lines of code.
It seems (tested, not proven) to run faster, use less memory, and scale
better than using MaxFlow from FGL with constant weight and additional
source and sink nodes. B
Hi,
fwd = foldr (\(x,y) -> M.insertWith (++) x [y]) M.empty $ S.toList g
Use foldl' here, foldr is absolutely useless here and it only consumes
the stack space as your operation is strict.
As for the actual code: I'd prefer the code itself to be more
readable, rather than have a lot of liter
On 2012-Oct-22 14:23 (-0700), Eugene Kirpichov wrote with possible deletions:
>
> fwd = foldr (\(x,y) -> M.insertWith (++) x [y]) M.empty $ S.toList g
>
> Use foldl' here, foldr is absolutely useless here and it only consumes
> the stack space as your operation is strict.
Thank you very much
I didn't analyze it but anytime I see "M.insertWith" I am just in doubt -
do you know about a strict version M.insertWith' ?
2012/10/24 Stefan Klinger
> On 2012-Oct-22 14:23 (-0700), Eugene Kirpichov wrote with possible
> deletions:
> >
> > fwd = foldr (\(x,y) -> M.insertWith (++) x [y]) M.e