Boost logo

Boost Users :

Subject: Re: [Boost-users] Problems with MPI and PBGL
From: siva teja (chsivateja_at_[hidden])
Date: 2013-05-11 13:15:02


Hi,

Thanks for your reply, it worked.

I have to run distributed_delta_stepping with graphs in CSR fromat. So I
tried with "distributed_shortest_path_test.cpp" located at "<top of boost
source tree>/libs/graph_parallel/test/ ". It reads a random graph in
adjacency list format. But I have to run DIMACS_USA graph in CSR format.
So, I edited the code but it resulted in following errors. I guess I am
facing problems while representing a graph in CSR format..

CODE :

void test_distributed_shortest_paths(int n, double p, int c, int seed)
{

  char *graf = "./dimacs_USA_sort_wdup" ; // line no :169

  typedef compressed_sparse_row_graph<directedS, VertexProperties,
WeightedEdge,
                                      no_property,
distributedS<mpi_process_group>
> Graph;

  typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;
  typedef graph_traits<Graph>::edge_descriptor edge_descriptor;
  typedef graph_traits<Graph>::vertex_iterator vertex_iterator;
  typedef graph_traits<Graph>::vertices_size_type vertices_size_type;
  typedef property_map<Graph, vertex_index_t>::type vertex_index_map;

   typedef std::pair<long int, long int> Edge;
  struct timeval starttime,endtime,timediff;

    gettimeofday(&starttime,0x0);

    char ch;
    long int num_nodes;
    long int num_arcs;
    Edge *edge_array;
    long int *weights;

    long int arc_index=0, wt_index=0;
    long int vert1, vert2, dist;

        std::fstream input;
    input.open(graf);

    if( !input.eof())
    {
        input >> ch;
        if(ch == 'v')
        {
            input >> num_nodes;

        }
    }

    if(!input.eof())
    {
        input >> ch;
        if(ch =='e')
        {
            input >> num_arcs;

        }
        else
            std::cout << "Wrong graph format\n";
     }

    edge_array=(Edge *)malloc(sizeof(Edge) * num_arcs);
    weights=(long int *)malloc(sizeof(long int) * num_arcs);

    while(!input.eof())
    {

        input >> ch;
        if(ch == 'a')
         {
            input >> vert1 >> vert2 >> dist;
            Edge temp;
            temp.first=vert1;
            temp.second=vert2;

            edge_array[arc_index++]=temp;
            weights[wt_index++]=dist;
        }

    }

     gettimeofday(&endtime,0x0);

  Graph g(edges_are_unsorted_t, edge_array, edge_array + num_arcs,
num_nodes); //line no:267

  vertex_descriptor s = vertex(1, g); // line no:271

  graph::distributed::delta_stepping_shortest_paths(g,
                                                    s,
                                                    dummy_property_map(),

get(&VertexProperties::distance,
g), //line no :283

get(&WeightedEdge::weight, g)); // line no:284

}

ERRORS :

distributed_shortest_paths_test.cpp: In function ‘void
test_distributed_shortest_paths(int, double, int, int)’:
distributed_shortest_paths_test.cpp:169: warning: deprecated conversion
from string constant to ‘char*’
distributed_shortest_paths_test.cpp:267: error: ‘edge_array’ is not a type
distributed_shortest_paths_test.cpp:267: error: ‘edge_array’ is not a type
distributed_shortest_paths_test.cpp:267: error: expected ‘,’ or ‘...’
before ‘+’ token
distributed_shortest_paths_test.cpp:271: error: no matching function for
call to ‘vertex(int, test_distributed_shortest_paths(int, double, int,
int)::Graph (&)(boost::edges_are_unsorted_t, int, int))’
distributed_shortest_paths_test.cpp:283: error: no matching function for
call to ‘get(int VertexProperties::*, test_distributed_shortest_paths(int,
double, int, int)::Graph (&)(boost::edges_are_unsorted_t, int, int))’
distributed_shortest_paths_test.cpp:284: error: no matching function for
call to ‘get(weight_type WeightedEdge::*,
test_distributed_shortest_paths(int, double, int, int)::Graph
(&)(boost::edges_are_unsorted_t, int, int))’

Thank you in advance.

Regards,
Sivateja



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net