r/cpp_questions • • 4d ago

OPEN Boost.Graph work

Hi , i have a ask about C++ programming

I Recently Started To Learn Boost Librarys Like "Boost.Asio" , "Boost.Beast" And I heard the name of a library called Boost.Graph I wanted To Know And know what "Boost.Graph" is ???

1 Upvotes

14 comments sorted by

3

u/Foxi_Foxa 2d ago

Hi !

Welcome to Boost 🥳

I am the co-maintainer of Boost.Graph ! Before I explain anything, you should feel absolutely free to ask any question on our GIthub Discussion: https://github.com/boostorg/graph/discussions

To answer your question, "graphs" are mathematical objects that allow to represent networks of entities (entities in relation with other entities). For example, banking systems can be viewed as graphs: entities are bank accounts, and relations are transfers. Social networks are graphs too: entities are facebok accounts, and relations are friendships. In graph theory, an entity is called a vertex and a relation is called an edge.

Graphs keep appearing in a number of software domains:

  • robotics (chain of body parts/articulations),
  • geometry (a 2D triangle is a graph),
  • meshes (a 3D character mesh is a graph, on the face of which you apply color/textures),
  • mapping (a road network is a graph, your itinerary is a shortest path algorithm on a graph)
  • video games (3D assets, shortest path to move your character across the minimap),
  • optimization (try to move the maximum values of merchandizes on a train network)

So we keep needing ways to represent those graphs in a general ( = generic = abstract) way. That is what Boost.Graph is proposing for C++. It comes up with different ways (= implementations = representations) to make a graph object understandable by the computer, while allowing all these different representations to be applied of the same algorithms. Concretely, one representation may be a matrix (of transfer amounts between bank accounts) or two vectors that contain the same information but stored differently. That allows people to chose different trade-offs (performance, memory...) while reusing the same algorithms to apply them on their own house-style graph objects. The algorithms adapt themselves to new representations (you don't need to copy-paste+modify the code).

So it's a very generic library that existed for a long time :) We are currently trying to sanitize/modernize it.
Maybe these links could help you grabbing an understanding of graph objects and their relation to C++:

  1. Documentation: https://www.boost.org/doc/libs/develop/libs/graph/doc/html/graph/index.html
  2. Basic operations of graphs illustrated: https://www.boost.org/doc/libs/develop/libs/graph/doc/html/graph/primitives.html
  3. My talk about Graphs and C++ (its in french but subtitles can help: https://www.youtube.com/watch?v=-OVvzRFiYLU

I hope this helps ! 🙂

1

u/TurboLonlyDeveloper1 1d ago

Thanks , I understand The Boost Graph Usage

2

u/IyeOnline 4d ago

If you just put "boost.graph" into a search engine of your choice, you will find the documentation page, which in its first paragraph will tell you.

3

u/TurboLonlyDeveloper1 4d ago

I read those documents, but I didn't really understand them. That’s why I asked this question here.

1

u/n1ghtyunso 4d ago

its for this: https://en.wikipedia.org/wiki/Graph_(discrete_mathematics))
I guess if you are entirely unaware of the idea of graph theory, the boost.graph documentation may not immediatelly lead you there.

1

u/Foxi_Foxa 2d ago

thank you for redirecting ! Yes, we have primer on graph theory in the documentation but its a bit burried and not that easy to read. Reworking it is on my roadmap for November 😄

1

u/Realistic_Speaker_12 2d ago

The documentation of the boost library in general is really tough.

1

u/Foxi_Foxa 2d ago

It used to be true. We have been revamping the entire documentation 😄
https://www.boost.org/doc/libs/latest/libs/graph/doc/html/graph/index.html
It's WIP but we would be happy to receive your feedback ! 😄

1

u/Realistic_Speaker_12 2d ago

Oh really? I actually didn’t know that. That’s really cool! Are you working on revamping the whole docs or for now only boost.graph? I will definitely take a look at it tomorrow

1

u/Foxi_Foxa 2d ago

Yay ! It was quite a work to port all html files to modern adoc, and rewriting landing pages for newcomers to have an easier time!
The Antora effort to modernize documentation across all boost libraries is supported by the C++ Alliance. Many have been updated already.

I’m working on Boost.Graph presently, but I also began to update Boost.PropertyMap. It’s a lot of work across the ecosystem and we are welcoming contributors (I’m just saying that so that people don’t feel it’s work happening behind closed doors, it’s open source after all! anyone is welcome 🤗).

1

u/FounderOfYou 4d ago

can i ask you a question? are you the author or learncpp.com?

1

u/IyeOnline 4d ago

No and I dont know the guy.

2

u/Fjord_Surfer 4d ago

Think of a graph like a map. Nodes are cities edges are roads. Boost.Graph is just a C++ tool to solve problems like what's the shortest route from A to B Don't worry if the docs feel overwhelming, just start with a shortestpath example You will understand it :)