473,480 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Porblem in Graph (object oriented) using Boost Graph Library

151 New Member
namespace ve/////////////////ve.h
{
struct VertexProperties
{
std::size_t index;
boost::default_color_type color;
};
}
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace ed///////////////////////ed.h
{
struct EdgeProperties
{
EdgeProperties(const std::string& n) : name(n) { }
std::string name;
};
}
////////////////////////////////////////////////////////////////////////////////////////////////////

#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map.hpp>
#include "ed.h"
#include "ve.h"
using namespace boost;
using namespace std;
class Construct
{
public:

void create_graph(int s1[],int s2[],int s3[])
{
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
const int V = 50;
Graph g(V);
property_map<Graph, std::size_t ve::VertexProperties::*>::type
id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type
name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
for (int i = 0; i <50 ; i++)
{
if(s3[i]==1){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("single bond"), g);
}
if(s3[i]==2){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("double bond"), g);
}
if(s3[i]==3){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("triple_bond"), g);
}
}
graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
}
};



int main(int , char* [])
{
Construct h;
int s1[]={1,1,2,2,3,3,4,4,5,5,6,6,6,7,7,7,8,8,8,8,9,9,10,1 0,11,11,12,12,13,14,17,19,19,19,20,20,20,21,21,21} ;
int s2[]={13,19,14,20,15,21,16,18,17,18,16,27,28,18,38,39, 9,10,22,23,11,12,16,17,14,24,13,25,15,15,26,29,30, 31,32,33,34,35,36,37};
int s3[]={1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2, 1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1};
h.create_graph(s1,s2,s3);
return 0;
}

This is program is working fine but i want to return the graph object in one function.
and need to pass the graph object in other function for printing the adjacency list
like ...
#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map.hpp>
#include "ed.h"
#include "ve.h"
using namespace boost;
using namespace std;
class Gra
{
public:
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
Graph& create_graph(int s1[],int s2[],int s3[])
{
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
const int V = 50;
Graph g(V);
property_map<Graph, std::size_t ve::VertexProperties::*>::type
id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type
name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
for (int i = 0; i <40 ; i++)
{
if(s3[i]==1){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("single bond"), g);
}
if(s3[i]==2){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("double bond"), g);
}
if(s3[i]==3){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("triple_bond"), g);
}
}
/*graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
* */
return g;
}
void get_edges(const Graph& g)
{
property_map<Graph, std::size_t ve::VertexProperties::*>::type id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
}


};



int main(int , char* [])
{
Gra h;
int s1[]={1,1,2,2,3,3,4,4,5,5,6,6,6,7,7,7,8,8,8,8,9,9,10,1 0,11,11,12,12,13,14,17,19,19,19,20,20,20,21,21,21} ;
int s2[]={13,19,14,20,15,21,16,18,17,18,16,27,28,18,38,39, 9,10,22,23,11,12,16,17,14,24,13,25,15,15,26,29,30, 31,32,33,34,35,36,37};
int s3[]={1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2, 1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1};
h.create_graph(s1,s2,s3);
h.get_edges(h.create_graph(s1,s2,s3));
return 0;
}
1.
It is giving the following error
create_graph1.cpp:57: error: conversion from ‘boost::bundle_property_map<const boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, const unsigned int>’ to non-scalar type ‘boost::bundle_property_map<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, unsigned int>’ requested
2.
create_graph1.cpp:58: error: conversion from ‘boost::bundle_property_map<const boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::detail::edge_desc_impl<boost::undirected_ta g, void*>, ed::EdgeProperties, const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’ to non-scalar type ‘boost::bundle_property_map<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::detail::edge_desc_impl<boost::undirected_ta g, void*>, ed::EdgeProperties, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’ requested

can you help me in doing this.I will be very thankful to you .
Mar 25 '08 #1
4 2522
weaknessforcats
9,208 Recognized Expert Moderator Expert
create_graph1.cpp:57: error:
Which line is line 57?
Mar 25 '08 #2
Man4ish
151 New Member
namespace ve/////////////////ve.h
{
struct VertexProperties
{
std::size_t index;
boost::default_color_type color;
};
}
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace ed///////////////////////ed.h
{
struct EdgeProperties
{
EdgeProperties(const std::string& n) : name(n) { }
std::string name;
};
}
////////////////////////////////////////////////////////////////////////////////////////////////////

#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map.hpp>
#include "ed.h"
#include "ve.h"
using namespace boost;
using namespace std;
class Construct
{
public:

void create_graph(int s1[],int s2[],int s3[])
{
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
const int V = 50;
Graph g(V);
property_map<Graph, std::size_t ve::VertexProperties::*>::type
id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type
name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
for (int i = 0; i <50 ; i++)
{
if(s3[i]==1){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("single bond"), g);
}
if(s3[i]==2){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("double bond"), g);
}
if(s3[i]==3){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("triple_bond"), g);
}
}
graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
}
};



int main(int , char* [])
{
Construct h;
int s1[]={1,1,2,2,3,3,4,4,5,5,6,6,6,7,7,7,8,8,8,8,9,9,10,1 0,11,11,12,12,13,14,17,19,19,19,20,20,20,21,21,21} ;
int s2[]={13,19,14,20,15,21,16,18,17,18,16,27,28,18,38,39, 9,10,22,23,11,12,16,17,14,24,13,25,15,15,26,29,30, 31,32,33,34,35,36,37};
int s3[]={1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2, 1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1};
h.create_graph(s1,s2,s3);
return 0;
}

This is program is working fine but i want to return the graph object in one function.
and need to pass the graph object in other function for printing the adjacency list
like ...
#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map.hpp>
#include "ed.h"
#include "ve.h"
using namespace boost;
using namespace std;
class Gra
{
public:
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
Graph& create_graph(int s1[],int s2[],int s3[])
{
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
const int V = 50;
Graph g(V);
property_map<Graph, std::size_t ve::VertexProperties::*>::type
id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type
name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
for (int i = 0; i <40 ; i++)
{
if(s3[i]==1){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("single bond"), g);
}
if(s3[i]==2){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("double bond"), g);
}
if(s3[i]==3){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("triple_bond"), g);
}
}
/*graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
* */
return g;
}
void get_edges(const Graph& g)
{
property_map<Graph, std::size_t ve::VertexProperties::*>::type id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
}


};



int main(int , char* [])
{
Gra h;
int s1[]={1,1,2,2,3,3,4,4,5,5,6,6,6,7,7,7,8,8,8,8,9,9,10,1 0,11,11,12,12,13,14,17,19,19,19,20,20,20,21,21,21} ;
int s2[]={13,19,14,20,15,21,16,18,17,18,16,27,28,18,38,39, 9,10,22,23,11,12,16,17,14,24,13,25,15,15,26,29,30, 31,32,33,34,35,36,37};
int s3[]={1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2, 1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1};
h.create_graph(s1,s2,s3);
h.get_edges(h.create_graph(s1,s2,s3));
return 0;
}
1.
It is giving the following error
create_graph1.cpp:57: error: conversion from ‘boost::bundle_property_map<const boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, const unsigned int>’ to non-scalar type ‘boost::bundle_property_map<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, unsigned int>’ requested
2.
create_graph1.cpp:58: error: conversion from ‘boost::bundle_property_map<const boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::detail::edge_desc_impl<boost::undirected_ta g, void*>, ed::EdgeProperties, const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’ to non-scalar type ‘boost::bundle_property_map<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::detail::edge_desc_impl<boost::undirected_ta g, void*>, ed::EdgeProperties, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’ requested

can you help me in doing this.I will be very thankful to you .

Actually i am trying to do object oriented programming , for that i need graph object to be returned by the function and i can pass that object to different boost graph functions like print edges,detect cycles,print vertices.
But I am facing the pblm in line 57 and 58(using two namespaces ,ve and ed in files ve.h and ed.h respectively).







Line No-57
property_map<Graph, std::size_t ve::VertexProperties::*>::type id = get(&ve::VertexProperties::index, g);

Line -58
property_map<Graph, std::string ed::EdgeProperties::*>::type name = get(&ed::EdgeProperties::name, g);
Mar 26 '08 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
The error on line 57 is using this:

‘boost::bundle_property_map<const boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, const unsigned int>’

And you are using:

‘boost::bundle_property_map<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, unsigned int>’ requested

Notice there is no const.

The errror occurs because a const cannot be converted to a non-const.

The compiler fears that a const adjacancy list used in a non-const manner will cause a crash should the list need to be updated. Same problem with the VertexProperties.

Maybe this will help.
Mar 26 '08 #4
Man4ish
151 New Member
The error on line 57 is using this:

‘boost::bundle_property_map<const boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, const unsigned int>’

And you are using:

‘boost::bundle_property_map<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, void*, ve::VertexProperties, unsigned int>’ requested

Notice there is no const.

The errror occurs because a const cannot be converted to a non-const.

The compiler fears that a const adjacancy list used in a non-const manner will cause a crash should the list need to be updated. Same problem with the VertexProperties.

Maybe this will help.



Thanks Sir,
That pblm is solved but still i facing the pblm in Graph object creation.
I have created Graph object without vertex and edge property.It is working fine.

#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/tuple/tuple.hpp>
#include <set>
using namespace std;
using namespace boost;
class hello
{
public:
typedef adjacency_list<> Graph;

Graph create_Graph(vector <int> s1,vector <int> s2,int count_vetices)
{
typedef adjacency_list <>Graph;
Graph g(count_vetices);
for (unsigned int i = 0; i < s1.size(); i++)
{
add_edge(s1[i], s2[i], g);
}
return g;
}

int no_of_elements(vector<int> v2,vector<int> v3)
{
vector<int> v4;
for (unsigned int i = 0; i < v2.size(); i++)
{
v4.push_back(v2[i]);
v4.push_back(v3[i]);
}
std::set< int, std::less< int > > doubleSet( v4.begin(), v4.end());;
return doubleSet.size();
}

void get_adjacencyList(const Graph&g)
{
int name[]={0,1,2,3,4,5,6,7,8,9};
graph_traits < adjacency_list <> >::vertex_iterator i, end;
graph_traits < adjacency_list <> >::adjacency_iterator ai, a_end;
property_map < adjacency_list <>, vertex_index_t >::type
index_map = get(vertex_index, g);

for (tie(i, end) = vertices(g); i != end; ++i)
{
std::cout << name[get(index_map, *i)];
tie(ai, a_end) = adjacent_vertices(*i, g);
if (ai == a_end)
std::cout << " no children";
else
std::cout << " is the parent of ";
for (; ai != a_end; ++ai)
{
std::cout << name[get(index_map, *ai)];
if (boost::next(ai) != a_end)
std::cout << ", ";
}
std::cout << std::endl;
}
}

};
int main()
{
using namespace boost;
hello h;
typedef adjacency_list <>Graph;
vector<int> s1,s2;
s1.push_back(1);
s1.push_back(2);
s1.push_back(3);
s1.push_back(4);
s1.push_back(5);
s1.push_back(6);
s2.push_back(7);
s2.push_back(8);
s2.push_back(4);
s2.push_back(1);
s2.push_back(9);
s2.push_back(5);
int n=h.no_of_elements(s1,s2);
cout<<"no of elements ="<< h.no_of_elements(s1,s2)<<endl;
Graph g = h.create_Graph(s1,s2,n);////////////////getting graph object
h.get_adjacencyList(g);
return EXIT_SUCCESS;
}

But when i am trying with vertex and edge property.


#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map.hpp>
#include "ed.h"
#include "ve.h"
using namespace boost;
using namespace std;
class Network
{
public:
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
Graph create_graph(int s1[],int s2[],int s3[])
{
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
const int V = 50;
Graph g(V);
property_map<Graph, std::size_t ve::VertexProperties::*>::type
id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type
name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
for (int i = 0; i <40 ; i++)
{
if(s3[i]==1){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("single bond"), g);
}
if(s3[i]==2)
{
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("double bond"), g);
}
if(s3[i]==3){
add_edge(vertex(s1[i], g), vertex(s2[i], g), ed::EdgeProperties("triple_bond"), g);
}
}
return g;
}

void get_edges( Graph g)
{
property_map<Graph, std::size_t ve::VertexProperties::*>::type id = get(&ve::VertexProperties::index, g);
property_map<Graph, std::string ed::EdgeProperties::*>::type name = get(&ed::EdgeProperties::name, g);
boost::graph_traits<Graph>::vertex_iterator vi, viend;
int vnum = 0;
for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
id[*vi] = vnum++;
graph_traits<Graph>::vertex_iterator i, end;
graph_traits<Graph>::out_edge_iterator ei, edge_end;
for (boost::tie(i,end) = vertices(g); i != end; ++i)
{
cout << id[*i] << " ";
for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
cout << endl;
}
print_edges(g, id);
}

};



int main(int , char* [])
{
Network h;
typedef adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties> Graph;
int s1[]={1,1,2,2,3,3,4,4,5,5,6,6,6,7,7,7,8,8,8,8,9,9,10,1 0,11,11,12,12,13,14,17,19,19,19,20,20,20,21,21,21} ;
int s2[]={13,19,14,20,15,21,16,18,17,18,16,27,28,18,38,39, 9,10,22,23,11,12,16,17,14,24,13,25,15,15,26,29,30, 31,32,33,34,35,36,37};
int s3[]={1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2, 1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1};
Graph obj= h.create_graph(s1,s2,s3);
h.get_edges(obj);
return 0;
}


/usr/include/boost/graph/detail/adjacency_list.hpp:986: instantiated from ‘std::pair<typename Config::edge_descriptor, bool> boost::add_edge(typename Config::vertex_descriptor, typename Config::vertex_descriptor, boost::undirected_graph_helper<C>&) [with Config = boost::detail::adj_list_gen<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::listS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, ve::VertexProperties, boost::no_property>, boost::property<boost::edge_bundle_t, ed::EdgeProperties, boost::no_property>, boost::no_property, boost::listS>::config]’

/usr/include/boost/graph/detail/adjacency_list.hpp:986: instantiated from ‘std::pair<typename Config::edge_descriptor, bool> boost::add_edge(typename Config::vertex_descriptor, typename Config::vertex_descriptor, boost::undirected_graph_helper<C>&) [with Config = boost::detail::adj_list_gen<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::listS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, ve::VertexProperties, boost::no_property>, boost::property<boost::edge_bundle_t, ed::EdgeProperties, boost::no_property>, boost::no_property, boost::listS>::config]’

/usr/include/boost/graph/detail/adjacency_list.hpp:1705: instantiated from ‘boost::adj_list_impl<Derived, Config, Base>::adj_list_impl(const boost::adj_list_impl<Derived, Config, Base>&) [with Derived = boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, Config = boost::detail::adj_list_gen<boost::adjacency_list< boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::listS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, ve::VertexProperties, boost::no_property>, boost::property<boost::edge_bundle_t, ed::EdgeProperties, boost::no_property>, boost::no_property, boost::listS>::config, Base = boost::undirected_graph_helper<boost::detail::adj_ list_gen<boost::adjacency_list<boost::vecS, boost::listS, boost::undirectedS, ve::VertexProperties, ed::EdgeProperties, boost::no_property, boost::listS>, boost::listS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, ve::VertexProperties, boost::no_property>, boost::property<boost::edge_bundle_t, ed::EdgeProperties, boost::no_property>, boost::no_property, boost::listS>::config>]’

/usr/include/boost/graph/adjacency_list.hpp:368: instantiated from ‘boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS>::adjacency_list(const boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS>&) [with OutEdgeListS = boost::vecS, VertexListS = boost::listS, DirectedS = boost::undirectedS, VertexProperty = ve::VertexProperties, EdgeProperty = ed::EdgeProperties, GraphProperty = boost::no_property, EdgeListS = boost::listS]’

create_object.cpp:43: instantiated from here
Please help me out of this pblm .I will be thankful to you.
Apr 1 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

25
3755
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.)...
0
1227
by: christopher diggins | last post by:
Greetings All, I have commenced work on the Object Oriented Template Library (OOTL) which is an open-source library which seeks to provide a more object-oriented alternative to the STL and...
2
2758
by: Christian Christmann | last post by:
Hi, I need to write a graph which provides at least the following functions: 1) stores nodes and edges (both store further information which can be of any type) 2) manipulations on nodes and...
8
2411
by: Jef Driesen | last post by:
I'm working on an image segmentation algorithm. An essential part of the algorithm is a graph to keep track of the connectivity between regions. At the moment I have a working implementation, but...
3
7810
by: Jef Driesen | last post by:
I'm trying to create a graph from an image, where pixel values are regions labels. I have defined my graph to use lists instead of the vectors (because I need to add/remove vertices and edges) and...
0
2101
by: Tim Frink | last post by:
Hi, I want to use the depth_first_search algorithm from the Boost Graph Library. However, I've problems with the definition of my own ColorMap. To illustrate this, here is an example (taken...
2
2287
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include...
1
1839
by: Man4ish | last post by:
I am creating a graph using boost library, I am making the network using create_Network function() i am adding the vertices to this graph by creating the object g of class Graph. I am trying to...
1
3138
by: rboorgapally | last post by:
Hi everyone, I am trying to run BFS on a graph that is created with input from a file. I am facing problems with the output though the code is compiling: #include <boost/graph/adjacency_list.hpp>...
0
7048
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7050
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7091
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6743
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6966
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
2999
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.