output.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include <igraph.h>
  2. #include "io.h"
  3. // From examples in igraph documentation.
  4. void print_vector(igraph_vector_t *v, FILE *f) {
  5. long int i;
  6. for (i=0; i<igraph_vector_size(v); i++) {
  7. fprintf(f, " %li", (long int) VECTOR(*v)[i]);
  8. }
  9. fprintf(f, "\n");
  10. }
  11. void print_graphml(graph_t *g) {
  12. if(g->initialised) {
  13. igraph_write_graph_graphml(g->graph, ost);
  14. }
  15. }
  16. void print_gml(graph_t *g) {
  17. if(g->initialised) {
  18. igraph_write_graph_gml(g->graph, ost, 0, 0);
  19. }
  20. }
  21. void print_pajek(graph_t *g) {
  22. if(g->initialised) {
  23. igraph_write_graph_pajek(g->graph, ost);
  24. }
  25. }
  26. void print_edgelist(graph_t *g) {
  27. if(g->initialised) {
  28. igraph_write_graph_edgelist(g->graph, ost);
  29. }
  30. }
  31. void print_ncol(graph_t *g) {
  32. if(g->initialised) {
  33. igraph_write_graph_ncol(g->graph, ost, 0, 0);
  34. }
  35. }
  36. void print_lgl(graph_t *g) {
  37. if(g->initialised) {
  38. igraph_write_graph_lgl(g->graph, ost, 0, 0, 1);
  39. }
  40. }
  41. void print_dot(graph_t *g) {
  42. if(g->initialised) {
  43. igraph_write_graph_dot(g->graph, ost);
  44. }
  45. }
  46. void print_error(graph_t *g) {
  47. fprintf(ost, "Invalid output format specified.\n");
  48. }