Boost logo

Boost Users :

From: abhishek.v_at_[hidden]
Date: 2007-09-12 01:39:19


Hi

Considering the example that comes with BGL i.e
examples/dijkstra-example.cpp.
I have already a graph which is undirected now i want to apply dijkstra
algorithm on it.
My vertex discriptor is "Vertex_name" and edge discriptor is "edge_value".

The following is the code provided in the example. :-

std::vector<vertex_descriptor> p(num_vertices(g));
  std::vector<int> d(num_vertices(g));
  vertex_descriptor s = vertex(A, g);

#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
  // VC++ has trouble with the named parameters mechanism
  property_map<graph_t, vertex_index_t>::type indexmap = get(vertex_index,
g);
  dijkstra_shortest_paths(g, s, &p[0], &d[0], weightmap, indexmap,
                          std::less<int>(), closed_plus<int>(),
                          (std::numeric_limits<int>::max)(), 0,
                          default_dijkstra_visitor());
#else
  dijkstra_shortest_paths(g, s,
predecessor_map(&p[0]).distance_map(&d[0]));
#endif

My code for the corresponding code is as follows :-

std::vector<vertex_descriptor> p(num_vertices(g));
 std::vector<int> d(num_vertices(g));
 vertex_descriptor s = vertex(L1, g); //Giving error Undeclared identifier
L1.
Here L1 is the name of my vertex. Also i tried Vertex_name(u) to this
parameter but it is giving compilation error.
What parameter need to be passed for this.

Secondly i m not defining BOOST_MSVC so i'm elimination the IF BLock and
directly writing the code as

  dijkstra_shortest_paths(g, s,
predecessor_map(&p[0]).distance_map(&d[0]));

Here kindly explain what the distance_map signifies and where it is being
defined.

Thanks
Abhishek Vyas
Tata Consultancy Services
Mailto: abhishek.v_at_[hidden]
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
                        Business Solutions
                        Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net