Index: tol_pkg/GisTools/_GisTools.tol
===================================================================
--- tol_pkg/GisTools/_GisTools.tol	(revision ea1b10f9bb52161bd0b5e2cd3188f654b8593bbd)
+++ tol_pkg/GisTools/_GisTools.tol	(revision e7af41b7eebdd99dc6bfd0af60af16a14d5ddecd)
@@ -6,7 +6,15 @@
 
 NameBlock GisTools = [[
+
+Text _.autodoc.description = "Functions and classes related with "
+"Geographic Information System (GIS), selection and classification methods "
+"over matricial data over massive geographical points.";
+
+Text _.autodoc.keywords = "GIS,Geographic,select,classify";
+
 //////////////////////////////////////////////////////////////////////////////
-//Selects rows of matrix M that are inside the hipercube whose side length is 
-//2*d and is centered in point given by row matrix P 
+Static Text _.autodoc.member.SelectRowsInHyperCube = "Selects rows of matrix "
+"M that are inside the hipercube whose side length is 2*d and is centered in "
+"point given by row matrix P ";
 Set SelectRowsInHyperCube(Matrix M, Matrix P, Real d)
 //////////////////////////////////////////////////////////////////////////////
@@ -24,6 +32,7 @@
 
 //////////////////////////////////////////////////////////////////////////////
-//Selects rows of matrix M_ that are inside the hipersphere with specified  
-//ratio and is centered in point given by row matrix P 
+Static Text _.autodoc.member.SelectRowsInHyperSphere = "Selects rows of "
+"matrix M that are inside the hipersphere with specified  ratio and is "
+"centered in point given by row matrix P";
 Set SelectRowsInHyperSphere(Matrix M, Matrix P, Real ratio)
 //////////////////////////////////////////////////////////////////////////////
@@ -39,4 +48,42 @@
   Matrix select = VMat2Triplet(Convert(match,"Cholmod.R.Triplet"));
   If(!Rows(select),Copy(Empty), MatSet(Tra(SubCol(select,[[1]])))[1])
+};
+
+//////////////////////////////////////////////////////////////////////////////
+Static Text _.autodoc.member.ClassifyColumnByRank = "Classifies a column "
+"matrix by the ranking position respect a set of R sortednumbers. The class "
+"of the i-th row will be assigned in this way:\n"
+" class[i] = 1   <=>                 M[i] < rankBound[1]\n"
+" class(i] = k+1 <=> rankBound[k] <= M[i] < rankBound[k+1]; k=1...R\n"
+" class[i] = R+1 <=> rankBound[R] <= M[i]\n";
+Matrix ClassifyColumnByRank(Matrix M, Set rankBound)
+//////////////////////////////////////////////////////////////////////////////
+{
+  Real m = Rows(M);
+  Real R = Card(rankBound);
+  Real min = 
+  {
+    Real aux = MatMin(M);
+    aux - Abs(aux) - 1
+  };
+  Real max = 
+  { 
+    Real aux = MatMax(M);
+    aux + Abs(aux) + 1
+  };
+  Set rnk = SetOfReal(min)<<rankBound<<SetOfReal(max);
+  VMatrix class = Zeros(m,1);
+  Real r = 1;
+  While(r<=R+1,
+  {
+    Matrix  left  = Rand(m,1,rnk[r  ],rnk[r  ]);
+    Matrix  right = Rand(m,1,rnk[r+1],rnk[r+1]);
+    VMatrix left.match = Mat2VMat(LE(left,M));
+    VMatrix right.match = Mat2VMat(LT(M,right));
+    VMatrix class := class + And(left.match,right.match)*r;
+    Real r := r+1
+  });
+  VMat2Mat(class)
 }
+
 ]];
