| | |
| | | #include "bond.h" |
| | | #include<stdio.h> |
| | | |
| | | ts_bool vertex_list_assign_id(ts_vertex_list *vlist, ts_uint id){ |
| | | ts_uint i; |
| | | for(i=0;i<vlist->n;i++){ |
| | | vlist->vtx[i]->id = id; |
| | | } |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | ts_vertex_list *init_vertex_list(ts_uint N){ |
| | | ts_int i; |
| | | ts_vertex_list *vlist=(ts_vertex_list *)malloc(sizeof(ts_vertex_list)); |
| | |
| | | } |
| | | |
| | | return vlist; |
| | | } |
| | | |
| | | |
| | | |
| | | ts_bool vertex_taint(ts_vertex *vtx, ts_uint level){ |
| | | if(level==0){ |
| | | vtx->locked++; |
| | | return TS_SUCCESS; |
| | | } |
| | | ts_uint i; |
| | | for(i=0; i<vtx->neigh_no; i++){ |
| | | vertex_taint(vtx->neigh[i], level-1); |
| | | } |
| | | vtx->locked++; |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | ts_bool vertex_untaint(ts_vertex *vtx, ts_uint level){ |
| | | if(level==0){ |
| | | vtx->locked--; |
| | | return TS_SUCCESS; |
| | | } |
| | | ts_uint i; |
| | | for(i=0; i<vtx->neigh_no; i++){ |
| | | vertex_untaint(vtx->neigh[i], level-1); |
| | | } |
| | | vtx->locked--; |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | inline ts_bool vertex_tainted(ts_vertex *vtx, ts_uint level, ts_uint amount){ |
| | | if(vtx->locked>amount) return 1; |
| | | else return 0; |
| | | } |