From c78004bcfacb0dc6399647027b3b1acc013db153 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sat, 23 Nov 2013 22:36:04 +0000
Subject: [PATCH] Think I found a bug. Fixed it kindof. But neigh of vtx are still buggy. Don't know why

---
 src/vertex.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/vertex.c b/src/vertex.c
index 38647aa..cd29e13 100644
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -311,3 +311,42 @@
 
     return vlist;
 }
+
+
+
+ts_bool vertex_taint(ts_vertex *vtx, ts_uint level){
+	ts_uint i;
+	vtx->locked++; //lock current vertex
+	if(level==0){ //if we reach last in recursion exit
+		return TS_SUCCESS;	
+	}	
+	for(i=0; i<vtx->neigh_no; i++){ //else recursive call self with decreased level
+		vertex_taint(vtx->neigh[i], level-1);
+	}
+	return TS_SUCCESS;
+}
+
+ts_bool vertex_untaint(ts_vertex *vtx, ts_uint level){
+		vtx->locked--;
+	if(level==0){
+		return TS_SUCCESS;	
+	}	
+	ts_uint i;
+	for(i=0; i<vtx->neigh_no; i++){
+		vertex_untaint(vtx->neigh[i], level-1);
+	}
+	return TS_SUCCESS;
+}
+
+inline ts_bool vertex_tainted(ts_vertex *vtx, ts_uint level, ts_uint amount){
+	if(vtx->locked>amount) return 1;
+	if(level==0){
+		return 0;
+	}
+	ts_uint i;
+	for(i=0; i<vtx->neigh_no;i++){
+		if(vertex_tainted(vtx->neigh[i], level-1, amount)) return 1;
+	}
+	
+	return 0;
+}

--
Gitblit v1.9.3