A protocol for declaring connections between elements and querying status of connected components
A protocol for declaring connections between elements and querying status of connected components
(component uf k)
Returns component containing key k, or nil if k is not present
Returns component containing key k, or nil if k is not present
(components uf)
Returns a sequence of the connected components
Returns a sequence of the connected components
(connect uf key1 key2)
Returns new union-find data structure where key1 and key2 are connected
Returns new union-find data structure where key1 and key2 are connected
(connected? uf key1 key2)
Are key1 and key2 in the same connected component?
Are key1 and key2 in the same connected component?
(contains-element? uf k)
Is key k in uf?
Is key k in uf?
(count-components uf)
Returns number of connected components
Returns number of connected components
(count-elements uf)
Returns number of elements
Returns number of elements
(elements uf)
Returns a sequence of the elements
Returns a sequence of the elements
(union-find)
(union-find & elements)
Constructor for the union-find data structure. Any arguments to the constructor will be added to the data structure as separate elements, initially disconnected from one another.
Constructor for the union-find data structure. Any arguments to the constructor will be added to the data structure as separate elements, initially disconnected from one another.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close