diff --git a/src/lib66/graph/deps-lib/deps b/src/lib66/graph/deps-lib/deps
index 2c2b233493d7e4b264ba95efb826b32d7e2bdff7..56b8909b483f10471945637d9cd3c5a0a0c1bf3f 100644
--- a/src/lib66/graph/deps-lib/deps
+++ b/src/lib66/graph/deps-lib/deps
@@ -1,11 +1,10 @@
-graph_add_deps.o
-graph_build_g.o
 graph_build_service.o
 graph_build_service_bytree.o
 graph_build_service_bytree_from_src.o
+graph_build_service_from_list.o
 graph_build_tree.o
+graph_compute_dependencies.o
 graph_remove_deps.o
-ss_resolve_graph.o
 -loblibs
 -lskarnet
 
diff --git a/src/lib66/graph/graph_add_deps.c b/src/lib66/graph/graph_add_deps.c
deleted file mode 100644
index ea34bb0fe74895fbfdad2717d5f4043a12d9f992..0000000000000000000000000000000000000000
--- a/src/lib66/graph/graph_add_deps.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * graph_add_deps.c
- *
- * Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org>
- *
- * All rights reserved.
- *
- * This file is part of Obarun. It is subject to the license terms in
- * the LICENSE file found in the top-level directory of this
- * distribution.
- * This file may not be copied, modified, propagated, or distributed
- * except according to the terms contained in the LICENSE file./
- */
-
-#include <stdint.h>
-
-#include <oblibs/graph.h>
-#include <oblibs/log.h>
-#include <oblibs/sastr.h>
-
-#include <skalibs/stralloc.h>
-
-int graph_add_deps(graph_t *g, char const *vertex, char const *edge, uint8_t requiredby)
-{
-    log_flow() ;
-
-    stralloc sa = STRALLOC_ZERO ;
-    int e = 0 ;
-    if (!sastr_clean_string(&sa, edge)) {
-        log_warnu("rebuild dependencies list") ;
-        goto freed ;
-    }
-
-    if (!requiredby) {
-
-        if (!graph_vertex_add_with_nedge(g, vertex, &sa)) {
-            log_warnu("add edges at vertex: ", vertex) ;
-            goto freed ;
-        }
-
-    } else {
-
-        if (!graph_vertex_add_with_nrequiredby(g, vertex, &sa)) {
-            log_warnu("add requiredby at vertex: ", vertex) ;
-            goto freed ;
-        }
-    }
-    e = 1 ;
-
-    freed:
-        stralloc_free(&sa) ;
-        return e ;
-}
diff --git a/src/lib66/graph/graph_build_g.c b/src/lib66/graph/graph_build_g.c
index 1a8a45e0096a185101c16de55e543642b72836ce..0cb486117c49bb0986ff8ad424e1eefee8c7b623 100644
--- a/src/lib66/graph/graph_build_g.c
+++ b/src/lib66/graph/graph_build_g.c
@@ -12,29 +12,23 @@
  * except according to the terms contained in the LICENSE file./
  */
 
-#include <stdint.h>
 
-#include <oblibs/graph.h>
 #include <oblibs/log.h>
 
 #include <66/service.h>
-#include <66/tree.h>
+#include <66/resolve.h>
 #include <66/graph.h>
+#include <66/ssexec.h>
 
-int graph_build_g(graph_t *g, char const *base, char const *treename, uint8_t data_type, uint8_t general)
+void graph_build_g(graph_t *graph, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info)
 {
     log_flow() ;
 
-    if (data_type == DATA_SERVICE) {
+    if (data_type == DATA_SERVICE)
 
-        if (!graph_build_service(g, base, treename, general))
-            return 0 ;
+        graph_build_service(graph, ares, areslen, info) ;
 
-    } else if (data_type == DATA_TREE) {
+    else if (data_type == DATA_TREE)
 
-        if (!graph_build_tree(g, base))
-            return 0 ;
-    }
-
-    return 1 ;
+        graph_build_tree(g, info->base.s) ;
 }
