1. <tfoot id='rOMEc'></tfoot>

      <small id='rOMEc'></small><noframes id='rOMEc'>

      <legend id='rOMEc'><style id='rOMEc'><dir id='rOMEc'><q id='rOMEc'></q></dir></style></legend>

        <i id='rOMEc'><tr id='rOMEc'><dt id='rOMEc'><q id='rOMEc'><span id='rOMEc'><b id='rOMEc'><form id='rOMEc'><ins id='rOMEc'></ins><ul id='rOMEc'></ul><sub id='rOMEc'></sub></form><legend id='rOMEc'></legend><bdo id='rOMEc'><pre id='rOMEc'><center id='rOMEc'></center></pre></bdo></b><th id='rOMEc'></th></span></q></dt></tr></i><div id='rOMEc'><tfoot id='rOMEc'></tfoot><dl id='rOMEc'><fieldset id='rOMEc'></fieldset></dl></div>
          <bdo id='rOMEc'></bdo><ul id='rOMEc'></ul>

        从 Boost 图中删除 100,000 多个节点

        Remove 100,000+ nodes from a Boost graph(从 Boost 图中删除 100,000 多个节点)
          <bdo id='7VH2X'></bdo><ul id='7VH2X'></ul>

          • <i id='7VH2X'><tr id='7VH2X'><dt id='7VH2X'><q id='7VH2X'><span id='7VH2X'><b id='7VH2X'><form id='7VH2X'><ins id='7VH2X'></ins><ul id='7VH2X'></ul><sub id='7VH2X'></sub></form><legend id='7VH2X'></legend><bdo id='7VH2X'><pre id='7VH2X'><center id='7VH2X'></center></pre></bdo></b><th id='7VH2X'></th></span></q></dt></tr></i><div id='7VH2X'><tfoot id='7VH2X'></tfoot><dl id='7VH2X'><fieldset id='7VH2X'></fieldset></dl></div>

                <tbody id='7VH2X'></tbody>
              <tfoot id='7VH2X'></tfoot>
              • <small id='7VH2X'></small><noframes id='7VH2X'>

                  <legend id='7VH2X'><style id='7VH2X'><dir id='7VH2X'><q id='7VH2X'></q></dir></style></legend>
                  本文介绍了从 Boost 图中删除 100,000 多个节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个图( adjacency_list (listS, vecS, bidirectionalS, VertexVal) ),我需要在其中删除 100,000 多个节点.每个节点还包含一个由 2 个 64 位整数和另一个 64 位整数组成的结构.下面代码中发生的 guid 检查是检查结构中的第一个整数.

                  I have a graph ( adjacency_list (listS, vecS, bidirectionalS, VertexVal) ) in which I need to delete 100,000+ nodes. Each node also contains a structure of 2 64-bit integers and another 64-bit integer. The guid check that happens in the code below is checking 1st integer in the structure.

                  在我的笔记本电脑(i7 2.7GHz,16GB RAM)上,根据 VTune 大约需要 88 秒.

                  On my laptop ( i7 2.7GHz, 16GB RAM ) it takes about 88 seconds according to VTune.

                  以下是我删除节点的方法:

                  Following is how I delete the nodes:

                    vertex_iterator vi,vi_end;
                    boost::tie(vi, vi_end) = boost::vertices(m_graph);
                    while (vi!=vi_end) {
                      if (m_graph[*vi].guid.part1 == 0) {
                        boost::remove_vertex(*vi,m_graph);
                        boost::tie(vi, vi_end) = boost::vertices(m_graph);
                      } else 
                        ++vi;
                    }
                  

                  Vtune 显示 boost::remove_vertex() 调用需要 88.145 秒.有没有更有效的方法来删除这些顶点?

                  Vtune shows that the boost::remove_vertex() call takes 88.145 seconds. Is there a more efficient way to delete these vertices?

                  推荐答案

                  我能够使用 Boost 序列化例程成功将图形序列化为字符串,解析字符串并删除我不需要的节点并反序列化修改后的字符串.对于图中总共 200,000 个节点和需要删除的 100,000 个节点,我能够在不到 2 秒的时间内成功完成操作.

                  I was able to successfully serialize the graph using Boost serialization routines into a string, parse the string and remove the nodes I didn't need and de-serialize the modified string. For 200,000 total nodes in graph and 100,000 that needs to be deleted I was able to successfully finish the operation in less than 2 seconds.

                  对于我的特定用例,每个顶点都有 3 个 64 位整数.当需要删除时,我将这些整数中的 2 个标记为 0.一个有效的顶点永远不会有 0.当需要清理图形时 - 删除已删除"的顶点,我遵循上述逻辑.

                  For my particular use-case each vertex has 3 64bit integers. When it needs to be deleted, I mark 2 of those integers as 0s. A valid vertex would never have a 0. When the point comes to clean up the graph - to delete the "deleted" vertices, I follow the above logic.

                  在下面的代码中,removeDeletedNodes() 执行字符串解析和移除顶点并映射边数.

                  In the code below removeDeletedNodes() does the string parsing and removing the vertices and mapping the edge numbers.

                  这篇关于从 Boost 图中删除 100,000 多个节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to limit the number of running instances in C++(C++中如何限制运行实例的数量)
                  Using boost::asio::async_read with stdin?(将 boost::asio::async_read 与 stdin 一起使用?)
                  How to find out what dependencies (i.e other Boost libraries) a particular Boost library requires?(如何找出特定 Boost 库需要哪些依赖项(即其他 Boost 库)?)
                  What#39;s the purpose of a leading quot;::quot; in a C++ method call(引导“::的目的是什么?在 C++ 方法调用中)
                  Boost Spirit x3: parse into structs(Boost Spirit x3:解析为结构体)
                  How boost auto-linking makes choice?(boost自动链接如何做出选择?)
                    <tbody id='4Fsbs'></tbody>
                  1. <legend id='4Fsbs'><style id='4Fsbs'><dir id='4Fsbs'><q id='4Fsbs'></q></dir></style></legend>

                  2. <i id='4Fsbs'><tr id='4Fsbs'><dt id='4Fsbs'><q id='4Fsbs'><span id='4Fsbs'><b id='4Fsbs'><form id='4Fsbs'><ins id='4Fsbs'></ins><ul id='4Fsbs'></ul><sub id='4Fsbs'></sub></form><legend id='4Fsbs'></legend><bdo id='4Fsbs'><pre id='4Fsbs'><center id='4Fsbs'></center></pre></bdo></b><th id='4Fsbs'></th></span></q></dt></tr></i><div id='4Fsbs'><tfoot id='4Fsbs'></tfoot><dl id='4Fsbs'><fieldset id='4Fsbs'></fieldset></dl></div>
                  3. <tfoot id='4Fsbs'></tfoot>

                    <small id='4Fsbs'></small><noframes id='4Fsbs'>

                          <bdo id='4Fsbs'></bdo><ul id='4Fsbs'></ul>