formats.c 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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(igraph_t *g) {
  12. igraph_write_graph_graphml(g, ost);
  13. }
  14. void print_gml(igraph_t *g) {
  15. igraph_write_graph_gml(g, ost, 0, 0);
  16. }
  17. void print_pajek(igraph_t *g) {
  18. igraph_write_graph_pajek(g, ost);
  19. }
  20. void print_edgelist(igraph_t *g) {
  21. igraph_write_graph_edgelist(g, ost);
  22. }
  23. void print_ncol(igraph_t *g) {
  24. igraph_write_graph_ncol(g, ost, 0, 0);
  25. }
  26. void print_lgl(igraph_t *g) {
  27. igraph_write_graph_lgl(g, ost, 0, 0, 1);
  28. }
  29. void print_dot(igraph_t *g) {
  30. igraph_write_graph_dot(g, ost);
  31. }
  32. void print_error(igraph_t *g) {
  33. fprintf(ost, "Invalid output format specified.\n");
  34. }