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.

680 questions
4
votes
1 answer

boost::graph astar algorithm without exceptions

I'm reading boost::graph documentation for future usage. I'm particularly interested in A* algorithm. Having a look to boost::graph::astar_search usage example, it seems the way to stop the algorithm is throwing an exception and catching it ouside…
neodelphi
  • 2,706
  • 1
  • 15
  • 22
4
votes
3 answers

Visitor class holding large shared state: best way to implement reference semantics?

This question is loosely based on the Boost.Graph library (BGL) that uses a Visitor-like pattern to customize recursive (search) algorithms. The BGL passes visitor objects by value (in analogy with the STL function objects) and the documentation…
TemplateRex
  • 69,038
  • 19
  • 164
  • 304
4
votes
1 answer

drawing custom BGL graph with graphviz

I'm new to Boost graph library and I try to draw a graph using graphviz. #include #include #include // for boost::tie #include #include…
remdezx
  • 2,939
  • 28
  • 49
4
votes
1 answer

BGL dijkstra_shortest_path algorithm method does not accept my color map exterior property

I have been trying to get boost graph lib's dijkstra_shortest_paths to compile for about a week now without avail. I am trying to use exterior property maps for the different named parameters required by the templated method. My graph uses bundled…
4
votes
3 answers

Boost Graph Library and Visitors

I'm writing a library for manipulating bond graphs, and I'm using the Boost Graph Library to store the data for me. Unfortunately, I can't seem to figure out how to implement a proper visitor pattern using it, as you can't subclass out vertices -…
user137792
3
votes
1 answer

BGL edge(u, v, g) with custom associative container for edge lists

I've just begun learning bgl and have hit on a problem while using a std::set with a custom ordering as the container for edge lists in an adjacency_list. I define the operator< to order the edges based on their properties, much like in the…
kamrann
  • 219
  • 4
  • 10
3
votes
2 answers

Boost Graph Library Polymorphic Bundled Properties

So I'm using a boost graph of the following type: typedef boost::adjacency_list GraphT VertexT and EdgeT are both classes to keep many of the properties I need. These are bundled…
David Mokon Bond
  • 1,576
  • 2
  • 18
  • 42
3
votes
2 answers

External property map tied to std::vector in boost graph library

I am currently trying to define external properties of a boost graph. I use some bundled properties as internal ones: struct VertexProperties { int demand; }; struct EdgeProperties { uint capacity; int cost; }; typedef adjacency_list
Exp
  • 206
  • 2
  • 5
3
votes
2 answers

C++ and generic graph distance algorithm

My problem is the following. I am learning C++ by writing a graph library and want to make use of as much generic programming techniques as possible; hence, answering my question through "use BOOST" will not help me; in fact, I tried looking through…
3
votes
1 answer

Boost graphviz custom vertex labels

Currently I have the following code for a project that represents some probability trees and uses custom structs for the vertex and edge types: #include #include struct Vertex{ …
shuttle87
  • 15,466
  • 11
  • 77
  • 106
3
votes
4 answers

Avoiding the use of temporary files, when the function wants a FILE * passed

I currently use C++ to do some graph related computation using boost::graph. boost::graph can output its graph as a dot file and I use a std::stringstream to capture the output dot file. Thus the contents of the dot file resides in memory. I want to…
Alexander Oh
  • 24,223
  • 14
  • 73
  • 76
3
votes
1 answer

Why does "xxx::function();" not work but "using namespace xxx; function();" does?

I am using Boost's graph C++ library, and I stumbled over a problem when asking for the number of vertices of a grid graph. The following code snipped creates a 2-dimensional grid graph of shape 5 by 6, and then prints the number of vertices of that…
3
votes
1 answer

In range-v3, can not create a subrange from two iterators

Problem I want to create a range from two iterators returned by a function. I used the answer to a related question to create a new subrange using range-v3: auto [it1, it2] = out_edges(u, _graph); return ranges::subrange(it1, it2) |…
WaterFox
  • 850
  • 6
  • 18
3
votes
1 answer

Boost Graph Library: Are Vertex Descriptors Necessarily Unique?

I realize this might be pedantic, but are BGL vertex descriptors always unique? For background, I have the following graph definition: typedef boost::adjacency_list Graph; Where I'm using…
3
votes
1 answer

Boost.Graph: fruchterman_reingold_force_directed_layout causes nodes being stuck in top-left corner

I'm having a few issues with the fruchterman_reingold_force_directed_layout algorithm. A lot of nodes always end up packing in the top-left corner. If I use a non-rectangle topology, I get only NaNs for the positions. The layout entirely changes…
Jean-Michaël Celerier
  • 7,412
  • 3
  • 54
  • 75