I'm familiar with the path compression technique for union-find, but I tend
not to use it for two reasons:

1. That technique generally assumes you are going to continue to compress
the path with each *find* operation, not just the union.  This means you
need to either use a mutable structure or else the find operation needs to
also return a new structure with compressed paths each time you do a find,
and you need to thread that through to the next find, which is awkward.

2. I find that most of the time, after building the structure, I want to
list out all the components or count the components or otherwise do
something to each component.  With the path compression version, you can't
answer any of those basic questions without fully flattening it.

If you like the path compression approach, here's another Clojure
implementation:
https://github.com/jordanlewis/data.union-find

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to