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

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

        如何为我的图形提供 vertex_index 属性

        时间:2023-10-06

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

            1. <legend id='QtYRx'><style id='QtYRx'><dir id='QtYRx'><q id='QtYRx'></q></dir></style></legend>

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

                  <tbody id='QtYRx'></tbody>
                  本文介绍了如何为我的图形提供 vertex_index 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  由于我的图使用 setS 作为顶点,我必须为我的图提供一个 vertex_index 属性映射,或者为 write_graphviz 提供一个显式的 vertex_id 参数,以便能够使用 write_graphviz.我的图定义为:typedef adjacency_list图;其中 NodeData 和 EdgeData 是结构.你能给我一个非常简单的例子来说明如何为我的图形提供一个 vertex_index 属性映射吗?或者如何给 write_graphviz 一个明确的 vertex_id 参数?

                  Since my graph use setS for vertex, I have to either provide a vertex_index property map for my graph, or give an explicit vertex_id argument to write_graphviz, to be able to use write_graphviz. My graph is defined as: typedef adjacency_list<setS, setS, undirectedS, NodeData, EdgeData> Graph; Where NodeData and EdgeData are structures. Can you please give me a very simple example of how to provide a vertex_index property map for my graph ? or how to give an explicit vertex_id argument to write_graphviz ?

                  谢谢

                  推荐答案

                  解决方案就是:1) 假设顶点描述符被定义为 typedef Graph::vertex_descriptor NodeID; 那么你需要定义一个关联属性映射如下:

                  The solution is just to: 1) Say the vertex descriptor is defined as typedef Graph::vertex_descriptor NodeID; then you need to define an associative property map as following:

                  typedef map<NodeID, size_t> IndexMap;
                  IndexMap mapIndex;
                  associative_property_map<IndexMap> propmapIndex(mapIndex);
                  

                  2) 在代码中,索引所有顶点如下:

                  2) In the code, index all vertices as following:

                  int i=0;
                  BGL_FORALL_VERTICES(v, g, Graph)
                  {
                     put(propmapIndex, v, i++);
                  }
                  

                  3) 您现在可以使用 graphvize 来绘制/可视化您的图表,如下所示:

                  3) You can now use graphvize to drow/visualize your graph as following:

                  ofstream myfile;
                  myfile.open ("example.txt");
                  write_graphviz(myfile, g, default_writer(), default_writer(), default_writer(), propmapIndex);
                  myfile.close();
                  

                  图表将在example.txt中进行描述,您可以使用graphviz对其进行可视化.

                  The graph will be described in example.txt, you can visualize it using graphviz.

                  这篇关于如何为我的图形提供 vertex_index 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:将 C++ 类转换为 JSON 下一篇:以允许响应更新的方式重载 C++ 索引下标运算符

                  相关文章

                  最新文章

                • <small id='2omn6'></small><noframes id='2omn6'>

                  <tfoot id='2omn6'></tfoot>

                    • <bdo id='2omn6'></bdo><ul id='2omn6'></ul>

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

                    <legend id='2omn6'><style id='2omn6'><dir id='2omn6'><q id='2omn6'></q></dir></style></legend>