diff --git a/src/lib66/graph/graph_build_service.c b/src/lib66/graph/graph_build_service.c
index 92e67dca6d4b021f1eb4de73ff36cfbedd10a324..355478972ce9ac85fc145d92d6919c0af422604d 100644
--- a/src/lib66/graph/graph_build_service.c
+++ b/src/lib66/graph/graph_build_service.c
@@ -12,8 +12,8 @@
  * except according to the terms contained in the LICENSE file./
  */
 
-#include <stdint.h>
 #include <string.h>
+#include <stdint.h>
 
 #include <oblibs/log.h>
 #include <oblibs/string.h>
@@ -22,49 +22,24 @@
 #include <skalibs/stralloc.h>
 
 #include <66/constants.h>
-#include <66/tree.h>
-#include <66/resolve.h>
+#include <66/service.h>
 #include <66/graph.h>
+#include <66/state.h>
 
-/**
- * @general has only effect for DATA_SERVICE type
- * !general -> all services from @treename
- * general -> all services from all trees of the system
- *
- * */
-int graph_build_service(graph_t *g, char const *base, char const *treename, uint8_t general)
+void graph_build_service(graph_t *graph, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info, uint32_t flag)
 {
     log_flow() ;
 
-    int e = 0 ;
-    size_t pos = 0, baselen = strlen(base) ;
     stralloc sa = STRALLOC_ZERO ;
+    char const *exclude[1] = { 0 } ;
+    char solve[info->base.len + SS_SYSTEM_LEN + SS_RESOLVE_LEN + 1 + SS_SERVICE_LEN + 1] ;
 
-    char solve[baselen + SS_SYSTEM_LEN + 1 + SS_MAX_TREENAME + SS_SVDIRS_LEN + 1] ;
-
-    if (general) {
-
-        if (!resolve_get_field_tosa_g(&sa, base, treename, SS_MASTER + 1, DATA_TREE_MASTER, E_RESOLVE_TREE_MASTER_CONTENTS))
-            goto err ;
-
-        FOREACH_SASTR(&sa, pos) {
-
-            auto_strings(solve + baselen + SS_SYSTEM_LEN + 1, sa.s + pos, SS_SVDIRS) ;
-
-            if (!graph_build_service_bytree(g, solve, 2))
-                goto err ;
-        }
-
-    } else {
+    auto_strings(solve, info->base.s, SS_SYSTEM, SS_RESOLVE, "/", SS_SERVICE) ;
 
-        auto_strings(solve, base, SS_SYSTEM, "/", treename, SS_SVDIRS) ;
+    if (!sastr_dir_get_recursive(&sa, solve, exclude, S_IFREG, 0))
+        log_dieu(LOG_EXIT_SYS, "get resolve files") ;
 
-        if (!graph_build_service_bytree(g, solve, 2))
-                goto err ;
-    }
+    service_graph_g(sa.s, sa.len, graph, ares, areslen, info, flag) ;
 
-    e = 1 ;
-    err:
-        stralloc_free(&sa) ;
-        return e ;
+    stralloc_free(&sa) ;
 }
diff --git a/src/lib66/graph/graph_build_service_bytree.c b/src/lib66/graph/graph_build_service_bytree.c
index 27416390733e918575daa4687f7cea479cdd20dd..35bbb4e3db624d7fd409119200096520d5aa2a5e 100644
--- a/src/lib66/graph/graph_build_service_bytree.c
+++ b/src/lib66/graph/graph_build_service_bytree.c
@@ -27,12 +27,18 @@
 #include <66/service.h>
 #include <66/enum.h>
 #include <66/graph.h>
+#include <66/state.h>
 
+/*
+ *
+ * Need to be review entirely
+ *
+ * */
 /** @tree: absolute path of the tree including SS_SVDIRS
  * what = 0 -> classic
  * what = 1 -> atomic and bundle
  * what > 1 -> module */
