Solved

BOOST GRAPH:  ONE MORE ERROR IN SAMPLE CODE

Posted on 2007-11-23
26
1,284 Views
Last Modified: 2010-04-21
what is so wrong with this small piece of sample code ?

     typedef graph_traits < TGraph >::vertex_descriptor vertex_descriptor;
     typedef graph_traits < TGraph >::edge_descriptor edge_descriptor;

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

is part of  http://www.boost.org/libs/graph/doc/quick_tour.html  or in  other examples ...
my compiler claims .
---------------------------

d:\07privat\c++\boost_v01\boost_demo_v01\boost_demo_v01.cpp(324) : error C2064: Ausdruck ergibt keine Funktion, die 1 Argumente übernimmt
d:\07_privat\c++\boost_v01\boost_demo_v01\boost_demo_v01.cpp(325) : error C2064: Ausdruck ergibt keine Funktion, die 1 Argumente übernimmt
d:\07_privat\c++\boost_v01\boost_demo_v01\boost_demo_v01.cpp(329) : warning C4138: '*/' wurde außerhalb des Kommentars gefunden
d:\07_privat\c++\boost_v01\boost_demo_v01\boost_demo_v01.cpp(329) : error C2059: Syntaxfehler: '/'

// boost_demo_v01.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.

// Add all the different sample codes from BOOST to one unique demo sample 

//  
 

  #include "stdafx.h"

  #include <iostream>                  // for std::cout

  #include <utility>                   // for std::pair

  #include <algorithm>                 // for std::for_each

  #include <vector>

  #include <boost/graph/graph_traits.hpp>

  #include <boost/graph/adjacency_list.hpp>

  #include <boost/graph/dijkstra_shortest_paths.hpp>

  #include <boost/graph/graphviz.hpp>
 

  using namespace boost;
 
 
 

  template <class Graph> struct exercise_vertex3 {

    exercise_vertex3(Graph& g_) : g(g_) { }

    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;

    void operator()(const Vertex& v) const

    {

         

      typename property_map<Graph, vertex_index_t>::type 

          index = get(vertex_index, g);

      typename graph_traits<Graph>::edge_descriptor e;
 

      std::cout << "in-edges: ";

      typedef typename graph_traits<Graph> GraphTraits;

      typename GraphTraits::in_edge_iterator in_i, in_end;

      for (tie(in_i, in_end) = in_edges(v,g); 

           in_i != in_end; ++in_i) {

        e = *in_i;

        Vertex src = source(e, g), targ = target(e, g);

        std::cout << "(" << index[src] << "," << index[targ] << ") ";

      }

      std::cout << std::endl;

      //...

    }

    //...

	Graph& g;

  };
 
 
 

  template <class Graph> struct exercise_vertex2 {

    exercise_vertex2(Graph& g_) : g(g_) { }

    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;

    void operator()(const Vertex& v) const

    {

      typedef graph_traits<Graph> GraphTraits;

      typename property_map<Graph, vertex_index_t>::type 

        index = get(vertex_index, g);
 

      std::cout << "out-edges: ";

      typename GraphTraits::out_edge_iterator out_i, out_end;

      typename GraphTraits::edge_descriptor e;

      for (tie(out_i, out_end) = out_edges(v, g); 

           out_i != out_end; ++out_i) {

        e = *out_i;

        Vertex src = source(e, g), targ = target(e, g);

        std::cout << "(" << index[src] << "," 

                  << index[targ] << ") ";

      }

      std::cout << std::endl;

      //...

    }

    //...

	Graph& g;

  };
 
 
 
 

  template <class Graph> struct exercise_vertex {

  exercise_vertex(Graph& g_) : g(g_) { }

  typedef typename graph_traits<Graph>::vertex_descriptor Vertex;

  void operator()(const Vertex& v) const

  {

    using namespace boost;

    typename property_map<Graph, vertex_index_t>::type 

      vertex_id = get(vertex_index, g);

    std::cout << "vertex: " << get(vertex_id, v) << std::endl;
 

    // Write out the outgoing edges

    std::cout << "\tout-edges: ";

    typename graph_traits<Graph>::out_edge_iterator out_i, out_end;

    typename graph_traits<Graph>::edge_descriptor e;

    for (tie(out_i, out_end) = out_edges(v, g); 

         out_i != out_end; ++out_i)

    {

      e = *out_i;

      Vertex src = source(e, g), targ = target(e, g);

      std::cout << "(" << get(vertex_id, src)

                << "," << get(vertex_id, targ) << ") ";

    }

    std::cout << std::endl;
 

    // Write out the incoming edges    

    std::cout << "\tin-edges: ";

    typename graph_traits<Graph>::in_edge_iterator in_i, in_end;

    for (tie(in_i, in_end) = in_edges(v, g); in_i != in_end; ++in_i)

    {

      e = *in_i;

      Vertex src = source(e, g), targ = target(e, g);

      std::cout << "(" << get(vertex_id, src)

                << "," << get(vertex_id, targ) << ") ";

    }

    std::cout << std::endl;
 

    // Write out all adjacent vertices    

    std::cout << "\tadjacent vertices: ";

    typename graph_traits<Graph>::adjacency_iterator ai, ai_end;

    for (tie(ai,ai_end) = adjacent_vertices(v, g);  ai != ai_end; ++ai)

      std::cout << get(vertex_id, *ai) <<  " ";

    std::cout << std::endl;

  }

  Graph& g;

};
 
 
 

  
 

    
 
 
 
 
 
 
 
 
 
 
 
 

int _tmain(int argc, _TCHAR* argv[])

