Exemple #1
0
static uint8_t _merge(
  graph_t *gin, graph_t *gout, merge_set_t *mergesets, uint8_t nmergesets) {


  uint32_t *nodemap;
  uint32_t  ninnodes;
  uint32_t  noutnodes;

  nodemap = NULL;
  memset(gout, 0, sizeof(graph_t));

  ninnodes = graph_num_nodes(gin);

  nodemap = calloc(ninnodes, sizeof(uint32_t));
  if (nodemap == NULL) goto fail;

  if (_create_nodemap(
      gin, mergesets, nmergesets, nodemap, ninnodes, &noutnodes))
    goto fail;

  if (graph_create(gout, noutnodes, 0)) goto fail;

  if (_copy_edges(     gin, gout, nodemap, ninnodes)) goto fail;
  if (_copy_nodelabels(gin, gout, nodemap, ninnodes,
                       mergesets, nmergesets))        goto fail;

  free(nodemap);
  return 0;

fail:
  if (nodemap != NULL) free(nodemap);
  graph_free(gout);
  return 1;
}
Exemple #2
0
int main()
{
	srand(time(NULL));
	int NVERTEX = 100;
	struct Graph * g = undirected_graph_rand(NVERTEX);
	undirected_graph_print(g);

	printf("Random Delete Vertex:\n");
	// random delete vertex 
	int i;
	for(i=0;i<NVERTEX;i++) {
		int n = rand()%NVERTEX;	
		printf("delete: %d\n", n);
		undirected_graph_del_vertex(g,n);
	}

	undirected_graph_print(g);
	printf("Delete All Edges: \n");
	
	for(i=0;i<NVERTEX;i++) {
		int j;
		for(j=i+1;j<NVERTEX;j++) {
			undirected_graph_del_edge(g, i, j);
		}
	}

	undirected_graph_print(g);
	graph_free(g);
	return 0;
}
Exemple #3
0
CTEST2(graph, metis_part)
{
  for(idx_t i=0; i < data->ntensors; ++i) {
    sptensor_t * const tt = data->tensors[i];
    splatt_graph * graph = graph_convert(tt);

    idx_t mycut = 0;
    idx_t cut = 0;
    idx_t * parts = metis_part(graph, 8, &cut);

    /* now make sure cut actually matches */
    for(idx_t v=0; v < graph->nvtxs; ++v) {
      idx_t partA = parts[v];
      for(idx_t e=graph->eptr[v]; e < graph->eptr[v+1]; ++e) {
        idx_t partB = parts[graph->eind[e]];

        if(partA != partB) {
          if(graph->ewgts != NULL) {
            mycut += graph->ewgts[e];
          } else {
            ++mycut;
          }
        }
      }
    }
    /* / 2 because of undirected graph */
    ASSERT_EQUAL(cut, mycut / 2);

    splatt_free(parts);
    graph_free(graph);
  }
}
Exemple #4
0
uint8_t _partition_to_graph(
  node_partition_t *part, graph_t *g, graph_t *conn) {
  
  uint64_t  i; 
  uint32_t *group;
  uint32_t  groupsz;

  g->neighbours = NULL;

  if (graph_create(g, part->nnodes, 0)) goto fail;

  for (i = 0; i < part->nparts; i++) {

    group   = (uint32_t *)part->parts[i].data;
    groupsz = part->parts[i].size;

    if (conn == NULL) {
      if (graph_connect(g, group, groupsz))
        goto fail;
    }
    else {
      if (graph_connect_from(g, conn, group, groupsz))
        goto fail;
    }
  }

  return 0;

fail:
  if (g->neighbours != NULL) graph_free(g);
  return 1;
}
Exemple #5
0
int igraph_i_largest_weighted_cliques(const igraph_t *graph,
                    const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res)
{
    graph_t *g;
    igraph_integer_t vcount = igraph_vcount(graph);

    if (vcount == 0) {
        igraph_vector_ptr_clear(res);
        return IGRAPH_SUCCESS;
    }

    igraph_to_cliquer(graph, &g);
    IGRAPH_FINALLY(graph_free, g);

    IGRAPH_CHECK(set_weights(vertex_weights, g));

    igraph_vector_ptr_clear(res);
    igraph_cliquer_opt.user_data = res;
    igraph_cliquer_opt.user_function = &collect_cliques_callback;

    IGRAPH_FINALLY(free_clique_list, res);
    CLIQUER_INTERRUPTABLE(clique_find_all(g, 0, 0, FALSE, &igraph_cliquer_opt));
    IGRAPH_FINALLY_CLEAN(1);

    graph_free(g);
    IGRAPH_FINALLY_CLEAN(1);

    return IGRAPH_SUCCESS;
}
Exemple #6
0
int igraph_i_weighted_clique_number(const igraph_t *graph,
                    const igraph_vector_t *vertex_weights, igraph_real_t *res)
{
    graph_t *g;
    igraph_integer_t vcount = igraph_vcount(graph);

    if (vcount == 0) {
        *res = 0;
        return IGRAPH_SUCCESS;
    }

    igraph_to_cliquer(graph, &g);
    IGRAPH_FINALLY(graph_free, g);

    IGRAPH_CHECK(set_weights(vertex_weights, g));

    igraph_cliquer_opt.user_function = NULL;

    /* we are not using a callback function, thus this is not interruptable */
    *res = clique_max_weight(g, &igraph_cliquer_opt);

    graph_free(g);
    IGRAPH_FINALLY_CLEAN(1);

    return IGRAPH_SUCCESS;
}
Exemple #7
0
int igraph_i_cliquer_callback(const igraph_t *graph,
                    igraph_integer_t min_size, igraph_integer_t max_size,
                    igraph_clique_handler_t *cliquehandler_fn, void *arg)
{
    graph_t *g;
    struct callback_data cd;
    igraph_integer_t vcount = igraph_vcount(graph);

    if (vcount == 0)
        return IGRAPH_SUCCESS;

    if (min_size <= 0) min_size = 1;
    if (max_size <= 0) max_size = 0;

    if (max_size > 0 && max_size < min_size)
        IGRAPH_ERROR("max_size must not be smaller than min_size", IGRAPH_EINVAL);

    igraph_to_cliquer(graph, &g);
    IGRAPH_FINALLY(graph_free, g);

    cd.handler = cliquehandler_fn;
    cd.arg = arg;
    igraph_cliquer_opt.user_data = &cd;
    igraph_cliquer_opt.user_function = &callback_callback;

    CLIQUER_INTERRUPTABLE(clique_unweighted_find_all(g, min_size, max_size, /* maximal= */ FALSE, &igraph_cliquer_opt));

    graph_free(g);
    IGRAPH_FINALLY_CLEAN(1);

    return IGRAPH_SUCCESS;
}
Exemple #8
0
uint8_t ngdb_read(char *ngdbfile, graph_t *graph) {

  ngdb_t  *ngdb;
  uint32_t i;
  uint32_t nnodes;

  ngdb = NULL;

  memset(graph, 0, sizeof(graph_t));

  ngdb = ngdb_open(ngdbfile);
  if (ngdb == NULL) goto fail;

  nnodes = ngdb_num_nodes(ngdb);

  if (graph_create(graph, nnodes, 0)) goto fail;
  if (_read_hdr(ngdb, graph))         goto fail;
  for (i = 0; i < nnodes; i++) {
    if (_read_refs (ngdb, graph, i) != 0) goto fail;
    if (_read_label(ngdb, graph, i) != 0) goto fail;
  }

  ngdb_close(ngdb);

  return 0;
fail: 

  if (ngdb != NULL) ngdb_close(ngdb);
  graph_free(graph);

  return 1;
}
Exemple #9
0
int igraph_i_cliquer_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
                    igraph_integer_t min_size, igraph_integer_t max_size)
{
    graph_t *g;
    igraph_integer_t vcount = igraph_vcount(graph);

    if (vcount == 0) {
        igraph_vector_ptr_clear(res);
        return IGRAPH_SUCCESS;
    }

    if (min_size <= 0) min_size = 1;
    if (max_size <= 0) max_size = 0;

    if (max_size > 0 && max_size < min_size)
        IGRAPH_ERROR("max_size must not be smaller than min_size", IGRAPH_EINVAL);

    igraph_to_cliquer(graph, &g);
    IGRAPH_FINALLY(graph_free, g);

    igraph_vector_ptr_clear(res);
    igraph_cliquer_opt.user_data = res;
    igraph_cliquer_opt.user_function = &collect_cliques_callback;

    IGRAPH_FINALLY(free_clique_list, res);
    CLIQUER_INTERRUPTABLE(clique_unweighted_find_all(g, min_size, max_size, /* maximal= */ FALSE, &igraph_cliquer_opt));
    IGRAPH_FINALLY_CLEAN(1);

    graph_free(g);
    IGRAPH_FINALLY_CLEAN(1);

    return IGRAPH_SUCCESS;
}
Exemple #10
0
int main(int argc, char *argv[]) {

  struct argp argp = {options, _parse_opt, "INPUT", doc};
  args_t      args; 
  graph_t     g;

  memset(&args, 0, sizeof(args));

  startup("dumpngdb", argc, argv, &argp, &args);

  if (ngdb_read(args.input, &g)) {
    printf("error reading ngdb file %s\n", args.input);
    goto fail;
  }

  if (args.meta)   _meta(  &g);
  if (args.labels) _labels(&g);
  if (args.graph)  _graph( &g, args.weights, args.dists);

  graph_free(&g);
  return 0;
  
fail:
  return 1;
}
Exemple #11
0
uint8_t _mk_nlbl_map(char **inputs, uint16_t ninputs, nlbl_map_t *map) {

  uint32_t i;
  graph_t  g;

  if (array_create(&(map->labels),  sizeof(graph_label_t), 1000))    goto fail;
  if (array_create(&(map->nodeids), sizeof(array_t),       1000))    goto fail;
  if (array_create(&(map->sizes),   sizeof(uint32_t),      ninputs)) goto fail;
  if (array_create(&(map->idmap),   sizeof(array_t),       ninputs)) goto fail;

  array_set_cmps(&(map->labels), _compare_glbl, _compare_glbl_ins);

  for (i = 0; i < ninputs; i++) {

    if (ngdb_read(inputs[i], &g))              goto fail;
    if (_update_nlbl_map(&g, ninputs, i, map)) goto fail;
    graph_free(&g);
  }

  for (i = 0; i < ninputs; i++) {
    if (_mk_id_map(map, i)) goto fail;
  }

  return 0;
  
fail:
  return 1;
}
Exemple #12
0
void group_free(graph_s *g)
{
	for(int i =0;i< g->nodes; i++){
		free(((vtab_s *)g->node_list[i])->list);
		free(g->node_list[i]);
	}
	graph_free(g);
}
Exemple #13
0
void
network_free(Network *self)
{
    if (self->graph) {
        graph_free(self->graph);
    }
    g_free(self);
}
Exemple #14
0
// Decrement reference count, invoking graph_free if reference count
// drops to zero.
void
graph_unref (Graph *self)
{
  g_assert (self->reference_count >= 1);

  self->reference_count--;
  if ( self->reference_count == 0 ) {
    graph_free (self);
  }
}
Exemple #15
0
void graph_get_rec_crgg(graph *g, int vertices, double width, double r, double *x, double *y, well1024 *rng)
{
    graph_init(g, vertices);
    graph_get_rec_rgg(g, vertices, width, r, x, y, rng);

    while (graph_strongly_connected(g) == FALSE)
    {
        graph_free(g);
        graph_get_rec_rgg(g, vertices, width, r, x, y, rng);
    }
}
Exemple #16
0
int main(void) {
   
    int d = 0;
    int i = 0;
    int x = 0;
    graph my_graph = NULL;


    if (1 == scanf("%d", &d)) {
        my_graph = graph_new(d);
    }
    while (2 == scanf("%d%d", &i, &x)) {
        graph_add_edge(my_graph, i, x);
    }

    /*
    graph my_graph = graph_new(8);

    graph_bi_add_edge(my_graph, 0, 1);
    graph_bi_add_edge(my_graph, 0, 4);
    
    graph_bi_add_edge(my_graph, 1, 0);
    graph_bi_add_edge(my_graph, 1, 5);
    
    graph_bi_add_edge(my_graph, 2, 3);
    graph_bi_add_edge(my_graph, 2, 5);
    graph_bi_add_edge(my_graph, 2, 6);
    
    graph_bi_add_edge(my_graph, 3, 2);
    graph_bi_add_edge(my_graph, 3, 6);
    graph_bi_add_edge(my_graph, 3, 7);
    
    graph_bi_add_edge(my_graph, 4, 0);

    graph_bi_add_edge(my_graph, 5, 1);
    graph_bi_add_edge(my_graph, 5, 2);
    graph_bi_add_edge(my_graph, 5, 6);

    graph_bi_add_edge(my_graph, 6, 2);
    graph_bi_add_edge(my_graph, 6, 3);
    graph_bi_add_edge(my_graph, 6, 5);
    graph_bi_add_edge(my_graph, 6, 7);

    graph_bi_add_edge(my_graph, 7, 3);
    graph_bi_add_edge(my_graph, 7, 6);
    */
    
    graph_dfs(my_graph);
    graph_print(my_graph);
    graph_free(my_graph);
    return EXIT_SUCCESS;
}
Exemple #17
0
int powaur_crawl(alpm_list_t *targets)
{
    int ret = 0;
    char cwd[PATH_MAX];
    if (!getcwd(cwd, PATH_MAX)) {
        return error(PW_ERR_GETCWD);
    }

    if (chdir(powaur_dir)) {
        return error(PW_ERR_CHDIR, powaur_dir);
    }

    struct pw_hashdb *hashdb = build_hashdb();
    if (!hashdb) {
        pw_fprintf(PW_LOG_ERROR, stderr, "Unable to build hash database!\n");
        ret = -1;
    }

    alpm_list_t *i, *target_pkgs;
    struct graph *graph;
    struct stack *topost = stack_new(sizeof(int));
    int have_cycles;
    for (i = targets; i; i = i->next) {
        stack_reset(topost);
        graph = NULL;
        target_pkgs = alpm_list_add(NULL, i->data);
        build_dep_graph(&graph, hashdb, target_pkgs, RESOLVE_THOROUGH);
        if (have_cycles) {
            printf("Cyclic dependencies for package \"%s\"\n", i->data);
        }

        graph_toposort(graph, topost);
        if (stack_empty(topost)) {
            printf("Package \"%s\" has no dependencies.\n", i->data);
        } else {
            printf("\n");
            pw_printf(PW_LOG_INFO, "\"%s\" topological order: ", i->data);
            print_topo_order(graph, topost);
        }

        graph_free(graph);
        alpm_list_free(target_pkgs);
    }

    stack_free(topost);
    hashdb_free(hashdb);

    if (chdir(cwd)) {
        return error(PW_ERR_RESTORECWD);
    }
    return ret;
}
Exemple #18
0
void
sys_free(struct sys *sys)
{
	int i;

	for (i = 0; i < sys_get_frame_count(sys); i++)
		atoms_free(sys->frames[i].atoms);

	sel_free(sys->sel);
	sel_free(sys->visible);
	graph_free(sys->graph);
	free(sys->frames);
	free(sys);
}
Exemple #19
0
void game_free(game_t *game)
{
    graph_free(game->graph);
    
    mpq_clear(game->s);
    mpq_clear(game->t);
    mpq_clear(game->p_c);
    
    g_free(game->initial_config);
    g_free(game->current_config);
    g_free(game->next_config);
    
    g_free(game);
}
Exemple #20
0
END_TEST

