提升如何在图形可视化中写入边缘的权重?
Boost how to write edge's weight in graphviz?
使用 boost,我正在尝试以图形可视化格式编写一个非常大且密集的图,这是一个adjacency_matrix
。图表本身:boost::adjacency_matrix<boost::undirectedS, boost::no_property, boost::property<boost::edge_weight_t, float>, boost::no_property>
。
我在StackOverflow,Google上搜索,要么我不理解代码,要么它是一个LABEL编写器而不是WEIGHT编写器。
我的提升版本是 1.72.0。
如果我犯了错误,我很抱歉我的英语。提前谢谢你。
标签编写器也同样PropertyWriter
。PropertyWriters
用于写入权重(或任何其他边/顶点属性(。
但是,我强烈建议使用dynamic_properties
来简化过程。这是我在这个网站上的20+使用示例。
这是我能想到的最简单的ajacency_matrix
应用程序:
住在科里鲁
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/graphviz.hpp>
#include <iostream>
using EP = boost::property<boost::edge_weight_t, float>;
using G = boost::adjacency_matrix<boost::undirectedS, boost::no_property, EP>;
int main() {
G g(5);
add_edge(1, 2, 3.5f, g);
add_edge(2, 3, 4.5f, g);
boost::dynamic_properties dp;
dp.property("node_id", get(boost::vertex_index, g));
dp.property("weight", get(boost::edge_weight, g));
boost::write_graphviz_dp(std::cout, g, dp);
}
印刷:
graph G {
0;
1;
2;
3;
4;
2--1 [weight=3.5];
3--2 [weight=4.5];
}
相关文章:
- D3D11-将混合权重和索引传递到顶点着色器
- 如何获取边缘窗口句柄 (HWND)?
- 提升如何在图形可视化中写入边缘的权重?
- 在 c++ 中使用 Tensorflow Lite 在边缘 TPU 上运行"mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite"时出现问题
- 分数背包边缘箱
- 应用程序无法找到铬边缘浏览器
- OpenCV 3 中的神经网络权重
- SFML C++ Canny边缘检测双刃
- 难以使球从屏幕边缘反弹
- 我的精灵使用名为 ASGE 的C++框架卡在屏幕边缘
- 我对 MyGraph 属性顶点名称和边权重有问题
- 无法在 vtk 中重新着色边缘
- 生成具有均匀汉明权重 (popcount) c++ 的整数
- 如何使用提升make_label_writer写入边缘属性?
- 有没有一种方法可以使用弗洛伊德-沃歇尔算法给出最短路径,其中存在负权重循环而不允许重叠边缘?
- 增强自定义权重到boost :: grid_graph中的边缘描述符
- 遍历常量提升的边缘权重::graph
- boost::prim_minimum_spanning_tree中出现意外的负边缘权重错误
- 通过自定义边缘权重惩罚来提升A*访问者
- 负边缘权重检查在升压dijkstra_shortest_paths