{
 

/*Constructing a Graph

In this example we will use the BGL adjacency_list class to demonstrate the main ideas in the 

BGL interface. The adjacency_list class provides a generalized version of the classic "adjacency list" 

data structure. The adjacency_list is a template class with six template parameters, though here we only fill 

in the first three parameters and use the defaults for the remaining three. The first two template arguments (

vecS, vecS) determine the data structure used to represent the out-edges for each vertex in the graph and 

the data structure used to represent the graph's vertex set (see section Choosing the Edgelist and VertexList 

for information about the tradeoffs of the different data structures). The third argument, bidirectionalS, 

selects a directed graph that provides access to both out and in-edges. The other options for the third 

argument are directedS which selects a directed graph with only out-edges, and undirectedS which selects 

an undirected graph. 
 

Once we have the graph type selected, we can create the graph in Figure 2 by declaring a graph object 

and filling in edges using the add_edge() function of the MutableGraph interface (which adjacency_list implements).

We use the array of pairs edge_array merely as a convenient way to explicitly create the edges for this example.*/ 
 
 
 
 

    // create a typedef for the Graph type

    

	

	typedef adjacency_list<vecS, vecS, bidirectionalS> TGraph;
 

    // typedef adjacency_list < listS, vecS, directedS, no_property, property < edge_weight_t, int > > TGraph;
 

   // typedef graph_traits < TGraph >::vertex_descriptor vertex_descriptor;

   // typedef graph_traits < TGraph >::edge_descriptor edge_descriptor;
 
 

    // Make convenient labels for the vertices

    enum { A, B, C, D, E, N };

    const int num_vertices = N;

    // int num_vertices;
 

    const char* name = "ABCDE";

    int  j;

	int  i;

    

	//   writing out the edges in the graph

	//   for dynamic arrays use the vector og edges ....

    typedef std::pair<int, int> TEdge;

    typedef std::vector <TEdge> TEdge_array; 

	typedef std::vector<int> TWeights;
 

    TWeights  Weights;

	TEdge  OneEdge;

	TEdge_array Edge_array;

    TEdge edge_array2[] = 

    { TEdge(A,B), TEdge(A,D), TEdge(C,A), TEdge(D,C),

      TEdge(C,E), TEdge(B,D), TEdge(D,E),TEdge(5,5),TEdge(A,5), TEdge(C,7), TEdge(B,7), TEdge(D,8), TEdge(5,8), TEdge(9,5),

	  TEdge(13,E), TEdge(12,D), TEdge(16,E),TEdge(14,55),TEdge(31,5), TEdge(33,7), TEdge(33,31)};

    

    

	const int num_edges = sizeof(edge_array2)/sizeof(edge_array2[0]);
 

	

    std::cout <<  "  BOOST GRAPH DEMO PROGRAM                  \n";

    std::cout <<  "  Compile@01:00 Version 01.01.05  23-11-2007 \n\n";

	

	for (i=0; i<num_edges; i++) 

		{

	    Edge_array.push_back(edge_array2[i]);

		Weights.push_back((rand()%10)+1);

		}
 

	
 
 

    // declare a graph object

    //                        Graph g(num_vertices);  

	// 

    //  alternative sysntax : Graph G(edges + sizeof(edges) / sizeof(E), weights, num_nodes);
 

    TGraph g(num_edges);
 

    // add the edges to the graph object

    for (i = 0; i < num_edges; ++i)

	   {

        OneEdge = Edge_array[i];

		add_edge(OneEdge.first, OneEdge.second, g);

	   }

//Accessing the Vertex Set

//Now that we have created a graph, we can use the graph interface to access the graph data in different ways. 

//First we can access all of the vertices in the graph using the vertices() function of the VertexListGraph 

//interface. This function returns a std::pair of vertex iterators (the first iterator points to the "beginning" 

//of the vertices and the second iterator points "past the end"). Dereferencing a vertex iterator gives a 

//vertex object. The type of the vertex iterator is given by the graph_traits class. Note that different 

//graph classes can have different associated vertex iterator types, which is why we need the graph_traits class. 

//Given some graph type, the graph_traits class will provide access to the vertex_iterator type. 

//

//The following example prints out the index for each of the vertices in the graph. All vertex and edge properties, 

//including index, are accessed via property map objects. The property_map class is used to obtain the property map

//type for a specific property (specified by vertex_index_t, one of the BGL predefined properties) and function

//call get(vertex_index, g) returns the actual property map object.
 
 

	typedef property_map<TGraph, vertex_index_t>::type IndexMap;

    IndexMap index = get(vertex_index, g);
 

    std::cout << "vertices(g) = ";

    typedef graph_traits<TGraph>::vertex_iterator vertex_iter;

    std::pair<vertex_iter, vertex_iter> vp;

    for (vp = vertices(g); vp.first != vp.second; ++vp.first)

      std::cout << index[*vp.first] <<  " ";

    std::cout << std::endl;
 

//Accessing the Edge Set

//The set of edges for a graph can be accessed with the edges() function of the EdgeListGraph interface. 

//Similar to the vertices() function, this returns a pair of iterators, but in this case the iterators 

//are edge iterators. Dereferencing an edge iterator gives an edge object. The source() and target() 

//functions return the two vertices that are connected by the edge. Instead of explicitly creating a std::pair 

//for the iterators, this time we will use the tie() helper function. This handy function can be used to assign 

//the parts of a std::pair into two separate variables, in this case ei and ei_end. This is usually more convenient 

//than creating a std::pair and is our method of choice for the BGL.
 

    std::cout << "edges(g) = ";

    graph_traits<TGraph>::edge_iterator ei, ei_end;

    for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)

        std::cout << "(" << index[source(*ei, g)] 

                  << "," << index[target(*ei, g)] << ") ";

    std::cout << std::endl;
 

// ------------------------------------------------------------------------------------------------------------

//  The Adjacency Structure

//  will encapsulate this in an "exercise vertex" function, and apply it to each vertex in the graph. 

//  std::for_each(vertices(g).first, vertices(g).second, exercise_vertex<Graph>(g));
 
 

     std::for_each(vertices(g).first, vertices(g).second, exercise_vertex<TGraph>(g));
 
 

//Out-Edges, In-Edges, and Edge Descriptors

//The out-edges of a vertex are accessed with the out_edges() function of the IncidenceGraph interface. 

//The out_edges() function takes two arguments: the first argument is the vertex and the second is the 

//graph object. The function returns a pair of iterators which provide access to all of the out-edges 

