int
main (const int argc, char *argv[])
{
  parse_args (argc, argv, &initial_graph_name, &action_stream_name,
              &batch_size, &nbatch);
  STATS_INIT ();

  load_graph_and_action_stream (initial_graph_name, &nv, &ne,
                                (int64_t **) & off, (int64_t **) & ind,
                                (int64_t **) & weight,
                                (int64_t **) & graphmem, action_stream_name,
                                &naction, (int64_t **) & action,
                                (int64_t **) & actionmem);

  print_initial_graph_stats (nv, ne, batch_size, nbatch, naction);
  BATCH_SIZE_CHECK ();

  int64_t *component_map = xmalloc (nv * sizeof (int64_t));

  /* Convert to STINGER */
  tic ();
  S = stinger_new ();
  stinger_set_initial_edges (S, nv, 0, off, ind, weight, NULL, NULL, 0);
  PRINT_STAT_DOUBLE ("time_stinger", toc ());
  fflush (stdout);

  tic ();
  int64_t num_comp_end =
    connected_components_stinger (S, nv, ne, component_map, NULL, NULL, NULL,
                                  NULL, NULL);
  PRINT_STAT_DOUBLE ("time_components_tree", toc ());
  PRINT_STAT_INT64 ("number_of_components", num_comp_end);

  stinger_free_all (S);
  free (graphmem);
  free (actionmem);
  STATS_END ();
}
Exemple #2
0
int
main (const int argc, char *argv[])
{
  parse_args (argc, argv, &initial_graph_name, &action_stream_name,
              &batch_size, &nbatch);
  STATS_INIT ();

  load_graph_and_action_stream (initial_graph_name, &nv, &ne,
                                (int64_t **) & off, (int64_t **) & ind,
                                (int64_t **) & weight,
                                (int64_t **) & graphmem, action_stream_name,
                                &naction, (int64_t **) & action,
                                (int64_t **) & actionmem);

  print_initial_graph_stats (nv, ne, batch_size, nbatch, naction);
  BATCH_SIZE_CHECK ();

  /* Convert to STINGER */
  tic ();
  S = stinger_new ();
  stinger_set_initial_edges (S, nv, 0, off, ind, weight, NULL, NULL, 0);
  PRINT_STAT_DOUBLE ("time_stinger", toc ());
  fflush (stdout);

  int64_t numSteps = 3;
  int64_t src_dest_pair[2] = { 124, 381 };

  tic ();
  int64_t size_intersect =
    st_conn_stinger (S, nv, ne, src_dest_pair, 1, numSteps);
  PRINT_STAT_DOUBLE ("time_st_conn_stinger", toc ());
  PRINT_STAT_INT64 ("size_intersect", size_intersect);

  stinger_free_all (S);
  free (graphmem);
  free (actionmem);
  STATS_END ();
}
stinger_return_t
binary_stream_init(stinger_t * S, stinger_workflow_t * wkflow, void ** workspace) {
  binary_stream_t * stream = binary_stream_from_void(S, workspace);

  snarf_graph (stream->init_file, &stream->nv, &stream->ne, &stream->off, &stream->ind, &stream->weight, &stream->graphmem);

  snarf_actions (stream->stream_file, &stream->naction, &stream->action, &stream->actionmem);

  stinger_set_initial_edges (S, stream->nv, 0, stream->off, stream->ind, stream->weight, NULL, NULL, 0);

  if(stream->naction < stream->nbatch * stream->batch_size) {			
    fprintf (stderr, "WARNING: not enough actions\n");	
    stream->nbatch = (stream->naction + stream->batch_size - 1) / stream->batch_size;		
  }								

  OMP("omp parallel for")
  for(uint64_t v = 0; v < stream->nv; v++) {
    stinger_vtype_set(S, v, 1);
  }

  free(stream->graphmem);

  return STINGER_SUCCESS;
}