本文整理汇总了C++中Vertices::find方法的典型用法代码示例。如果您正苦于以下问题:C++ Vertices::find方法的具体用法?C++ Vertices::find怎么用?C++ Vertices::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertices
的用法示例。
在下文中一共展示了Vertices::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildDataStructure
void GraphComponent::buildDataStructure ()
{
for (int index = 0; index < size; index++)
{
int firstVertex = vertices[index];
Datatree *tree = new Datatree(firstVertex);
Vertices *firstVertices = new Vertices();
firstVertices->insert(firstVertex);
std::list<TreeToAdd> treeToAddList;
struct TreeToAdd firstTreeToAdd = {tree,0,firstVertices,0};
treeToAddList.push_back(firstTreeToAdd);
while (!treeToAddList.empty())
{
struct TreeToAdd treeToAdd = treeToAddList.front();
Datatree *node = treeToAdd.node;
Vertices *vertices = treeToAdd.vertices;
treeToAddList.pop_front();
if (VERBOSE) {
for (int i = 0; i < VERBOSE_TAB; i++) { std::cout << "..."; }
std::cout << "(" << VERBOSE_TAB << ") CURRENTLY ON NODE ";
node->printVertices();
VERBOSE_TAB++;
}
Vertices *adjVertices = graph->getAdjacentVertices(node->vertex,graph->size);
for (Vertices::iterator it = adjVertices->begin(); it != adjVertices->end(); ++it)
{
int childVertex = *it;
if (order->at(childVertex) >= order->at(firstVertex) && vertices->find(childVertex) == vertices->end())
{
vertices->insert(childVertex);
Datatree *child = node->addChild(childVertex);
Vertices *childVertices = new Vertices(*vertices);
struct TreeToAdd childTreeToAdd = {child,0,childVertices,0};
treeToAddList.push_back(childTreeToAdd);
if (node->wholeSet)
{
datatree->parent = child;
child->wholeSet = true;
node->wholeSet = false;
}
}
}
delete adjVertices;
delete vertices;
if (VERBOSE) { VERBOSE_TAB--; }
}
treeToAddList.clear();
struct TreeToAdd newTreeToAdd = {datatree,tree,new Vertices (),0};
treeToAddList.push_back(newTreeToAdd);
while (!treeToAddList.empty())
{
struct TreeToAdd treeToAdd = treeToAddList.front();
Datatree *node = treeToAdd.node;
Datatree *nodeToAdd = treeToAdd.nodeToAdd;
Vertices *vertices = treeToAdd.vertices;
// Vertices *adjVertices = treeToAdd.adjVertices;
treeToAddList.pop_front();
if (VERBOSE) {
for (int i = 0; i < VERBOSE_TAB; i++) { std::cout << "..."; }
std::cout << "(" << VERBOSE_TAB << ") ADJUSTING NODE ";
node->printVertices(false);
std::cout << " WITH ";
nodeToAdd->printVertices(false);
std::cout << " KNOWING ";
graph->printVertices(vertices);
std::cout << std::endl;
VERBOSE_TAB++;
}
if (vertices->find(nodeToAdd->vertex) == vertices->end())
{
node = node->addChild(nodeToAdd->vertex);
vertices->insert(nodeToAdd->vertex);
}
for (TreesSet::iterator it = nodeToAdd->children->begin(); it != nodeToAdd->children->end(); ++it)
{
Datatree *child = *it;
if (vertices->find(child->vertex) == vertices->end())
{
Vertices *childVertices = new Vertices (*vertices);
struct TreeToAdd childToAdd = {node,child,childVertices,0};
treeToAddList.push_back(childToAdd);
vertices->insert(child->vertex);
}
}
if (nodeToAdd->parent != 0)
//.........这里部分代码省略.........