PDA

View Full Version : [C++] Problema Libreria Boost in_edges


macrig
12-04-2009, 17:26
Salve a tutti,
sto utlizzando la libreria bost per la costruzione di un grafo. Il problema che ho è il seguente:
devo ricavare gli archi a cui appartiene un vertice e sto utilizzando le funzioni out_edges e in_edges, la prima funziona benissimo, la seconda mi restituisce il seguente errore in fase di compilazione:
structure/mygraph.cpp:108: error: no matching function for call to ‘in_edges(void*&,Graph&)’

il codice è il seguente:
#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/config.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/property_map.hpp>
#include <boost/graph/adjacency_iterator.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/graph/iteration_macros.hpp>


using namespace boost;
using namespace std;

/* declare new edge properties: port-in, port-out */

enum edge_portout_t { edge_portout };
enum edge_portin_t { edge_portin };
enum vertex_site_t { vertex_site };
namespace boost {
BOOST_INSTALL_PROPERTY(edge, portout);
BOOST_INSTALL_PROPERTY(edge, portin);
BOOST_INSTALL_PROPERTY(vertex, site);
}

typedef property<edge_portin_t, string > Porti;
typedef property<edge_portout_t, string, Porti> Ports;
typedef property<edge_name_t, string, Ports> Edge_Name;

typedef property<vertex_site_t, string> Site;
//typedef property<vertex_name_t, string> Vertex_Name;

typedef adjacency_list<
listS, // Store out-edges of each vertex in a std::list
listS, // Store vertex set in a std::list
directedS, // The file dependency graph is directed

// vertex properties
property<vertex_name_t, string, Site >,
/* edge properties */
Edge_Name
//property<edge_name_t, string, Porto>
> Graph;


typedef property_map<Graph, edge_name_t>::type edge_map_t;
edge_map_t edge_map;

typedef graph_traits<Graph>::in_edge_iterator in_iter;
in_iter ii, ii_end;

/* FUNZIONE CHE RESTITUISCE L'ERRORE */
for( tie(ii, ii_end) = in_edges(add_vertex(Graph), Graph); ii != ii_end; ++ii)
{
cout << edge_map[*ii] << endl;
}



Spero di essere stato il più chiaro possibile nell'esposizione del problema e del codice.
Un grazie in anticipo a tutti.

Giuseppe Macrì