//of a vertex (similar to how the vertices() function returned a pair of iterators). The iterators are 

//called out-edge iterators and dereferencing one of these iterators gives an edge descriptor object. 

//An edge descriptor plays the same kind of role as the vertex descriptor object, it is a "black box" 

//provided by the graph type. The following code snippet prints the source-target pairs for each out-edge 

//of vertex v. 

     

	 

	 std::for_each(vertices(g).first, vertices(g).second, exercise_vertex2<TGraph>(g));
 
 
 

//The in_edges() function of the BidirectionalGraph interface provides access to all the in-edges of a 

//vertex through in-edge iterators. The in_edges() function is only available for the adjacency_list if 

//bidirectionalS is supplied for the Directed template parameter. There is an extra cost in space when 

//bidirectionalS is specified instead of directedS. 
 
 
 

	  std::for_each(vertices(g).first, vertices(g).second, exercise_vertex3<TGraph>(g));

  
 
 
 

    //boost::property_map<Graph, vertex_index_t>::type 

    //    vertex_id = get(vertex_index, g);

    //boost::property_map<Graph, edge_weight_t>::type

    //    trans_delay = get(edge_weight, g);
 

    // std::map<std::string,std::string> graph_attr, vertex_attr, edge_attr;

    // graph_attr["size"] = "3,3";

    // graph_attr["rankdir"] = "LR";

    // graph_attr["ratio"] = "fill";

    // vertex_attr["shape"] = "circle";
 

    // boost::write_graphviz(std::cout, g, 

    //                    make_label_writer(name),

    //                    make_label_writer(trans_delay),

    //                    make_graph_attributes_writer(graph_attr,vertex_attr, 

    //                                                 edge_attr));
 

    

	  // vector for storing distance property

     

     typedef graph_traits < TGraph >::vertex_descriptor vertex_descriptor;

     typedef graph_traits < TGraph >::edge_descriptor edge_descriptor;
 

     std::vector<vertex_descriptor> p(num_vertices(g));

     std::vector<int> d(num_vertices(g));

     vertex_descriptor s = vertex(A, g);
 
 

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

//Adding Some Color to your Graph

//BGL attempts to be as flexible as possible in terms of accommodating how properties are attached to 

//a graph. For instance, a property 
 
 

  //// vector for storing distance property

  //std::vector<int> d;
 
 
 

  //typedef graph_traits<Graph>::vertex_descriptor Vertex;
 

  //// get the first vertex

  //Vertex s = *(vertices(g).first);

  // invoke variant 2 of Dijkstra's algorithm

  //dijkstra_shortest_paths(g, s, distance_map(&d[0]));
 

  //std::cout << "distances from start vertex:" << std::endl;

  //graph_traits<Graph>::vertex_iterator vi;

  //for(vi = vertices(g).first; vi != vertices(g).second; ++vi)

  //  std::cout << "distance(" << index(*vi) << ") = " 

  //            << d[*vi] << std::endl;

  //std::cout << std::endl;
 
 

	system ("pause");
 
 

    return 0;
 

}

Open in new window

0
Comment
Question by:BdLm
  • 9
  • 8
  • 7
  • +1
26 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 20341285
Um, any chance of getting the compiler error in English please? :)
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20341291
line 324-325 :
>>      std::vector<vertex_descriptor> p(num_vertices(g));
>>      std::vector<int> d(num_vertices(g));

Where and how is num_vertices defined ?


line 329 :
>>     dijkstra_shortest_paths(g, s, predecessor_map(&p[0]).distance_map(&d[0]));*/

Remove the */ at the end of this line.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20341294
num_vertices is not a function!

      const int num_vertices = N;
...
      std::vector<vertex_descriptor> p(num_vertices(g));
      std::vector<int> d(num_vertices(g));
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20341297
>> Um, any chance of getting the compiler error in English please? :)

My German is not perfect, but "Ausdruck ergibt keine Funktion, die 1 Argumente übernimmt" means that there's no function with that name taking one argument. "'*/' wurde außerhalb des Kommentars gefunden" means that a */ was found without starting a comment first. And "Syntaxfehler" means "syntax error".
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 30 total points
ID: 20341298
in this line:
    dijkstra_shortest_paths(g, s, predecessor_map(&p[0]).distance_map(&d[0]));*/
 remove the trailiing */
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20341302
All the clues are there in the (English) errors :)
main.cpp

main.cpp(324) : error C2064: term does not evaluate to a function taking 1 arguments

main.cpp(325) : error C2064: term does not evaluate to a function taking 1 arguments

main.cpp(329) : warning C4138: '*/' found outside of comment

main.cpp(329) : error C2059: syntax error : '/'

Open in new window

0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20341317
@jaime_olivares : you seem to have big delays lately heh.
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20341326
>> All the clues are there in the (English) errors :)

Close enough :)
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20341328
>> Close enough :)
Yes, very impressive -- I only speak 2 languages, English and bad English!
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20341350
yeah, this damn proxy!!!
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20341378
>> yeah, this damn proxy!!!
poxy?
0
 
LVL 8

Author Comment

by:BdLm
ID: 20342211
pls. have a look at the other code sample, this runs perfect with the critical lines

  //     ->>>     HERE IT RUNS PERFECT  !!!!!!!!!  


  std::vector<vertex_descriptor> p(num_vertices(g));
  std::vector<int> d(num_vertices(g));
  vertex_descriptor s = vertex(A, g);
// boost_shortestpath.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.

//

//=======================================================================

// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, 

//

// Distributed under the Boost Software License, Version 1.0. (See

// accompanying file LICENSE_1_0.txt or copy at

// http://www.boost.org/LICENSE_1_0.txt)

//=======================================================================

//

//  Home office  (eval. and debug)
 

#include "stdafx.h"
 
 

#include <iostream>

#include <fstream>
 

#include <boost/config.hpp>

#include <boost/graph/graph_traits.hpp>

#include <boost/graph/adjacency_list.hpp>

#include <boost/graph/dijkstra_shortest_paths.hpp>
 

using namespace boost;
 
 

int _tmain(int argc, _TCHAR* argv[])

{
 

  typedef adjacency_list < listS, vecS, directedS,

    no_property, property < edge_weight_t, int > > graph_t;

  typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor;

  typedef graph_traits < graph_t >::edge_descriptor edge_descriptor;

  typedef std::pair<int, int> Edge;
 
 

  std::cout <<  "version 0.001";
 

  const int num_nodes = 5;

  enum nodes { A, B, C, D, E };

  char name[] = "ABCDE";

  Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E),

    Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B)

  };

  int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };

  int num_arcs = sizeof(edge_array) / sizeof(Edge);

#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300

  graph_t g(num_nodes);

  property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);

  for (std::size_t j = 0; j < num_arcs; ++j) {

    edge_descriptor e; bool inserted;

    tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g);

    weightmap[e] = weights[j];

  }

#else

  graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);

  property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);

#endif
 

  //     ->>>     HERE IT RUNS PERFECT  !!!!!!!!!  
 
 

  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
 

  std::cout << "distances and parents:" << std::endl;

  graph_traits < graph_t >::vertex_iterator vi, vend;

  for (tie(vi, vend) = vertices(g); vi != vend; ++vi) {

    std::cout << "distance(" << name[*vi] << ") = " << d[*vi] << ", ";

    std::cout << "parent(" << name[*vi] << ") = " << name[p[*vi]] << std::

      endl;

  }

  std::cout << std::endl;
 

  std::ofstream dot_file("figs/dijkstra-eg.dot");
 

  dot_file << "digraph D {\n"

    << "  rankdir=LR\n"

    << "  size=\"4,3\"\n"

    << "  ratio=\"fill\"\n"

    << "  edge[style=\"bold\"]\n" << "  node[shape=\"circle\"]\n";
 

  graph_traits < graph_t >::edge_iterator ei, ei_end;

  for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) {

    graph_traits < graph_t >::edge_descriptor e = *ei;

    graph_traits < graph_t >::vertex_descriptor

      u = source(e, g), v = target(e, g);

    dot_file << name[u] << " -> " << name[v]

      << "[label=\"" << get(weightmap, e) << "\"";

    if (p[v] == u)

      dot_file << ", color=\"black\"";

    else

      dot_file << ", color=\"grey\"";

    dot_file << "]";

  }

  dot_file << "}";
 
 

  system("Pause");
 

  return EXIT_SUCCESS;
 

}

Open in new window

0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20342234
>>   //     ->>>     HERE IT RUNS PERFECT  !!!!!!!!!  

And ? What's the problem ?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 8

Author Comment

by:BdLm
ID: 20342261
I want to copy these few lines to my application, but here it fails,
I don't know why, everything seems tro be the same,
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20342276
Did you correct the mistakes that we pointed out ? Also check whether you're using the same includes. Where is num_vertices defined ?
0
 
LVL 8

Author Comment

by:BdLm
ID: 20342729

The commant bug is removed, I added also the same inclusde files,
stll the refused to compile a line like

     std::vector<int> d(100);
the number of arguemnts is not correct



  //  here comes the compiler fail position

     std::vector<vertex_descriptor> p(num_vertices(g));
     std::vector<int> d(num_vertices(g));
     vertex_descriptor s = vertex(A, g);
// boost_demo_v01.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.

// Add all the different sample codes from BOOST to one unique demo sample 

// Debug with help of 

// http://www.experts-exchange.com/Programming/Languages/CPP/Q_22979666.html
 

  #include "stdafx.h"

  #include <iostream>                  // for std::cout

  #include <utility>                   // for std::pair

  #include <algorithm>                 // for std::for_each

  #include <vector>

  #include <boost/graph/graph_traits.hpp>

  #include <boost/graph/adjacency_list.hpp>

  #include <boost/graph/dijkstra_shortest_paths.hpp>

  #include <boost/graph/graphviz.hpp>

  #include <boost/config.hpp>
 
 
 
 
 

 

 

 
 
 
 

  using namespace boost;
 
 
 

  template <class Graph> struct exercise_vertex3 {

    exercise_vertex3(Graph& g_) : g(g_) { }

    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;

    void operator()(const Vertex& v) const

    {

         

      typename property_map<Graph, vertex_index_t>::type 

          index = get(vertex_index, g);

      typename graph_traits<Graph>::edge_descriptor e;
 

      std::cout << "in-edges: ";

      typedef typename graph_traits<Graph> GraphTraits;

      typename GraphTraits::in_edge_iterator in_i, in_end;

      for (tie(in_i, in_end) = in_edges(v,g); 

           in_i != in_end; ++in_i) {

        e = *in_i;

        Vertex src = source(e, g), targ = target(e, g);

        std::cout << "(" << index[src] << "," << index[targ] << ") ";

      }

      std::cout << std::endl;

      //...

    }

    //...

	Graph& g;

  };
 
 
 

  template <class Graph> struct exercise_vertex2 {

    exercise_vertex2(Graph& g_) : g(g_) { }

    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;

    void operator()(const Vertex& v) const

    {

      typedef graph_traits<Graph> GraphTraits;

      typename property_map<Graph, vertex_index_t>::type 

        index = get(vertex_index, g);
 

      std::cout << "out-edges: ";

      typename GraphTraits::out_edge_iterator out_i, out_end;

      typename GraphTraits::edge_descriptor e;

      for (tie(out_i, out_end) = out_edges(v, g); 

           out_i != out_end; ++out_i) {

        e = *out_i;

        Vertex src = source(e, g), targ = target(e, g);

        std::cout << "(" << index[src] << "," 

                  << index[targ] << ") ";

      }

      std::cout << std::endl;

      //...

    }

    //...

	Graph& g;

  };
 
 
 
 

  template <class Graph> struct exercise_vertex {

  exercise_vertex(Graph& g_) : g(g_) { }

  typedef typename graph_traits<Graph>::vertex_descriptor Vertex;

  void operator()(const Vertex& v) const

  {

    using namespace boost;

    typename property_map<Graph, vertex_index_t>::type 

      vertex_id = get(vertex_index, g);

    std::cout << "vertex: " << get(vertex_id, v) << std::endl;
 

    // Write out the outgoing edges

    std::cout << "\tout-edges: ";

    typename graph_traits<Graph>::out_edge_iterator out_i, out_end;

    typename graph_traits<Graph>::edge_descriptor e;

    for (tie(out_i, out_end) = out_edges(v, g); 

         out_i != out_end; ++out_i)

    {

      e = *out_i;

      Vertex src = source(e, g), targ = target(e, g);

      std::cout << "(" << get(vertex_id, src)

                << "," << get(vertex_id, targ) << ") ";

    }

    std::cout << std::endl;
 

    // Write out the incoming edges    

    std::cout << "\tin-edges: ";

    typename graph_traits<Graph>::in_edge_iterator in_i, in_end;

    for (tie(in_i, in_end) = in_edges(v, g); in_i != in_end; ++in_i)

    {

      e = *in_i;

      Vertex src = source(e, g), targ = target(e, g);

      std::cout << "(" << get(vertex_id, src)

                << "," << get(vertex_id, targ) << ") ";

    }

    std::cout << std::endl;
 

    // Write out all adjacent vertices    

    std::cout << "\tadjacent vertices: ";

    typename graph_traits<Graph>::adjacency_iterator ai, ai_end;

    for (tie(ai,ai_end) = adjacent_vertices(v, g);  ai != ai_end; ++ai)

      std::cout << get(vertex_id, *ai) <<  " ";

    std::cout << std::endl;

  }

  Graph& g;

};
 
 
 

  
 

    
 
 
 
 
 
 
 
 
 
 
 
 

