X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=flower%2Finclude%2Funionfind.hh;h=b83a673a5d62aebfd640accb34804984fe6e9248;hb=3667c501f00ea9da03b3d7dfb0133bb48276a398;hp=fbaa51e7318f57e186962f209d48cc918eacf656;hpb=01ddcb81463d7a68530971100469d3e2baf8c94b;p=lilypond.git diff --git a/flower/include/unionfind.hh b/flower/include/unionfind.hh index fbaa51e731..b83a673a5d 100644 --- a/flower/include/unionfind.hh +++ b/flower/include/unionfind.hh @@ -1,25 +1,26 @@ #ifndef UNIONFIND_HH #define UNIONFIND_HH -#include "varray.hh" +#include "array.hh" -/* +/** which points of a graph are connected?. Union find, a standard algorithm: Union_find represents an undirected graph of N points. You can - connect two points using #connect()#. #find(i)# finds a uniquely + connect two points using #connect()#. #find (i)# finds a uniquely determined representant of the equivalence class of points connected to #i#. */ struct Union_find { - void connect(int i, int j); - int find(int i); - bool equiv(int i, int j) { return find(i) == find(j); } - Union_find(int sz); - -private: - Array classes; + void connect (int i, int j); + int find (int i); + bool equiv (int i, int j) { return find (i) == find (j); } + Union_find (int sz); + /** + This array provides the representing point for each node in the graph. + */ + Array classes_; }; #endif