Unsolved Need help in creating an adjacency graph
-
Hi everyone,
I need to create an adjacency graph and find the shortest path using Boost library (BGL) ! I'm a complete amateur and it's a huge challenge for me !
Let's take this adjacency graph as an exemple
Let's start with these questions
1-How can I create each node and name it ? ( A , B ,C ...)
2-How to connect nodes with arrows or lines ?
3-How can I give values to each line/arrow ?
I couldn't find any tutorials related to this I wish someone helps me -
@Codeseeker sorry but how is this related to Qt? in addition to using BGL library to solve the graph algorithms, are you planning to draw the graph?
I couldn't find any tutorials related to this I wish someone helps me
What about this tutorial?
-
Why Boost library?- This is a Qt forum, and of course, you can create a graph in Qt, even in plain C++ with Winapi.
Once I created a similar project and I recommend you to think about your architecture:
-
You create a Vertex class with x,y, and ID properties; also a GraphManager class to store all the vector that you can create.
-
You create a Edge class , and also create a container to this Edges (every Edge has a first and second id to connect vertex).
-
This is answered with point number 2.
Recommendation: Create a graph view, and create a graph manager to store all the containers that you'll need.
This is a whole process, I think is quite big to answer it in one forum post.
-
-
Hi
This one is quite compact sample ( considering its boost)
http://www.boost.org/doc/libs/1_46_1/libs/graph/example/quick_tour.cpp
http://www.boost.org/doc/libs/1_46_1/libs/graph/doc/quick_tour.html