14 default:
FailR(
"Unknown graph type");
24 int SetId = Key, parent =
Parent(Key);
26 while (parent != -1) {
32 while (parent != -1) {
33 const int tmp =
Parent(parent);
34 if (tmp != -1) {
Parent(parent) = SetId; }
41 const int root1 =
Find(Key1);
42 const int root2 =
Find(Key2);
45 if (rank1 > rank2) {
Parent(root2) = root1; }
46 else if (rank1 < rank2) {
Parent(root1) = root2; }
47 else if (root1 != root2) {
54 printf(
" key\tset\n");
Main namespace for all the Snap global entities.
void Union(const int &Key1, const int &Key2)
Merges sets with elements Key1 and Key2.
have explicit edges (multigraph): TNEGraph, TNodeEdgeNet
TStr GetFlagStr(const TGraphFlag &GraphFlag)
Returns a string representation of a flag.
THash< TInt, TIntPr > KIdSetH
int Find(const int &Key)
Returns the set that contains element Key.
network with data on edges
TInt & Rank(const int &Key)
Returns the rank of element Key.
directed graph (TNGraph, TNEGraph), else graph is undirected TUNGraph
void Dump()
Prints out the structure to standard output.
enum TGraphFlag_ TGraphFlag
Graph Flags, used for quick testing of graph types.
TInt & Parent(const int &Key)
Returns the parent of element Key.
nodes only store out-edges (but not in-edges). See TBigNet
network with data on nodes
const TKey & GetKey(const int &KeyId) const