int main() {

  g = graph_new();

  mu_run_test(test_add_nodes);
  mu_run_test(test_edge);

  graph_toNeato(g, "graph.dot");
  printf("Fichier .dot en sortie : graph.dot\n");
  graph_free(g);

  mu_summary();
  return __tests_failed;
}
Exemple #21
0
CTEST2(graph, graph_convert)
{
  for(idx_t i=0; i < data->ntensors; ++i) {
    sptensor_t * const tt = data->tensors[i];

    splatt_graph * graph = graph_convert(tt);

    /* count vtxs */
    vtx_t nv = 0;
    for(idx_t m=0; m < tt->nmodes; ++m) {
      nv += (vtx_t) tt->dims[m];
    }
    ASSERT_EQUAL(nv, graph->nvtxs);

    /* now write graph to tmp.txt and compare against good graph */
    FILE * fout = open_f(TMP_FILE, "w");
    graph_write_file(graph, fout);
    fclose(fout);

    FILE * fin = open_f(TMP_FILE, "r");
    FILE * gold = open_f(graphs[i], "r");

    /* check file lengths lengths */
    fseek(fin , 0 , SEEK_END);
    fseek(gold , 0 , SEEK_END);
    long length_fin  = ftell(fin);
    long length_gold = ftell(gold);
    ASSERT_EQUAL(length_gold, length_fin);
    rewind(fin);
    rewind(gold);

    /* compare each byte */
    char fbyte;
    char gbyte;
    for(long byte=0; byte < length_fin; ++byte) {
      fread(&fbyte, 1, 1, fin);
      fread(&gbyte, 1, 1, gold);
      ASSERT_EQUAL(gbyte, fbyte);
    }

    /* clean up */
    fclose(gold);
    fclose(fin);
    remove(TMP_FILE);
    graph_free(graph);
  }
}
Exemple #22
0
int igraph_i_weighted_cliques(const igraph_t *graph,
                    const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res,
                    igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal)
{
    graph_t *g;
    igraph_integer_t vcount = igraph_vcount(graph);

    if (vcount == 0) {
        igraph_vector_ptr_clear(res);
        return IGRAPH_SUCCESS;
    }

    if (min_weight != (int) min_weight) {
        IGRAPH_WARNING("Only integer vertex weights are supported; the minimum weight will be truncated to its integer part");
        min_weight  = (int) min_weight;
    }

    if (max_weight != (int) max_weight) {
        IGRAPH_WARNING("Only integer vertex weights are supported; the maximum weight will be truncated to its integer part");
        max_weight = (int) max_weight;
    }

    if (min_weight <= 0) min_weight = 1;
    if (max_weight <= 0) max_weight = 0;

    if (max_weight > 0 && max_weight < min_weight)
        IGRAPH_ERROR("max_weight must not be smaller than min_weight", IGRAPH_EINVAL);

    igraph_to_cliquer(graph, &g);
    IGRAPH_FINALLY(graph_free, g);   

    IGRAPH_CHECK(set_weights(vertex_weights, g));

    igraph_vector_ptr_clear(res);
    igraph_cliquer_opt.user_data = res;
    igraph_cliquer_opt.user_function = &collect_cliques_callback;

    IGRAPH_FINALLY(free_clique_list, res);
    CLIQUER_INTERRUPTABLE(clique_find_all(g, min_weight, max_weight, maximal, &igraph_cliquer_opt));
    IGRAPH_FINALLY_CLEAN(1);

    graph_free(g);
    IGRAPH_FINALLY_CLEAN(1);

    return IGRAPH_SUCCESS;
}
Exemple #23
0
static void run_service(struct cfg_main *cfg) {
    struct errbuf err;
    struct graph *g = graph_build(cfg, &err);
    if(!g) {
        fprintf(stderr, "topology: Not enough memory to build graph");
        exit(1);
    }
    if(!err.empty) {
        err_print(&err, stderr);
        if(err.fatal) {
            graph_free(g);
            exit(1);
        }
    }

    topologist_loop(cfg, g);
}
Exemple #24
0
/* befreiht das Koordinatensystem von allen Graphen */
void coord_system_clear(CoordSystem *coord)
{
    GList *graph;

    if (coord->graphs == NULL)
        return;

    graph = g_list_first(coord->graphs);

    while (graph != NULL) {
        graph_free(graph->data);
        graph = graph->next;
    }

    g_list_free(coord->graphs);
    coord->graphs = NULL;
}
Exemple #25
0
/*--------------------------------------------------------------------*/
void reorder_matrix(msieve_obj *obj, 
		    uint32 **rowperm, 
		    uint32 **colperm) {

	graph_t graph;
	heap_t heap;

	logprintf(obj, "permuting matrix for faster multiplies\n");

	graph_init(obj, &graph, &heap);

	do_partition(obj, &graph, &heap,
			graph.num_cols, 
			graph.num_cols + graph.num_rows - 1,
			0, 
			graph.num_cols - 1);

	graph_free(&graph, rowperm, colperm);
}
Exemple #26
0
int main(int argc, char** argv)
{
	 if (argc != 3) {
		  printf("please give the path of the graph and the num of threads.\n");
		  return -1;
	 }
	 graph_read_and_alloc(argv[1]);
	 
	 float time_used = bfs(atoi(argv[2]));

    
     
     calculate_counter();
     gen_level_log();
	 gen_test_log_cpu(time_used, argv[1], "conflict", atoi(argv[2]));

     graph_free();
	 return 0;
}
Exemple #27
0
int main(int argc, char *argv[]) {
    int v1;
    int v2;
    graph g;
    char option; 
    int size = 0;
    graph_t type = DIRECTED;
    const char *optstring = "s:";

    while((option = getopt(argc, argv, optstring)) != EOF) {
        switch(option) {
            case 's':
                size = atoi(optarg);
                break;
            default:
                printf("input the number of vertices\n");
                return EXIT_FAILURE;
        }
    }

    g = graph_new(size);
    while(2==scanf("%d%d", &v1, &v2)) {
        g = graph_add_edge(g, v1, v2, type);
    }
    /**
    g = graph_add_edge(g, 0, 1, type);
    g = graph_add_edge(g, 0, 4, type);
    g = graph_add_edge(g, 5, 1, type);
    g = graph_add_edge(g, 5, 2, type);
    g = graph_add_edge(g, 5, 6, type);
    g = graph_add_edge(g, 6, 2, type);
    g = graph_add_edge(g, 6, 3, type);
    g = graph_add_edge(g, 6, 7, type);
    g = graph_add_edge(g, 3, 2, type);
    g = graph_add_edge(g, 3, 7, type);
    */
    graph_print(g);
    graph_dfs(g);
    g = graph_free(g);
    return EXIT_SUCCESS;
}
Exemple #28
0
uint8_t _mk_avg_graph(
  char        **inputs,
  uint16_t      ninputs,
  graph_t      *gavg,
  nlbl_map_t   *map,
  edge_weight_t edgeweight) {

  uint64_t       i;
  uint32_t       nnodes;
  graph_label_t *lbl;
  array_t       *nodemap;
  graph_t        gin;

  nnodes = map->labels.size;

  if (graph_create(gavg, nnodes, 0)) goto fail;

  for (i = 0; i < nnodes; i++) {
    
    lbl = array_getd(&(map->labels), i);
    if (graph_set_nodelabel(gavg, i, lbl)) goto fail;
  }

  for (i = 0; i < ninputs; i++) {

    nodemap = array_getd(&(map->idmap), i);
    
    if (ngdb_read(inputs[i], &gin)) goto fail;

    if (_update_avg_graph(&gin, gavg, nodemap, edgeweight, ninputs))
      goto fail;
    graph_free(&gin);
  }

  return 0;

fail:
  return 1;
}
Exemple #29
0
int igraph_i_cliquer_histogram(const igraph_t *graph, igraph_vector_t *hist,
                        igraph_integer_t min_size, igraph_integer_t max_size)
{
    graph_t *g;
    int i;
    igraph_integer_t vcount = igraph_vcount(graph);

    if (vcount == 0) {
        igraph_vector_clear(hist);
        return IGRAPH_SUCCESS;
    }

    if (min_size <= 0) min_size = 1;
    if (max_size <= 0) max_size = vcount; /* also used for initial hist vector size, do not set to zero */

    if (max_size < min_size)
        IGRAPH_ERROR("max_size must not be smaller than min_size", IGRAPH_EINVAL);

    igraph_to_cliquer(graph, &g);
    IGRAPH_FINALLY(graph_free, g);

    igraph_vector_resize(hist, max_size);
    igraph_vector_null(hist);
    igraph_cliquer_opt.user_data = hist;
    igraph_cliquer_opt.user_function = &count_cliques_callback;

    CLIQUER_INTERRUPTABLE(clique_unweighted_find_all(g, min_size, max_size, /* maximal= */ FALSE, &igraph_cliquer_opt));

    for (i=max_size; i > 0; --i)
        if (VECTOR(*hist)[i-1] > 0)
            break;
    igraph_vector_resize(hist, i);
    igraph_vector_resize_min(hist);

    graph_free(g);
    IGRAPH_FINALLY_CLEAN(1);

    return IGRAPH_SUCCESS;
}
Exemple #30
0
int main() {
	int n, m, c, k;
	graph_t* g=NULL;
	int* color_freq=NULL;
	skipws(stdin);

	while (!feof(stdin)) {

		graph_read(&g, &color_freq, &n, &m, &k, &c);
		/* Print out what we just read in. */
		fprintf(stdout,
		        "parameters: n = %d, m = %d, c = %d, k = %d\n",
		        n, m, c, k);
		graph_print(g, color_freq, c);

		/* Release memory & consider next graph. */
		FREE(color_freq);
		graph_free(g);
		skipws(stdin);
	}

	return EXIT_SUCCESS;
}