Techiio-author
Started by Peter DanielsSep 28, 2021

Closed
On Converting Existing Graphs to BGL

2 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 2 VIEWES SHARE

I tried to follow the guidelines concerning the implementation of the graph traits for accessing the vertex/edge data, as well as defining iterators for scanning the graph, but this tutorial lacks the description concerning the property maps that are declared in this other full implementation. In other words, which are precisely the property maps as outlined here that guarantee me that I could run all the algorithms from the Boost Graph Library?

1 Replies

Techiio-commentatorNeel Dey replied 7 months ago0 likes0 dislikes

That's asking the wrong question. One of the key design choices of the BGL (much like the STL) is the separation of data structures and algorithms. The set of properties required by the algorithm varies by the algorithm (and even by the usage of the same algorithm) and can be satisfied in many ways generically.

Which property map(s) are required is documented with the algorithm. This, by the way, is in addition to which concept the graph model must satisfy.

I do know that the documentation can be slightly out of date¹ and more specifically, life with c++14+ can be significantly easier than in the documentation examples.

In case it helps, here are "modern" examples on adapting your own data structures for use with BGL:

What is needed to use BGL algorithms on existing data structures ( edges and vertices as vector<Object *>)?

Interestingly, someone later ran into precisely your question about additional requirements for a specific algorithm. In this answer: What is required for a custom BGL graph to work with topological sort? I show not only how to figure out what requirements have to be satisfied but also how to achieve that.

Peter Daniels
Thank you for your kind feedback.
This thread is closed by Peter Daniels
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance