|
Boost : |
From: hankel_o_fung_at_[hidden]
Date: 2001-03-12 03:20:14
VC++ 6.0 SP5 seems unable to handle a moderately large graph.
Is it my mistake or VC++'s? Any workaround?
Hankel
#include <boost/graph/adjacency_list.hpp>
#include <iostream>
using namespace std;
using namespace boost;
typedef adjacency_list< listS, vecS, undirectedS,
no_property, property<edge_weight_t, double> > Graph;
int const N = 512;
int index(int i, int j) { return i*N + j; }
int main()
{
Graph G(N*N);
for (int i=0; i<N-1; ++i)
{
cout << i << flush;
for (int j=0; j<N; ++j)
{
int begin = (j-8 < 0 ? 0 : j-8);
int end = (j+8+1 > N ? N : j+8+1);
for (int k=begin; k<end; ++k)
put(edge_weight, G, add_edge(index(i,j), index(i+1,k),
G).first, 1.0);
// this is simplified -- in my original program G hasn't a
regular structure
}
cout << endl;
}
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk