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
6
votes
1 answer

DFS in boost::graph with changing the graphs content

Minimal example: #include #include #include struct vertex { int number; }; struct edge {}; typedef boost::adjacency_list
Johannes
  • 2,901
  • 5
  • 30
  • 50
6
votes
1 answer

find multiple edges given 2 vertices in BOOST graph

I am using Boost Graph library for some project and i want to find number of times an edge is repeated in a graph. for example, typedef boost::adjacency_list Graph_t; …
Pogo
  • 475
  • 3
  • 19
6
votes
3 answers

Boost.Graph how to merge two vertices/contract edge

How to merge two vertices/contract edge at Boost.Graph? I need to move edges from vertex A to vertex B, and delete vertex A - is there any built-in function? Or maybe there is something special for adjacency_list? If there is no such function - then…
qble
  • 1,256
  • 2
  • 12
  • 29
6
votes
1 answer

boost::edge causing segfault

I'm trying to use the boost graph library, and I'm getting a segfault when I try to use boost::edge(). The full code is available here, but here I've made a minimal program that has the same issue (I'm compiling with "g++…
bgschiller
  • 2,087
  • 1
  • 16
  • 30
6
votes
2 answers

Which boost graph algorithm do I use?

I have a set of nodes A-G, Z, with weighted edges defined, where A-G are various nodes in a funnel, with Z at the very bottom. Visualize a funnel (V-shaped) with various edges, but eventually pointed towards Z, the final node, like water flowing…
kfmfe04
  • 14,936
  • 14
  • 74
  • 140
6
votes
2 answers

How do I define a custom distance in Boost Dijkstra?

I'm currently looking at the documentation of Boost Dijkstra - http://www.boost.org/doc/libs/1_52_0/libs/graph/doc/dijkstra_shortest_paths.html; my objective is to modify the distance combining to get a "max" instead of a "plus" when computing my…
Balise
  • 168
  • 5
6
votes
1 answer

Iterating through edge weights of a const boost::graph

I need to iterate through the edges of a graph and examine the weight of each edge. I'm not modifying the edges, therefore my function takes a const-reference to a graph. However, the only way I know to get the edge weights is to get access to the…
Jack Valmadre
  • 888
  • 7
  • 23
5
votes
0 answers

Detect cycles in undirected graph using boost graph library

I've been stuck since yesterday with this problem. Unfortunately/fortunately this problem makes only about 0.5% of the my super huge (for me, a c++ newbie) algorithm thus the need for a library of existing code that one can just adapt and get things…
Daniel
  • 51
  • 1
  • 2
5
votes
1 answer

custom properties for edges in the BGL

I started using the BGL for some graph-related task. I have a large number of edges and each edge has several properties, one of which is its weight. (All properties are floats and ints). Since I never worked with the BGL (and/or similar CPP…
janoliver
  • 7,744
  • 14
  • 60
  • 103
5
votes
1 answer

Boost Graph Library: Bundled Properties and iterating across edges

Just trying to get my head around the Boost Graph Library and I have a few questions. I'm writing some code which is a wrapper class around a BGL graph. The idea is that I can manipulate the graph however I want, then call a wrapper method to output…
Michael D.
  • 195
  • 1
  • 9
5
votes
1 answer

Why can't I use boost graph write_graphviz with OutEdgeList=listS and VertexList=listS

Why can't I compile the following simple app. If I changes listS to vecS every thing works just fine. (I'am using boost 1.46.1 and gcc 4.4.5) #include #include #include int…
Allan
  • 4,562
  • 8
  • 38
  • 59
5
votes
1 answer

What is needed to use BGL algorithms on existing data structures ( edges and vertices as vector)?
I have custom data structures like this : vector my_vertices; vector my_edges; My class myEdge has source() and target() methods, returning myVertex*, so it should be quite ready as is, right? What external adaptation do I…
AIDoubt
  • 322
  • 2
  • 10
5
votes
1 answer

How can I detect subgraph isomorphism on multigraph using Boost's vf2_subgraph_iso?

I'm trying to use Boost's vf2_subgraph_iso() to detect subgraph isomorphism. I can successfully do this on simple graph, but can not on multigraph (a graph which is permitted to have multiple edges). Consider detecting subgraph isomorphism between…
hiroyuki
  • 61
  • 4
5
votes
1 answer

Check if vertex already exists before an add_edge using Boost Graph [BGL]

Is there a way to check if a vertex in a graph created using Boost already exists rather than looping through the vertices? And if it already exists, how can I add a new edge using its vertex descriptor? Example: Graph g; vertex v; v =…
Nikki Mino
  • 309
  • 1
  • 2
  • 12
5
votes
1 answer

Get node label from boost::labeled_graph

I would like to retrieve the label of a labeled node in BGL's labeled_graph but cannot find a method to do this. The following MWE demonstrates what I am looking for: //g++ -O3 question.cpp -o question.exe -I. --std=c++11 -lprotobuf-lite -lpthread…
Richard
  • 56,349
  • 34
  • 180
  • 251