-int graph_build_service_bytree(graph_t *g, char const *tree, uint8_t what)
+int graph_build_service_bytree(graph_t *g, char const *tree, uint8_t what, uint8_t is_supervised)
 {
     log_flow() ;
 
@@ -44,32 +50,46 @@ int graph_build_service_bytree(graph_t *g, char const *tree, uint8_t what)
     resolve_service_master_t mres = RESOLVE_SERVICE_MASTER_ZERO ;
     resolve_wrapper_t_ref mwres = resolve_set_struct(DATA_SERVICE_MASTER, &mres) ;
 
-    if (!resolve_read_g(mwres, tree, SS_MASTER + 1)) {
-        log_warnu("read resolve Master file of trees") ;
+    if (!resolve_read(mwres, tree, SS_MASTER + 1)) {
+        log_warnu("read resolve Master service file of tree: ", tree) ;
         goto err ;
     }
+    /**
+     *
+     *
+     * a revoir ici les checks en fonction des appels qui sont fait
+     * notamment par 66-inservice, 66-intree
+     *
+     *
+     *
+     * */
+    if (what == 2)
+        if (mres.ncontents)
+            if (!auto_stra(&sa, mres.sa.s + mres.contents))
+                goto err ;
 
-    if (mres.nclassic)
-        if (!auto_stra(&sa, mres.sa.s + mres.classic))
-            goto err ;
+    if (!what)
+        if (mres.nclassic)
+            if (!auto_stra(&sa, mres.sa.s + mres.classic))
+                goto err ;
 
-    if (mres.nmodule)
-        if (!auto_stra(&sa, mres.sa.s + mres.module))
-            goto err ;
+    if (what > 1)
+        if (mres.nmodule)
+            if (!auto_stra(&sa, mres.sa.s + mres.module))
+                goto err ;
 
-    if (mres.nbundle)
-        if (!auto_stra(&sa, mres.sa.s + mres.bundle))
-            goto err ;
+    if (what == 1) {
 
-    if (mres.nlongrun)
-        if (!auto_stra(&sa, mres.sa.s + mres.longrun))
-            goto err ;
+        if (mres.nbundle)
+            if (!auto_stra(&sa, mres.sa.s + mres.bundle))
+                goto err ;
 
-    if (mres.noneshot)
-        if (!auto_stra(&sa, mres.sa.s + mres.oneshot))
-            goto err ;
+        if (mres.noneshot)
+            if (!auto_stra(&sa, mres.sa.s + mres.oneshot))
+                goto err ;
+    }
 
-    if (!sastr_clean_string_g(&sa, sa.s))
+    if (!sastr_clean_string_flush_sa(&sa, sa.s))
         goto err ;
 
     FOREACH_SASTR(&sa, pos) {
@@ -79,6 +99,14 @@ int graph_build_service_bytree(graph_t *g, char const *tree, uint8_t what)
         if (!resolve_read(wres, tree, service))
             goto err ;
 
+        if (is_supervised) {
+
+            char atree[strlen(res.sa.s + res.treename) + 1] ;
+
+            if (!service_is_g(atree, service, STATE_FLAGS_ISSUPERVISED))
+                continue ;
+        }
+
         char *str = res.sa.s ;
 
         if (!graph_vertex_add(g, service)) {
@@ -86,29 +114,17 @@ int graph_build_service_bytree(graph_t *g, char const *tree, uint8_t what)
             goto err ;
         }
 
-        if (res.ndepends) {
+        if (res.dependencies.ndepends) {
 
-            if (res.type == TYPE_MODULE || res.type == TYPE_BUNDLE) {
-
-                uint32_t depends = res.type == TYPE_MODULE ? what > 1 ? res.contents : res.depends : res.depends ;
-
-                if (!graph_add_deps(g, service, str + depends, 0)) {
-                    log_warnu("add dependencies of service: ",service) ;
-                    goto err ;
-                }
-
-            } else {
-
-                if (!graph_add_deps(g, service,str + res.depends, 0)) {
-                    log_warnu("add dependencies of service: ",service) ;
-                    goto err ;
-                }
+            if (!graph_compute_dependencies(g, service,str + res.dependencies.depends, 0)) {
+                log_warnu("add dependencies of service: ",service) ;
+                goto err ;
             }
         }
 
-        if (res.nrequiredby) {
+        if (res.dependencies.nrequiredby) {
 
-            if (!graph_add_deps(g, service, str + res.requiredby, 1)) {
+            if (!graph_compute_dependencies(g, service, str + res.dependencies.requiredby, 1)) {
                 log_warnu("add requiredby of service: ", service) ;
                 goto err ;
             }
diff --git a/src/lib66/graph/graph_build_service_bytree_from_src.c b/src/lib66/graph/graph_build_service_bytree_from_src.c
index 1b86df23f6d4c407e8b7e06a3f212f06451646e5..2a9972f8cde52d6f8275b0e017dff2f0191d52b6 100644
--- a/src/lib66/graph/graph_build_service_bytree_from_src.c
+++ b/src/lib66/graph/graph_build_service_bytree_from_src.c
@@ -70,29 +70,17 @@ int graph_build_service_bytree_from_src(graph_t *g, char const *src, uint8_t wha
             goto err ;
         }
 
-        if (res.ndepends) {
+        if (res.dependencies.ndepends) {
 
-            if (res.type == TYPE_MODULE || res.type == TYPE_BUNDLE) {
-
-                uint32_t depends = res.type == TYPE_MODULE ? what > 1 ? res.contents : res.depends : res.depends ;
-
-                if (!graph_add_deps(g, service, str + depends, 0)) {
-                    log_warnu("add dependencies of service: ",service) ;
-                    goto err ;
-                }
-
-            } else {
-
-                if (!graph_add_deps(g, service,str + res.depends, 0)) {
-                    log_warnu("add dependencies of service: ",service) ;
-                    goto err ;
-                }
+            if (!graph_compute_dependencies(g, service,str + res.dependencies.depends, 0)) {
+                log_warnu("add dependencies of service: ",service) ;
+                goto err ;
             }
         }
 
-        if (res.nrequiredby) {
+        if (res.dependencies.nrequiredby) {
 
-            if (!graph_add_deps(g, service, str + res.requiredby, 1)) {
+            if (!graph_compute_dependencies(g, service, str + res.dependencies.requiredby, 1)) {
                 log_warnu("add requiredby of service: ", service) ;
                 goto err ;
             }
diff --git a/src/lib66/graph/graph_build_service_from_list.c b/src/lib66/graph/graph_build_service_from_list.c
new file mode 100644
index 0000000000000000000000000000000000000000..c9f65bee7fa747b0c92fdc6cc9a100535ae52e69
--- /dev/null
+++ b/src/lib66/graph/graph_build_service_from_list.c
@@ -0,0 +1,95 @@
+/*
+ * graph_build_service_from_list.c
+ *
+ * Copyright (c) 2018-2022 Eric Vidal <eric@obarun.org>
+ *
+ * All rights reserved.
+ *
+ * This file is part of Obarun. It is subject to the license terms in
+ * the LICENSE file found in the top-level directory of this
+ * distribution.
+ * This file may not be copied, modified, propagated, or distributed
+ * except according to the terms contained in the LICENSE file./
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <oblibs/log.h>
+#include <oblibs/string.h>
+#include <oblibs/graph.h>
+
+#include <skalibs/genalloc.h>
+
+#include <66/config.h>
+#include <66/graph.h>
+#include <66/service.h>
+#include <66/resolve.h>
+#include <66/constants.h>
+#include <66/state.h>
+
+int graph_build_service_from_list(char const *const *list, char const *base, graph_t *graph, resolve_service_t *ares, uint8_t requiredby)
+{
+    log_flow() ;
+
+
+    unsigned int areslen = 0, e = 0 ;
+    char atree[SS_MAX_TREENAME + 1] ;
+
+    for (; *list ; list++) {
+
+        int found = 0 ;
+        unsigned int pos = 0, ndeps = 0 ;
+        unsigned int  alist[graph->mlen] ;
+        char const *name = *list ;
+
+        resolve_service_t res = RESOLVE_SERVICE_ZERO ;
+        resolve_wrapper_t_ref wres = resolve_set_struct(DATA_SERVICE, &res) ;
+
+        graph_array_init_single(alist, graph->mlen) ;
+
+        resolve_service_t cp = RESOLVE_SERVICE_ZERO ;
+
+        if (!resolve_read_g(wres, base, name))
+            goto err ;
+
+        if (!service_resolve_copy(&cp, &res))
+            goto err ;
+
+        if (service_resolve_array_search(ares, areslen, name) < 0)
+            ares[areslen++] = cp ;
+
+        ndeps = graph_matrix_get_edge_g_list(alist, graph, name, requiredby, 1) ;
+        if (ndeps < 0)
+            goto err ;
+
+        for (; pos < ndeps ; pos++) {
+
+            char *name = graph->data.s + genalloc_s(graph_hash_t, &graph->hash)[alist[pos]].vertex ;
+
+            if (service_resolve_array_search(ares, areslen, name) < 0) {
+
+                resolve_service_t cp = RESOLVE_SERVICE_ZERO ;
+
+                found = service_is_g(atree, name, STATE_FLAGS_ISPARSED) ;
+                if (found <= 0)
+                    goto err ;
+
+                if (!resolve_read_g(wres, base, name))
+                    goto err ;
+
+                if (!service_resolve_copy(&cp, &res))
+                    goto err ;
+
+                ares[areslen++] = cp ;
+            }
+        }
+        resolve_free(wres) ;
+    }
+
+    e = areslen ;
+
+    err:
+
+        return e ;
+}
diff --git a/src/lib66/graph/graph_build_tree.c b/src/lib66/graph/graph_build_tree.c
index 43e2c86f556ca943301f1c102165b483466ef462..155069f525a3bd4f0e72031faac8c2af90543b6f 100644
--- a/src/lib66/graph/graph_build_tree.c
+++ b/src/lib66/graph/graph_build_tree.c
@@ -25,47 +25,49 @@
 #include <66/constants.h>
 #include <66/resolve.h>
 #include <66/tree.h>
+#include <66/graph.h>
 
-int graph_build_tree(graph_t *g, char const *base)
+void graph_build_tree(graph_t *g, char const *base)
 {
     log_flow() ;
 
-    int e = 0 ;
-    size_t baselen = strlen(base), pos = 0 ;
-    char solve[baselen + SS_SYSTEM_LEN + 1] ;
+    size_t pos = 0 ;
 
     stralloc sa = STRALLOC_ZERO ;
     resolve_tree_t tres = RESOLVE_TREE_ZERO ;
     resolve_wrapper_t_ref wres = resolve_set_struct(DATA_TREE, &tres) ;
 
-    if (!resolve_get_field_tosa_g(&sa, base, 0, SS_MASTER + 1, DATA_TREE_MASTER, TREE_ENUM_MASTER_CONTENTS))
-        goto err ;
-
-    auto_strings(solve, base, SS_SYSTEM) ;
+    if (!resolve_get_field_tosa_g(&sa, base, SS_MASTER + 1, DATA_TREE_MASTER, E_RESOLVE_TREE_MASTER_CONTENTS))
+        log_dieu(LOG_EXIT_SYS, "get resolve Master file of trees") ;
 
     FOREACH_SASTR(&sa, pos) {
 
         char *name = sa.s + pos ;
 
-        if (!resolve_read(wres, solve, name))
-            goto err ;
+        if (!resolve_read_g(wres, base, name))
+            log_dieu(LOG_EXIT_SYS, "read resolve file of: ", name) ;
 
         if (!graph_vertex_add(g, name))
-            goto err ;
+            log_dieu(LOG_EXIT_SYS, "add vertex of: ", name) ;
 
         if (tres.ndepends)
-            if (!graph_add_deps(g, name, tres.sa.s + tres.depends, 0))
-                goto err ;
+            if (!graph_compute_dependencies(g, name, tres.sa.s + tres.depends, 0))
+                log_dieu(LOG_EXIT_SYS, "compute dependencies of: ", name) ;
 
         if (tres.nrequiredby)
-            if (!graph_add_deps(g, name, tres.sa.s + tres.requiredby, 1))
-                goto err ;
+            if (!graph_compute_dependencies(g, name, tres.sa.s + tres.requiredby, 1))
+                log_dieu(LOG_EXIT_SYS, "compute requiredby of: ", name) ;
     }
 
-    e = 1 ;
+    if (!graph_matrix_build(g))
+        log_dieu(LOG_EXIT_SYS, "build the graph") ;
+
+    if (!graph_matrix_analyze_cycle(g))
+        log_dieu(LOG_EXIT_SYS, "found cycle") ;
+
+    if (!graph_matrix_sort(g))
+        log_dieu(LOG_EXIT_SYS, "sort the graph") ;
 
-    err:
-        resolve_free(wres) ;
-        stralloc_free(&sa) ;
-        return e ;
+    resolve_free(wres) ;
+    stralloc_free(&sa) ;
 }