int _tmain(int argc, _TCHAR* argv[])

{
 

/*Constructing a Graph

In this example we will use the BGL adjacency_list class to demonstrate the main ideas in the 

BGL interface. The adjacency_list class provides a generalized version of the classic "adjacency list" 

data structure. The adjacency_list is a template class with six template parameters, though here we only fill 

in the first three parameters and use the defaults for the remaining three. The first two template arguments (

vecS, vecS) determine the data structure used to represent the out-edges for each vertex in the graph and 

the data structure used to represent the graph's vertex set (see section Choosing the Edgelist and VertexList 

for information about the tradeoffs of the different data structures). The third argument, bidirectionalS, 

selects a directed graph that provides access to both out and in-edges. The other options for the third 

argument are directedS which selects a directed graph with only out-edges, and undirectedS which selects 

an undirected graph. 
 

Once we have the graph type selected, we can create the graph in Figure 2 by declaring a graph object 

and filling in edges using the add_edge() function of the MutableGraph interface (which adjacency_list implements).

We use the array of pairs edge_array merely as a convenient way to explicitly create the edges for this example.*/ 
 
 
 
 

    // create a typedef for the Graph type

    

	

	typedef adjacency_list<vecS, vecS, bidirectionalS> TGraph;
 

    // typedef adjacency_list < listS, vecS, directedS, no_property, property < edge_weight_t, int > > TGraph;
 

   // typedef graph_traits < TGraph >::vertex_descriptor vertex_descriptor;

   // typedef graph_traits < TGraph >::edge_descriptor edge_descriptor;
 
 

    // Make convenient labels for the vertices

    enum { A, B, C, D, E, N };

    const int num_vertices = N;

    // int num_vertices;
 

    const char* name = "ABCDE";

    int  j;

	int  i;

    

	//   writing out the edges in the graph

	//   for dynamic arrays use the vector og edges ....

    typedef std::pair<int, int> TEdge;

    typedef std::vector <TEdge> TEdge_array; 

	typedef std::vector<int> TWeights;
 

    TWeights  Weights;

	TEdge  OneEdge;

	TEdge_array Edge_array;

    TEdge edge_array2[] = 

    { TEdge(A,B), TEdge(A,D), TEdge(C,A), TEdge(D,C),

      TEdge(C,E), TEdge(B,D), TEdge(D,E),TEdge(5,5),TEdge(A,5), TEdge(C,7), TEdge(B,7), TEdge(D,8), TEdge(5,8), TEdge(9,5),

	  TEdge(13,E), TEdge(12,D), TEdge(16,E),TEdge(14,55),TEdge(31,5), TEdge(33,7), TEdge(33,31)};

    

    

	const int num_edges = sizeof(edge_array2)/sizeof(edge_array2[0]);
 

	

    std::cout <<  "  BOOST GRAPH DEMO PROGRAM                  \n";

    std::cout <<  "  Compile@01:00 Version 01.01.05  23-11-2007 \n\n";

	

	for (i=0; i<num_edges; i++) 

		{

	    Edge_array.push_back(edge_array2[i]);

		Weights.push_back((rand()%10)+1);

		}
 

	
 
 

    // declare a graph object

    //                        Graph g(num_vertices);  

	// 

    //  alternative sysntax : Graph G(edges + sizeof(edges) / sizeof(E), weights, num_nodes);
 

    TGraph g(num_edges);
 

    // add the edges to the graph object

    for (i = 0; i < num_edges; ++i)

	   {

        OneEdge = Edge_array[i];

		add_edge(OneEdge.first, OneEdge.second, g);

	   }

//Accessing the Vertex Set

//Now that we have created a graph, we can use the graph interface to access the graph data in different ways. 

//First we can access all of the vertices in the graph using the vertices() function of the VertexListGraph 

//interface. This function returns a std::pair of vertex iterators (the first iterator points to the "beginning" 

//of the vertices and the second iterator points "past the end"). Dereferencing a vertex iterator gives a 

//vertex object. The type of the vertex iterator is given by the graph_traits class. Note that different 

//graph classes can have different associated vertex iterator types, which is why we need the graph_traits class. 

//Given some graph type, the graph_traits class will provide access to the vertex_iterator type. 

//

//The following example prints out the index for each of the vertices in the graph. All vertex and edge properties, 

//including index, are accessed via property map objects. The property_map class is used to obtain the property map

//type for a specific property (specified by vertex_index_t, one of the BGL predefined properties) and function

//call get(vertex_index, g) returns the actual property map object.
 
 

	typedef property_map<TGraph, vertex_index_t>::type IndexMap;

    IndexMap index = get(vertex_index, g);
 

    std::cout << "vertices(g) = ";

    typedef graph_traits<TGraph>::vertex_iterator vertex_iter;

    std::pair<vertex_iter, vertex_iter> vp;

    for (vp = vertices(g); vp.first != vp.second; ++vp.first)

      std::cout << index[*vp.first] <<  " ";

    std::cout << std::endl;
 

//Accessing the Edge Set

//The set of edges for a graph can be accessed with the edges() function of the EdgeListGraph interface. 

//Similar to the vertices() function, this returns a pair of iterators, but in this case the iterators 

//are edge iterators. Dereferencing an edge iterator gives an edge object. The source() and target() 

//functions return the two vertices that are connected by the edge. Instead of explicitly creating a std::pair 

//for the iterators, this time we will use the tie() helper function. This handy function can be used to assign 

//the parts of a std::pair into two separate variables, in this case ei and ei_end. This is usually more convenient 

//than creating a std::pair and is our method of choice for the BGL.
 

    std::cout << "edges(g) = ";

    graph_traits<TGraph>::edge_iterator ei, ei_end;

    for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)

        std::cout << "(" << index[source(*ei, g)] 

                  << "," << index[target(*ei, g)] << ") ";

    std::cout << std::endl;
 

