接下来一段日子,会写一些跟bgl相关的内容。bgl是一个性能很不错的库,但是源码跟鬼畜一样…文档也写得很乱。因为最近做的论文需要比较好的性能,实在不得不硬着头皮重新用起bgl。所以尽可能的做一些总结,希望能给后面需要使用的同学能有点帮助。
开始: 一个简单的小例子
csdn代码样式不好看,欢迎直接访问我的个人网站。
{% codeblock lang:Cpp %}
#include // for std::cout
#include // for std::pair
#include // for std::for_each
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
using namespace boost;
int main(int,char*[])
{
// create a typedef for the Graph type
typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
// Make convenient labels for the vertices
enum { A, B, C, D, E, N };
const int num_vertices = N;
const char* name = "ABCDE";
// writing out the edges in the graph
typedef std::