SNAP Library, User Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TUnionFind Class Reference

List of all members.

Public Member Functions

TInt & Parent (const int &Key)
 Returns the parent of element Key.
TInt & Rank (const int &Key)
 Returns the rank of element Key.
 TUnionFind ()
 TUnionFind (const int &ExpectKeys)
 Constructor that reserves enough memory for ExpectKeys elements.
 TUnionFind (const TUnionFind &UnionFind)
TUnionFind & operator= (const TUnionFind &UF)
int Len () const
 Returns the number of elements in the structure.
bool IsKey (const int &Key) const
 Returns true if the structure contains element Key.
int GetKeyI (const int &KeyN) const
 Returns the element KeyN.
int Find (const int &Key)
 Returns the set that contains element Key.
int Add (const int &Key)
 Adds an element Key to the structure.
void Union (const int &Key1, const int &Key2)
 Merges sets with elements Key1 and Key2.
bool IsSameSet (const int &Key1, const int &Key2)
 Returns true if elements Key1 and Key2 are in the same set.
void Dump ()
 Prints out the structure to standard output.

Detailed Description

Union Find class (Disjoint-set data structure). For more info see: http://en.wikipedia.org/wiki/Disjoint-set_data_structure)


Constructor & Destructor Documentation

TUnionFind::TUnionFind ( ) [inline]
TUnionFind::TUnionFind ( const int &  ExpectKeys) [inline]

Constructor that reserves enough memory for ExpectKeys elements.

TUnionFind::TUnionFind ( const TUnionFind &  UnionFind) [inline]

Member Function Documentation

int TUnionFind::Add ( const int &  Key) [inline]

Adds an element Key to the structure.

void TUnionFind::Dump ( )

Prints out the structure to standard output.

int TUnionFind::Find ( const int &  Key)

Returns the set that contains element Key.

int TUnionFind::GetKeyI ( const int &  KeyN) const [inline]

Returns the element KeyN.

bool TUnionFind::IsKey ( const int &  Key) const [inline]

Returns true if the structure contains element Key.

bool TUnionFind::IsSameSet ( const int &  Key1,
const int &  Key2 
) [inline]

Returns true if elements Key1 and Key2 are in the same set.

int TUnionFind::Len ( ) const [inline]

Returns the number of elements in the structure.

TUnionFind& TUnionFind::operator= ( const TUnionFind &  UF) [inline]
TInt& TUnionFind::Parent ( const int &  Key) [inline]

Returns the parent of element Key.

TInt& TUnionFind::Rank ( const int &  Key) [inline]

Returns the rank of element Key.

void TUnionFind::Union ( const int &  Key1,
const int &  Key2 
)

Merges sets with elements Key1 and Key2.


The documentation for this class was generated from the following files: