G
Goran
Hi all,
I'm trying to use boost::graph but I still don't have success.
I just want a simple tree with no multiple edges and vertexes. Further
no loops. E.g.:
0
/
1
/ \
3 5
\
8
\
4
Thanks for answering!
Here's my first attempt:
/////////////////////////////////
#include <boost/graph/adjacency_list.hpp>
class Page {
public:
Page(unsigned int aId);
virtual ~Page();
public:
unsigned int getId() const;
public:
bool operator<(const Page& rhs);
private:
unsigned int itsId;
};
Page:age(unsigned int aId):itsId(aId) {}
Page::~Page() {}
unsigned int Page::getId() const {return itsId;}
bool Page:perator<(const Page& rhs) {
if(itsId < rhs.getId())
return true;
else
return false;
}
int main() {
using namespace std;
using namespace boost;
typedef boost::adjacency_list<
setS,
setS,
directedS,
Page,
Page> Graph;
Graph graph;
Page page1(1);
Page page2(2);
Page page3(3);
add_edge(page1,page2,graph);
return 0;
}
I'm trying to use boost::graph but I still don't have success.
I just want a simple tree with no multiple edges and vertexes. Further
no loops. E.g.:
0
/
1
/ \
3 5
\
8
\
4
Thanks for answering!
Here's my first attempt:
/////////////////////////////////
#include <boost/graph/adjacency_list.hpp>
class Page {
public:
Page(unsigned int aId);
virtual ~Page();
public:
unsigned int getId() const;
public:
bool operator<(const Page& rhs);
private:
unsigned int itsId;
};
Page:age(unsigned int aId):itsId(aId) {}
Page::~Page() {}
unsigned int Page::getId() const {return itsId;}
bool Page:perator<(const Page& rhs) {
if(itsId < rhs.getId())
return true;
else
return false;
}
int main() {
using namespace std;
using namespace boost;
typedef boost::adjacency_list<
setS,
setS,
directedS,
Page,
Page> Graph;
Graph graph;
Page page1(1);
Page page2(2);
Page page3(3);
add_edge(page1,page2,graph);
return 0;
}