// ------------------------------------------------------------------------------------------------------------

//  The Adjacency Structure

//  will encapsulate this in an "exercise vertex" function, and apply it to each vertex in the graph. 

//  std::for_each(vertices(g).first, vertices(g).second, exercise_vertex<Graph>(g));
 
 

     std::for_each(vertices(g).first, vertices(g).second, exercise_vertex<TGraph>(g));
 
 

//Out-Edges, In-Edges, and Edge Descriptors

//The out-edges of a vertex are accessed with the out_edges() function of the IncidenceGraph interface. 

//The out_edges() function takes two arguments: the first argument is the vertex and the second is the 

//graph object. The function returns a pair of iterators which provide access to all of the out-edges 

//of a vertex (similar to how the vertices() function returned a pair of iterators). The iterators are 

//called out-edge iterators and dereferencing one of these iterators gives an edge descriptor object. 

//An edge descriptor plays the same kind of role as the vertex descriptor object, it is a "black box" 

//provided by the graph type. The following code snippet prints the source-target pairs for each out-edge 

//of vertex v. 

     

	 

	 std::for_each(vertices(g).first, vertices(g).second, exercise_vertex2<TGraph>(g));
 
 
 

//The in_edges() function of the BidirectionalGraph interface provides access to all the in-edges of a 

//vertex through in-edge iterators. The in_edges() function is only available for the adjacency_list if 

//bidirectionalS is supplied for the Directed template parameter. There is an extra cost in space when 

//bidirectionalS is specified instead of directedS. 
 
 
 

	  std::for_each(vertices(g).first, vertices(g).second, exercise_vertex3<TGraph>(g));

  
 
 
 

    //boost::property_map<Graph, vertex_index_t>::type 

    //    vertex_id = get(vertex_index, g);

    //boost::property_map<Graph, edge_weight_t>::type

    //    trans_delay = get(edge_weight, g);
 

    // std::map<std::string,std::string> graph_attr, vertex_attr, edge_attr;

    // graph_attr["size"] = "3,3";

    // graph_attr["rankdir"] = "LR";

    // graph_attr["ratio"] = "fill";

    // vertex_attr["shape"] = "circle";
 

    // boost::write_graphviz(std::cout, g, 

    //                    make_label_writer(name),

    //                    make_label_writer(trans_delay),

    //                    make_graph_attributes_writer(graph_attr,vertex_attr, 

    //                                                 edge_attr));
 

    

	  // vector for storing distance property

     

     typedef graph_traits < TGraph >::vertex_descriptor vertex_descriptor;

     typedef graph_traits < TGraph >::edge_descriptor edge_descriptor;
 

  //  here comes the compiler fail position 
 

     std::vector<vertex_descriptor> p(num_vertices(g));

     std::vector<int> d(num_vertices(g));

     vertex_descriptor s = vertex(A, g);
 
 

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

//Adding Some Color to your Graph

//BGL attempts to be as flexible as possible in terms of accommodating how properties are attached to 

//a graph. For instance, a property 
 
 

  //// vector for storing distance property

  //std::vector<int> d;
 
 
 

  //typedef graph_traits<Graph>::vertex_descriptor Vertex;
 

  //// get the first vertex

  //Vertex s = *(vertices(g).first);

  // invoke variant 2 of Dijkstra's algorithm

  //dijkstra_shortest_paths(g, s, distance_map(&d[0]));
 

  //std::cout << "distances from start vertex:" << std::endl;

  //graph_traits<Graph>::vertex_iterator vi;

  //for(vi = vertices(g).first; vi != vertices(g).second; ++vi)

  //  std::cout << "distance(" << index(*vi) << ") = " 

  //            << d[*vi] << std::endl;

  //std::cout << std::endl;
 
 

	system ("pause");
 
 

    return 0;
 

}

Open in new window

0
 
LVL 8

Author Comment

