Questions tagged [boost-graph]

Boost.Graph is a C++ library containing generic graph components and algorithms.

Boost.Graph is a C++ library containing generic graph components and algorithms.

611 questions
46
votes
4 answers

Extracting segments from a list of 8-connected pixels

Current situation: I'm trying to extract segments from an image. Thanks to openCV's findContours() method, I now have a list of 8-connected point for every contours. However, these lists are not directly usable, because they contain a lot of…
B. Decoster
  • 7,456
  • 1
  • 30
  • 52
38
votes
5 answers

Modifying vertex properties in a Boost::Graph

I am trying to figure out how to use boost::graph to store some information. However, there is information I want tied to each vertex. Staring at the documentation for the library reveals either(a)badly written documentation, or (b), I'm obviously…
Paul Nathan
  • 37,919
  • 28
  • 110
  • 204
33
votes
2 answers

Find Boost BGL vertex by a key

I am looking for a way to access vertex properties by using a key instead of vertex reference itself. For example, if I have class Data { public: std::string name; unsigned int value; }; typedef boost::adjacency_list< boost::vecS,…
Serge C
  • 2,105
  • 15
  • 22
31
votes
1 answer

How to create a C++ Boost undirected graph and traverse it in depth first search (DFS) order?

How to create a C++ Boost undirected graph and traverse it in depth first search (DFS) order?
Ashwin Nanjappa
  • 68,458
  • 72
  • 198
  • 283
26
votes
2 answers

Get specific edge with boost::graph

I'm using boost::graph and I have two vertex_descriptors. What is the quickest way to get the edge between them, without iterating over all the edges?
Amir Rachum
  • 67,681
  • 68
  • 159
  • 239
20
votes
9 answers

Use a Graph Library/Node Network Library or Write My Own?

I'm trying to decide between going with a pre-made graph/node network library or to roll my own. I'm implementing some graph search algorithms which might require some significant customization to the class structure of the node and/or edges. The…
Catskul
  • 15,635
  • 13
  • 75
  • 111
14
votes
1 answer

What is a property map in BOOST?

Can someone explain to a Boost beginner like me what is a property map is in Boost? I came across this when trying to use the BGL for calculating strong connected components. I went throw the documentation for the property map and graph module and…
Matei Florescu
  • 1,115
  • 9
  • 20
12
votes
1 answer

Graph visualization (boost graph)

I have C++ program using boost graph library. I wonder if there is any way to visualize the graph (nodes and optionally edges) following a certain position values contained in nodes. Please look the examples of the image bellow to understand what I…
shn
  • 4,382
  • 9
  • 29
  • 61
12
votes
1 answer

What's the difference between vertex descriptor and index in Boost Graph Library?

In Boost graph library, when should one use vertex descriptor and when index? Since the implementation of vertex_descriptor is actually unsigned integer, do the two things have the same value?
cntswj
  • 185
  • 2
  • 10
12
votes
3 answers

Iterating over edges of a graph using range-based for

I have a representation of a graph as a std::vector> neighbors, that is, vertices are integers, and for each vertex we keep a set of its neighbors. Thus, to walk all edges, I would do something like for (unsigned u = 0;…
Falk Hüffner
  • 4,301
  • 15
  • 23
11
votes
1 answer

Adding a vertex_index to listS graph on the fly for betweenness centrality

Update: The issue may be in the betweenness code. If I comment out the call to brandes_betweenness_centrality the code will compile. the problem may not be the index set up as previously thought. I'll award bounty if you can come up with an…
pbible
  • 1,229
  • 19
  • 33
10
votes
2 answers

How to fit a custom graph to the boost graph library template?

I'm rusty on C++ templates and I'm using the boost graph library (a fatal combination). I've searched the web and can't find any direct instructions on how to take a custom graph structure and fit enough of it to BGL (boost graph library) that I can…
Michael
  • 313
  • 2
  • 8
10
votes
1 answer

How do I stop the breadth-first search using Boost Graph Library when using a custom visitor?

Say I found the node that meets my criteria and I need to stop the search.
ypv
10
votes
4 answers

reducing memory requirements for adjacency list

I'm using adjacency_list< vecS, vecS, bidirectionalS ... > extensively. I have so many graphs loaded at once that memory becomes an issue. I'm doing static program analysis and store the callgraph and flowgraphs of the disassembled binary in boost…
BuschnicK
  • 4,928
  • 6
  • 34
  • 47
10
votes
2 answers

Replace BGL iterate over vertexes with "pure" C++11 alternative?

I want to replace the BGL iteration over vertexes or edges with pure C++11 equivalent. The BGL code (from: http://www.boost.org/doc/libs/1_52_0/libs/graph/doc/quick_tour.html) is: typename boost::graph_traits::out_edge_iterator out_i,…
Wojciech Danilo
  • 10,776
  • 13
  • 60
  • 118
1
2 3
40 41