本文整理汇总了C++中BitMap::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ BitMap::assign方法的具体用法?C++ BitMap::assign怎么用?C++ BitMap::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitMap
的用法示例。
在下文中一共展示了BitMap::assign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: levelPartition
void OrientedGraph::levelPartition(Partition& pi) const
/*
Assuming the graph has no oriented cycles, this function writes in pi the
partition of the vertices according to their level, where sinks have level
0, then sinks in the remaining poset have level one, etc.
NOTE : the implementation is simple-minded : we traverse the graph as many
times as there are levels.
*/
{
static BitMap b(0);
static BitMap b1(0);
b.setSize(size());
b.reset();
b1.setSize(size());
b1.reset();
pi.setSize(size());
Ulong count = 0;
Ulong current_level = 0;
while (count < size()) {
for (SetElt x = 0; x < size(); ++x) {
if (b.getBit(x))
continue;
const EdgeList e = d_edge[x];
for (Ulong j = 0; j < e.size(); ++j) {
if (!b.getBit(e[j])) /* next x */
goto nextx;
}
/* i we get here, x is the next element in the permutation */
pi[x] = current_level;
b1.setBit(x);
++count;
nextx:
continue;
}
b.assign(b1);
current_level++;
}
pi.setClassCount(current_level);
return;
}