X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Fcomponenttree.h;h=84d6270218101fbde5c71c01468837d577dae18d;hb=80163771173997d308e8f11815c5d9a92d8ba8f5;hp=aad4ddbdd076cc4c6c5cbb42437f1c61199696fd;hpb=35ac6a57e0314a8c557f327ec540415ff20bc2dc;p=germs.git diff --git a/src/componenttree.h b/src/componenttree.h index aad4ddb..84d6270 100644 --- a/src/componenttree.h +++ b/src/componenttree.h @@ -22,10 +22,17 @@ #define __COMPONENTTREE_H__ #include +#include #include "misc.h" +/** + * Creates and holds a component tree. + */ class ComponentTree { public: + /** + * A node in the component tree. + */ struct Node { Node(Node* parent, Component comp); ~Node(); @@ -48,8 +55,19 @@ class ComponentTree { */ void makeUnoriented(); + /** + * Count the number of leaves in the component tree. + * This is the number of hurdles, if makeUnoriented has been called. + */ size_t countLeaves(); + /** + * Number of short branches. + * If makeUnoriented has been called and countLeaves is >= 3 + * then we have a super hurdle if short branches = 0. + */ + size_t shortBranches(); + private: //Disable these, at least for now. void operator=(const ComponentTree&){}; @@ -57,6 +75,7 @@ class ComponentTree { void removeOriented(Node* n); size_t countLeaves(Node* n); + void branches (Node* n, std::map & b); Node* _root;