本文整理汇总了C++中ArraySet::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ ArraySet::Size方法的具体用法?C++ ArraySet::Size怎么用?C++ ArraySet::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArraySet
的用法示例。
在下文中一共展示了ArraySet::Size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maxDegree
vector<int> GraphTools::OrderVerticesByDegree(ArraySet const &inGraph, vector<SparseArraySet> const &neighborSets, bool const ascending)
{
vector<int> vOrderedVertices(inGraph.Size(), -1);
size_t maxDegree(0);
for (SparseArraySet const &neighborSet : neighborSets) {
maxDegree = max(maxDegree, neighborSet.Size());
}
vector<list<int>> vlVerticesByDegree(maxDegree + 1, list<int>());
for (size_t vertex = 0; vertex < neighborSets.size(); ++vertex) {
if (!inGraph.Contains(vertex)) continue;
//// std::cout << "maxDegree=" << maxDegree << ", degree=" << adjacencyList[vertex].size() << endl << flush;
vlVerticesByDegree[neighborSets[vertex].Size()].push_back(vertex);
}
if (ascending) {
size_t index(0);
for (size_t degree = 0; degree <= maxDegree; ++degree) {
for (int const vertex : vlVerticesByDegree[degree]) {
vOrderedVertices[index++] = vertex;
}
}
} else {
size_t index(0);
for (size_t degree = 0; degree <= maxDegree; ++degree) {
for (int const vertex : vlVerticesByDegree[maxDegree - degree]) {
vOrderedVertices[index++] = vertex;
}
}
}
return vOrderedVertices;
}