boost graph meant to contain classes and functions?
I see that the boost graph library is used to contain data but can it be used to contain a class which a visitor moves along the graph per a preset algorithm calling interfacing functions as it moves along? Here is an example. class Color_Base { virtual ~Color_Base(){} virtual std::string get_Name () = 0; }; class Red : Color_Base { virtual ~Red (){} virtual std::string get_Name () { return std::string("Red"); } }; class Yellow : Color_Base { virtual ~Yellow (){} virtual std::string get_Name () { return std::string("Yellow"); } }; class Blue : Color_Base { virtual ~Blue (){} virtual std::string get_Name () { return std::string("Blue"); } }; So we could have a graph like | Blue -- Red | / | / | / Yellow I have a visitor called Color_Visitor which has the following pseudo code: for each vertice in graph visit vertice call get_Name() print result Stephen -- Email: storri@torri.org
Stephen torri wrote:
I see that the boost graph library is used to contain data but can it be used to contain a class which a visitor moves along the graph per a preset algorithm calling interfacing functions as it moves along?
I can't understand the question, sorry. What's "moves along" and what's "present algorithm".
class Blue : Color_Base { virtual ~Blue (){}
virtual std::string get_Name () { return std::string("Blue"); } };
So we could have a graph like
| Blue -- Red | / | / | / Yellow
I have a visitor called Color_Visitor which has the following pseudo code:
for each vertice in graph visit vertice call get_Name() print result
You can assign a Color_Base* to each vertex using either internal or external property and call 'get_Name()' on each vertex. - Volodya
On Wed, 2004-09-22 at 01:43, Vladimir Prus wrote:
Stephen torri wrote:
I see that the boost graph library is used to contain data but can it be used to contain a class which a visitor moves along the graph per a preset algorithm calling interfacing functions as it moves along?
I can't understand the question, sorry. What's "moves along" and what's "present algorithm".
Sorry. This is a prime example of "Torri" logic. Half in the brain and half in the email. A visitor to the graph would be what "moves" along on the graph.
class Blue : Color_Base { virtual ~Blue (){}
virtual std::string get_Name () { return std::string("Blue"); } };
So we could have a graph like
| Blue -- Red | / | / | / Yellow
I have a visitor called Color_Visitor which has the following pseudo code:
for each vertice in graph visit vertice call get_Name() print result
You can assign a Color_Base* to each vertex using either internal or external property and call 'get_Name()' on each vertex.
Good idea. I will need to review what is a internal or external property. Thanks. Stephen -- Email: storri@torri.org
A word of advice. If you entend to mutate your graph, I sugguest using internal instead of external properties. Depending on the container types employed internally of the graph, which you can specify, the vertex/edge descriptors are not useable as keys. The vertex descriptor is simply an index when vecS is used. The edge descriptor is an object that lacks an operator< method. I'd sugguest looking at adjacency_list_io.cpp for a non-trivial example of internal property usage. It as opposed to most other examples, actually has an custom struct. Stephen torri wrote:
On Wed, 2004-09-22 at 01:43, Vladimir Prus wrote:
Stephen torri wrote:
I see that the boost graph library is used to contain data but can it be used to contain a class which a visitor moves along the graph per a preset algorithm calling interfacing functions as it moves along?
I can't understand the question, sorry. What's "moves along" and what's "present algorithm".
Sorry. This is a prime example of "Torri" logic. Half in the brain and half in the email. A visitor to the graph would be what "moves" along on the graph.
class Blue : Color_Base { virtual ~Blue (){}
virtual std::string get_Name () { return std::string("Blue"); } };
So we could have a graph like
| Blue -- Red | / | / | / Yellow
I have a visitor called Color_Visitor which has the following pseudo code:
for each vertice in graph visit vertice call get_Name() print result
You can assign a Color_Base* to each vertex using either internal or external property and call 'get_Name()' on each vertex.
Good idea. I will need to review what is a internal or external property.
Thanks.
Stephen
On Wed, 2004-09-22 at 13:33, Jeffrey Holle wrote:
A word of advice. If you entend to mutate your graph, I sugguest using internal instead of external properties. Depending on the container types employed internally of the graph, which you can specify, the vertex/edge descriptors are not useable as keys. The vertex descriptor is simply an index when vecS is used. The edge descriptor is an object that lacks an operator< method.
I'd sugguest looking at adjacency_list_io.cpp for a non-trivial example of internal property usage. It as opposed to most other examples, actually has an custom struct.
Give the documentation description of what an adjacency_list is what I was planning on using. I would construct that graph and then traverse it with a visitor. I would not be changing graph in anyway during traversal. Thanks for the info. Stephen -- Email: storri@torri.org
participants (3)
-
Jeffrey Holle
-
Stephen torri
-
Vladimir Prus