diff --git a/test/coloring/p.ml b/test/coloring/p.ml
index 650ae823952ff7b97eb3b778d4ddea0214a17733..ae452c46c3ffb7d7d9a65f21e20e8594aabd7bbd 100644
--- a/test/coloring/p.ml
+++ b/test/coloring/p.ml
@@ -1,8 +1,11 @@
-(* Time-stamp: <modified the 02/09/2020 (at 10:37) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/07/2021 (at 14:48) by Erwan Jahier> *)
 (* This is algo 3.1 in the book *)
 
 open Algo
-let k=max_degree () + 1
+let k = if directed () then
+          failwith "this algo is for non-directed graphs!" card()+1
+        else
+          max_degree () + 1
 
 let (init_state: int -> string -> 'v) = fun i _ -> Random.int i