You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cIGraph_attribute_handler.c 1.0 kB

19 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "igraph.h"
  2. #include "ruby.h"
  3. #include "cIGraph.h"
  4. igraph_attribute_table_t cIGraph_attribute_table;
  5. int cIGraph_add_edges_attr(igraph_t *graph, const igraph_vector_t *edges,
  6. igraph_vector_ptr_t *attr){
  7. return 0;
  8. }
  9. int cIGraph_get_numeric_edge_attr(const igraph_t *graph, const char *name,
  10. igraph_es_t es,
  11. igraph_vector_t *value){
  12. return 0;
  13. }
  14. int cIGraph_get_string_edge_attr(const igraph_t *graph, const char *name,
  15. igraph_es_t es,
  16. igraph_strvector_t *value){
  17. return 0;
  18. }
  19. VALUE cIGraph_get_edge_attr(VALUE self, VALUE from, VALUE to){
  20. VALUE eid;
  21. VALUE attr_hash;
  22. eid = cIGraph_get_eid(self, from, to, 1);
  23. attr_hash = rb_iv_get(self,"@edge_attrs");
  24. return rb_hash_aref(attr_hash,eid);
  25. }
  26. VALUE cIGraph_set_edge_attr(VALUE self, VALUE from, VALUE to, VALUE attr){
  27. VALUE eid;
  28. VALUE attr_hash;
  29. eid = cIGraph_get_eid(self, from, to, 1);
  30. attr_hash = rb_iv_get(self,"@edge_attrs");
  31. rb_hash_aset(attr_hash,eid,attr);
  32. return Qnil;
  33. }

Ruby binding for the igraph library.