by:BdLm
ID: 20343108
here come a min. code skelleton, I can compile these lines, why fails my other code example ?   .-(
// boost_shortestpath.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.

//

//=======================================================================

// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, 

//

// Distributed under the Boost Software License, Version 1.0. (See

// accompanying file LICENSE_1_0.txt or copy at

// http://www.boost.org/LICENSE_1_0.txt)

//=======================================================================

//

//  Home office  (eval. and debug)
 

#include "stdafx.h"
 
 

#include <iostream>

#include <fstream>
 

#include <boost/config.hpp>

#include <boost/graph/graph_traits.hpp>

#include <boost/graph/adjacency_list.hpp>

#include <boost/graph/dijkstra_shortest_paths.hpp>
 

using namespace boost;
 
 

int _tmain(int argc, _TCHAR* argv[])

{
 
 

  // enum nodes { A, B, C, D, E };
 

  std::cout <<  "version 0.001";
 

  const int num_nodes = 5;
 

//  typedef adjacency_list < listS, vecS, directedS, no_property, property < edge_weight_t, int > > graph_t;
 

//  typedef adjacency_list<vecS, vecS, bidirectionalS> graph_t;
 

  typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor;

  typedef graph_traits < graph_t >::edge_descriptor edge_descriptor;  

  

  graph_t g(num_nodes);
 
 

  //     ->>>     HERE IT RUNS PERFECT  !!!!!!!!!  
 
 

  std::vector<vertex_descriptor> p(num_vertices(g));

  std::vector<int> d(num_vertices(g));

  vertex_descriptor s = vertex(0, g);
 
 
 

  
 

  system("Pause");
 

  return EXIT_SUCCESS;
 

}

Open in new window

0
 
LVL 40

Accepted Solution

by:
evilrix earned 60 total points
ID: 20345116
>> //  here comes the compiler fail position
>>
>>      std::vector<vertex_descriptor> p(num_vertices(g));
>>      std::vector<int> d(num_vertices(g));
>>      vertex_descriptor s = vertex(A, g);

That's because num_vertices is declared as an integer data type and not a function

186:     const int num_vertices = N;

I can't fix it for you because I have no idea what those 2 lines should be!
0
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 60 total points
ID: 20345612
>> 186:     const int num_vertices = N;

There you go ... why did you do that ?
0
 
LVL 8

Author Comment

by:BdLm
ID: 20346868

Hi,

I used the code, because It is a part of the examples. I'm trying to understand
the BOOST_GRAPH Lib, but still I have many trouble....

for num_vertices I found   somewhere in the file  BOOST_GRAPH_DETAIL_ADJACENCY_LIST_HPP

a defintion :

num_vertices(const adj_list_helper<Config, Base>& g_)
    {
      typedef typename Config::graph_type AdjList;
      const AdjList& g = static_cast<const AdjList&>(g_);
      return g.vertex_set().size();
    }


and


//===========================================================================
  // Functions required by the VertexListGraph concept

  template <typename G>
  std::pair<typename subgraph<G>::vertex_iterator,
            typename subgraph<G>::vertex_iterator>
  vertices(const subgraph<G>& g)
    { return vertices(g.m_graph); }

and in  the file   BOOST_SUBGRAPH_HPP
  template <typename G>
  typename subgraph<G>::vertices_size_type
  num_vertices(const subgraph<G>& g)
    { return num_vertices(g.m_graph); }
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20346928
Well, that implies you need to prefix the versions being use as function with boost::
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20346933
Sorry, to clarify, this will give them fully qualified names and avoid the ambiguity

boost::num_vertices(g); // Function in boost namespace
num_vertices = 10; // Variable in local namespace
0
 
LVL 8

Author Comment

by:BdLm
ID: 20346937
Update:
  with this new Line:

      // const int num_vertices = N;
      // int num_vertices;

I can compile the lines

       std::vector<vertex_descriptor> p(num_vertices(g));
     std::vector<int> d(num_vertices(g));

     vertex_descriptor s = vertex(AA, g);

but : // Compiler fails now  here ....

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

I attached the compiler meassage  (sounds ptretty chinease to me !!)
------ Erstellen gestartet: Projekt: boost_demo_v01, Konfiguration: Debug Win32 ------

Kompilieren...

boost_demo_v01.cpp
 

c:\programme\boost\boost_1_34_1\boost\graph\dijkstra_shortest_paths.hpp(121) : error C2664: 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const': Konvertierung des Parameters 1 von 'const boost::detail::error_property_not_found' in 'const D &' nicht möglich

        with

        [

            _Ty=D

        ]

        Ursache: Konvertierung von 'const boost::detail::error_property_not_found' in 'const D' nicht möglich

        Kein benutzerdefinierter Konvertierungsoperator verfügbar, der diese Konvertierung durchführen kann, oder der Operator kann nicht aufgerufen werden

        c:\programme\boost\boost_1_34_1\boost\graph\breadth_first_search.hpp(70): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::detail::dijkstra_bfs_visitor<UniformCostVisitor,UpdatableQueue,WeightMap,PredecessorMap,DistanceMap,BinaryFunction,BinaryPredicate>::examine_edge<boost::detail::edge_desc_impl<Directed,Vertex>,const IncidenceGraph>(Edge,Graph &)".

        with

        [

            UniformCostVisitor=boost::dijkstra_visitor<>,

            UpdatableQueue=MutableQueue,

            WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,

            PredecessorMap=__w64 unsigned int *__w64 ,

            DistanceMap=int *__w64 ,

            BinaryFunction=boost::closed_plus<D>,

            BinaryPredicate=std::less<D>,

            Directed=boost::bidirectional_tag,

            Vertex=__w64 unsigned int,

            IncidenceGraph=TGraph,

            Edge=boost::detail::edge_desc_impl<boost::bidirectional_tag,__w64 unsigned int>,

            Graph=TGraph

        ]

        c:\programme\boost\boost_1_34_1\boost\graph\dijkstra_shortest_paths.hpp(207): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::breadth_first_visit<VertexListGraph,MutableQueue,boost::detail::dijkstra_bfs_visitor<UniformCostVisitor,UpdatableQueue,WeightMap,PredecessorMap,DistanceMap,BinaryFunction,BinaryPredicate>,ColorMap>(const IncidenceGraph &,__w64 unsigned int,Buffer &,BFSVisitor,ColorMap)".

        with

        [

            VertexListGraph=TGraph,

            UniformCostVisitor=boost::dijkstra_visitor<>,

            UpdatableQueue=MutableQueue,

            WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,

            PredecessorMap=__w64 unsigned int *__w64 ,

            DistanceMap=int *__w64 ,

            BinaryFunction=boost::closed_plus<D>,

            BinaryPredicate=std::less<D>,

            ColorMap=boost::iterator_property_map<std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,boost::default_color_type,boost::default_color_type &>,

            IncidenceGraph=TGraph,

            Buffer=MutableQueue,

            BFSVisitor=boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>,MutableQueue,boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,__w64 unsigned int *__w64 ,int *__w64 ,boost::closed_plus<D>,std::less<D>>

        ]

        c:\programme\boost\boost_1_34_1\boost\graph\dijkstra_shortest_paths.hpp(258): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::dijkstra_shortest_paths_no_init<VertexListGraph,DijkstraVisitor,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistZero,ColorMap>(const VertexListGraph &,__w64 unsigned int,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistZero,DijkstraVisitor,ColorMap)".

        with

        [

            VertexListGraph=TGraph,

            DijkstraVisitor=boost::dijkstra_visitor<>,

            PredecessorMap=__w64 unsigned int *__w64 ,

            DistanceMap=int *__w64 ,

            WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,

            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,

            Compare=std::less<D>,

            Combine=boost::closed_plus<D>,

            DistZero=int,

            ColorMap=boost::iterator_property_map<std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,boost::default_color_type,boost::default_color_type &>

        ]

        c:\programme\boost\boost_1_34_1\boost\graph\dijkstra_shortest_paths.hpp(292): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::dijkstra_shortest_paths<VertexListGraph,boost::dijkstra_visitor<>,__w64 unsigned int*__w64 ,DistanceMap,WeightMap,IndexMap,std::less<_Ty>,boost::closed_plus<T>,int,int,ColorMap>(const VertexListGraph &,__w64 unsigned int,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistInf,DistZero,DijkstraVisitor,ColorMap)".

        with

        [

            VertexListGraph=TGraph,

            DistanceMap=int *__w64 ,

            WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,

            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,

            _Ty=D,

            T=D,

            ColorMap=boost::iterator_property_map<std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,boost::default_color_type,boost::default_color_type &>,

            PredecessorMap=__w64 unsigned int *__w64 ,

            Compare=std::less<D>,

            Combine=boost::closed_plus<D>,

            DistInf=int,

            DistZero=int,

            DijkstraVisitor=boost::dijkstra_visitor<>

        ]

        c:\programme\boost\boost_1_34_1\boost\graph\dijkstra_shortest_paths.hpp(322): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::detail::dijkstra_dispatch2<VertexListGraph,int*__w64 ,WeightMap,IndexMap,Params,boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>>(const VertexListGraph &,__w64 unsigned int,DistanceMap,WeightMap,IndexMap,const Params &,ColorMap)".

        with

        [

            VertexListGraph=TGraph,

            WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,

            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,

            Params=boost::bgl_named_params<int *__w64 ,boost::vertex_distance_t,boost::bgl_named_params<__w64 unsigned int *__w64 ,boost::vertex_predecessor_t,boost::no_property>>,

            RandomAccessIterator=std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,

            T=boost::default_color_type,

            R=boost::default_color_type &,

            DistanceMap=int *__w64 ,

            ColorMap=boost::iterator_property_map<std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,boost::default_color_type,boost::default_color_type &>

        ]

        c:\programme\boost\boost_1_34_1\boost\graph\dijkstra_shortest_paths.hpp(342): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::detail::dijkstra_dispatch1<VertexListGraph,int*__w64 ,boost::adj_list_edge_property_map<Directed,Value,Ref,Vertex,Property,Tag>,boost::vec_adj_list_vertex_id_map<boost::no_property,Vertex>,boost::bgl_named_params<T,boost::vertex_distance_t,Base>,boost::detail::error_property_not_found>(const VertexListGraph &,__w64 unsigned int,DistanceMap,WeightMap,IndexMap,const Params &,ColorMap)".

        with

        [

            VertexListGraph=TGraph,

            Directed=boost::bidirectional_tag,

            Value=boost::detail::error_property_not_found,

            Ref=const boost::detail::error_property_not_found &,

            Vertex=__w64 unsigned int,

            Property=const boost::no_property,

            Tag=boost::edge_weight_t,

            T=int *__w64 ,

            Base=boost::bgl_named_params<__w64 unsigned int *__w64 ,boost::vertex_predecessor_t,boost::no_property>,

            DistanceMap=int *__w64 ,

            WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,__w64 unsigned int,const boost::no_property,boost::edge_weight_t>,

            IndexMap=boost::vec_adj_list_vertex_id_map<boost::no_property,__w64 unsigned int>,

            Params=boost::bgl_named_params<int *__w64 ,boost::vertex_distance_t,boost::bgl_named_params<__w64 unsigned int *__w64 ,boost::vertex_predecessor_t,boost::no_property>>,

            ColorMap=boost::detail::error_property_not_found

        ]

        d:\07_privat\c++\boost_v01\boost_demo_v01\boost_demo_v01.cpp(337): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void boost::dijkstra_shortest_paths<TGraph,int*__w64 ,boost::vertex_distance_t,boost::bgl_named_params<T,Tag,Base>>(const VertexListGraph &,__w64 unsigned int,const boost::bgl_named_params<int *__w64 ,boost::vertex_distance_t,boost::bgl_named_params<T,Tag,Base>> &)".

        with

        [

            T=__w64 unsigned int *__w64 ,

            Tag=boost::vertex_predecessor_t,

            Base=boost::no_property,

            VertexListGraph=TGraph

        ]

Das Buildprotokoll wurde unter "file://d:\07_privat\c++\boost_v01\boost_demo_v01\Debug\BuildLog.htm" gespeichert.

boost_demo_v01 - 1 Fehler, 1 Warnung(en)

========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

Open in new window

0
 
LVL 40

Expert Comment

by:evilrix
ID: 20347011
Well, looking at the error and the prototype, I'm pretty sure the problem is that parameter 3 to the function call dijkstra_shortest_paths() is of the wrong type but I have no idea what is should be!
0
 
LVL 8

Author Comment

by:BdLm
ID: 20347037
0
 
LVL 8

Author Closing Comment

by:BdLm
ID: 31410724
answer helps to find the answer
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now