ExtendFindEnum
Declared in lemon/unionfind.h, in the group Auxiliary Data Structures; the same class on the Doxygen site.
-
template< typename IM >
class ExtendFindEnum A Extend-Find data structure implementation which is able to enumerate the components.
The class implements an Extend-Find data structure which is able to enumerate the components and the items in a component. The data structure is a simplification of the Union-Find structure, and it does not allow to merge two components.
- Pre:
You need to add all the elements by the insert() method.
Public Functions
-
inline ExtendFindEnum( ItemIntMap & _index )
Constructor.
-
inline int insert( const Item & item )
Inserts the given element into a new component.
This method creates a new component consisting only of the given element.
-
inline void insert( const Item & item , int cls )
Inserts the given element into the given component.
This methods inserts the element item a into the cls class.
-
inline void clear()
Clears the union-find data structure.
Erase each item from the data structure.
-
inline void erase( const Item & item )
Removes the given element from the structure.
Removes the element from its component and if the component becomes empty then removes that component from the component list.
Warning
It is an error to remove an element which is not in the structure.
-
inline void eraseClass( int cdx )
Removes the component of the given element from the structure.
Warning
It is an error to give an element which is not in the structure.
-
class ClassIt
LEMON style iterator for the classes.
ClassIt is a lemon style iterator for the components. It iterates on the ids of classes.
Public Functions
-
inline ClassIt( const ExtendFindEnum & ufe )
Constructor of the iterator
-
inline operator int() const
Conversion operator.
It converts the iterator to the current class id.
-
inline ClassIt( const ExtendFindEnum & ufe )
-
class ItemIt
LEMON style iterator for the items of a component.
ClassIt is a lemon style iterator for the components. It iterates on the items of a class. By example if you want to iterate on each items of each classes then you may write the next code.
for( ClassIt cit( ufe ) ; cit != INVALID ; ++cit ) { std::cout << "Class: "; for( ItemIt iit( ufe , cit ) ; iit != INVALID ; ++iit ) { std::cout << toString( iit ) << ' ' << std::endl; } std::cout << std::endl; }
Public Functions
-
inline ItemIt( const ExtendFindEnum & ufe , int cls )
Constructor of the iterator. The iterator iterates on the class of the
item.
-
inline ItemIt( const ExtendFindEnum & ufe , int cls )