graph.c 356 B

1234567891011121314151617181920
  1. #include <igraph.h>
  2. #include "graph.h"
  3. graph_t* graph_init() {
  4. graph_t *g;
  5. g = calloc(1, sizeof(graph_t));
  6. g->graph = calloc(1, sizeof(igraph_t));
  7. g->initialised = 0;
  8. return g;
  9. }
  10. void graph_destroy(graph_t *g) {
  11. if(g->initialised) {
  12. igraph_destroy(g->graph);
  13. g->initialised = 0;
  14. }
  15. free(g);
  16. g = NULL;
  17. }