本文整理汇总了C++中Pair::getNodeId方法的典型用法代码示例。如果您正苦于以下问题:C++ Pair::getNodeId方法的具体用法?C++ Pair::getNodeId怎么用?C++ Pair::getNodeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pair
的用法示例。
在下文中一共展示了Pair::getNodeId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: numberOfCCsMaxCC
void numberOfCCsMaxCC(Graph* g, int* numberOfCCs, int* maxCC) {
List* intList = g->getAllIDs();
int numberOfCC = 0;
int numberOfNodes = 0;
int maxNumCC = 0;
LinearHashTable *hashTable = g->getHashTable();
BucketList **bucketListTable = hashTable->getTable();
for (int i = 0; i < hashTable->getCurrentBucketNo(); i++) {
BucketList *bucketList = bucketListTable[i];
BucketListItem *cur = (BucketListItem*) bucketList->getHead();
while (cur != NULL) {
Bucket *bucket = cur->getElement();
for (int j = 0; j < bucket->getSize(); j++) {
BucketItem *bi = bucket->getBucketItemByIndex(j);
int startNodeId = bi->getNodeID();
numberOfNodes = 0;
bool skip = true;
IntegerListItem* listNode = (IntegerListItem*) intList->getHead();
while (listNode != NULL) {
if (listNode->getInt() == startNodeId) {
intList->deleteItem(listNode);
numberOfCC++;
numberOfNodes++;
skip = false;
break;
}
listNode = (IntegerListItem*) listNode->getNext();
}
if (!skip) {
//reachNodeN from each node of the graph
ResultSet *res = reachNodeN(startNodeId, g);
Pair* pair;
while (pair = res->next()) {
IntegerListItem* searchListNode = (IntegerListItem*) intList->getHead();
while (searchListNode != NULL) {
if (searchListNode->getInt() == pair->getNodeId()) {
intList->deleteItem(searchListNode);
numberOfNodes++;
break;
}
searchListNode = (IntegerListItem*) searchListNode->getNext();
}
}
//delete res; //free(): invalid next size (fast):
}
if (numberOfNodes > maxNumCC)
maxNumCC = numberOfNodes;
}
cur = (BucketListItem*) cur->getNext();
}
}
delete intList;
*numberOfCCs = numberOfCC;
*maxCC = maxNumCC;
}