Boost logo

Boost Users :

From: 박기수 (park_at_[hidden])
Date: 2002-06-07 01:21:34

Thank you for your answer, Jeremy Siek.
but I can't be cheered. ( ^^; )

1. I ordered BGL book and will get it in 10 days.
   ( I live in korea, the 2002 FIFA world cup co-host. but not sell BGL book.)

2. Before Creating my graph structure and interface, what I want to do is :
   (1) Add object pointer to integer graph(object has an integer ID).
   (2) Bind the object's member function to visitor object.
 for example,
using namespace std;
using namespace boost;

class MyVertexObject
      int m_id;

vector <MyVertexObject* > DrawVector;

 struct draw_visitor : public default_bfs_visitor
  template<typename Vertex, function f, typename Graph>
      void do_something_vertex(Vertex u, Graph& g)

int main()
    Graph graph;
      draw_vistor<MyVertexObject*, mem_fn(MyDrawObject::Draw())> vis;
      graph_traits<Graph>::vertex_iterator vs, ve;
      tie(vs, ve) = vertices(graph);
      graph_traits<Graph>::vertex_descriptor starter = *vs;
      breadth_first_search(graph, starter, visitor(vis) );

I agree that above code is akward. but How about my intents? Is it akward, either?

----- Original Message -----
From: "Jeremy Siek" <jsiek_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.user
Sent: Friday, June 07, 2002 4:22 AM
Subject: Re: [BGL] How can I use vertex object rather than integer?


You can't use your own vertex and edge classes with the adjacency_list
class, however you can add extra data to the vertices and edges using
internal properties. Page 52 of the BGL book has an explanation and

Also, of course you can create you own graph structure and then implement
the BGL interface. Then all the BGL algorithms will work with your graph.
You might find Chapter 10 of the BGL book helpful in doing this.


On Wed, 5 Jun 2002, 박기수 wrote:
yg-boo> for example,
yg-boo> class Node
yg-boo> {
yg-boo> public:
yg-boo> int m_id;
yg-boo> };
yg-boo> class Edge
yg-boo> {
yg-boo> public:
yg-boo> int from_node_id;
yg-boo> int to_node_id;
yg-boo> };
yg-boo> How can I use this class to make graph?
yg-boo> many examples show only integer id graph..
yg-boo> thanks in advance

 Jeremy Siek
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster ( office phone: (812) 855-3608

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at