Index: tol_pkg/GraphTools/_GraphTools.tol
===================================================================
--- tol_pkg/GraphTools/_GraphTools.tol	(revision ea1b10f9bb52161bd0b5e2cd3188f654b8593bbd)
+++ tol_pkg/GraphTools/_GraphTools.tol	(revision e7af41b7eebdd99dc6bfd0af60af16a14d5ddecd)
@@ -9,4 +9,10 @@
 //////////////////////////////////////////////////////////////////////////////
 [[
+
+Text _.autodoc.description = "Functions and classes related with "
+"Graph Theory.";
+
+Text _.autodoc.keywords = "Graph Theory,vertex,edge,adjacent";
+
 //////////////////////////////////////////////////////////////////////////////
 Text _.autodoc.member.Append.Indexed = "Adds and index a new element to a "
@@ -220,7 +226,7 @@
   VMatrix _.edge.map = Rand(0,0,0,0);
   VMatrix _.edge.adjacency = Rand(0,0,0,0);
-  VMatrix _.edge.rep = Rand(0,0,0,0);
-  Real _.edge.check.rep = ?;
-
+  VMatrix _.edge.repeated = Rand(0,0,0,0);
+  Real _.edge.check.repeated = ?;
+  Real _.edge.check.repaired = ?;
   ////////////////////////////////////////////////////////////////////////////
   Static Text _.autodoc.member.New = "Creates a new instance of "
@@ -255,5 +261,5 @@
   ////////////////////////////////////////////////////////////////////////////
   Text _.autodoc.member.edge.build = "";
-  Real edge.build(Matrix data)
+  Real edge.build(Matrix data, Real removeRepeatedEdges)
   ////////////////////////////////////////////////////////////////////////////
   {
@@ -264,23 +270,35 @@
     Matrix in   = If(_.directed, in_,  Max(in_, out_));
     Matrix _.edge::_.data := out | in | SubCol(data,Range(3,Columns(data),1));
-
     Matrix idx = DifEq(1/(1-B),Rand(_.edge.num,1,1,1));
     Matrix idx.rep = Rand(_.edge.num,1,1,1);
     Matrix outInRep = out|in|idx.rep;
     VMatrix triplet.rep = Triplet(outInRep,_.vertex.num,_.vertex.num);
-    VMatrix _.edge.rep := Convert(triplet.rep,"Cholmod.R.Sparse");
-    Real _.edge.check.rep := VMatMax(_.edge.rep)>1;
-    VMatrix triplet.map = If(!_.edge.check.rep,
+    VMatrix _.edge.repeated := Convert(triplet.rep,"Cholmod.R.Sparse");
+    VMatrix _.edge.adjacency := Or(_.edge.repeated, Zeros(_.vertex.num));
+    VMatrix _.edge.repeated := _.edge.repeated - _.edge.adjacency;
+    Real _.edge.check.repeated := VMatSum(_.edge.repeated);
+    Code funTriplet = Case(
+    !_.edge.check.repeated,
     {
-      VMatrix _.edge.adjacency := _.edge.rep;
-      Triplet(out|in|idx,_.vertex.num,_.vertex.num)
+      Real _.edge.check.repaired := 0;
+      Triplet
     },
+    removeRepeatedEdges,
     {
       WriteLn("[GraphTools::@Graph "+_.name+"::edge.build()] "+
-              "There are repeated edges","W");
-      VMatrix triplet.adj = TripletUnique(outInRep,_.vertex.num,_.vertex.num);
-      VMatrix _.edge.adjacency := Convert(triplet.adj,"Cholmod.R.Sparse");
-      TripletUnique(out|in|idx,_.vertex.num,_.vertex.num)
+              "There was "<<_.edge.check.repeated+
+              " repeated edges that has been removed","W");
+      Real _.edge.check.repaired := _.edge.check.repeated;
+      TripletUnique
+    },
+    1==1,
+    {
+      WriteLn("[GraphTools::@Graph "+_.name+"::edge.build()] "+
+              "There are "<<_.edge.check.repeated+" repeated edges "
+              "but they don't will be deleted","W");
+      Real _.edge.check.repaired := 0;
+      Triplet
     });
+    VMatrix triplet.map = funTriplet(out|in|idx,_.vertex.num,_.vertex.num);
     VMatrix _.edge.map := Convert(triplet.map,"Cholmod.R.Sparse");
     True
Index: tol_pkg/GraphTools/test/test_0001/define.random.graph.tol
===================================================================
--- tol_pkg/GraphTools/test/test_0001/define.random.graph.tol	(revision ea1b10f9bb52161bd0b5e2cd3188f654b8593bbd)
+++ tol_pkg/GraphTools/test/test_0001/define.random.graph.tol	(revision e7af41b7eebdd99dc6bfd0af60af16a14d5ddecd)
@@ -5,11 +5,21 @@
 
 //Random seed setting
-Real PutRandomSeed(0);
-Real rndSeed = GetRandomSeed(0);
+Real If(ObjectExist("Real","rndSeed"), 
+  PutRandomSeed(rndSeed),
+  PutRandomSeed(0));
+Real If(ObjectExist("Real","rndSeed"), rndSeed,
+ rndSeed = GetRandomSeed(0));
+
 WriteLn("Current Random Seed = "<<rndSeed);
 
-Real vertex.num = IntRand(2,1000);
-Real edge.num   = IntRand(1,(vertex.num)^1.6);
-Real directed   = IntRand(0,1);
+
+Real If(ObjectExist("Real","vertex.num"), vertex.num, 
+  vertex.num = IntRand(2,100) );
+Real If(ObjectExist("Real","edge.num"), edge.num, 
+  edge.num = IntRand(1,(vertex.num)^1.6) );
+Real If(ObjectExist("Real","directed"), directed, 
+ directed = IntRand(0,1) );
+Real If(ObjectExist("Real","removeRepeatedEdges"), removeRepeatedEdges, 
+ removeRepeatedEdges = IntRand(0,1) );
 
 WriteLn("Creating "+If(directed,"directed","symmetric")+
@@ -17,5 +27,4 @@
         edge.num+" edges ...");
 Real t0 = Copy(Time);
-
 
 GraphTools::@Graph graph = GraphTools::@Graph::New("test_0001",directed);
@@ -37,4 +46,7 @@
   { Hight  = Rand(edge.num, 1,  1,  10) };
 
-Real graph::edge.build(data);
+Real graph::edge.build(data,removeRepeatedEdges);
 
+Real t1 = Copy(Time);
+
+WriteLn("Creating time "<<(t1-t0)+" seconds");
Index: tol_pkg/GraphTools/test/test_0001/test.tol
===================================================================
--- tol_pkg/GraphTools/test/test_0001/test.tol	(revision ea1b10f9bb52161bd0b5e2cd3188f654b8593bbd)
+++ tol_pkg/GraphTools/test/test_0001/test.tol	(revision e7af41b7eebdd99dc6bfd0af60af16a14d5ddecd)
@@ -12,4 +12,6 @@
 Real numWar0 = Copy(NWarning);
 
+Real rndSeed = 0;
+Real removeRepeatedEdges = True;
 
 #Embed "../../_GraphTools.tol";
