diff --git a/src/code_.py b/src/code_.py
index b7d256de9bd52e843725d8ffc647da0d5f14fdc1..cc2bc825c65d9c6d89e1cc94ad4e97350b7f202a 100644
--- a/src/code_.py
+++ b/src/code_.py
@@ -116,7 +116,7 @@ class Code:
                                     to_replace.append((all, new))
                                 elif(body==""):
                                     char, pos = get_next_element_caracter(temp_code, end_line)
-                                    if(char!="{"):
+                                    if(char!="{" and temp_code[pos:pos+3] not in ['"""', "'''"]):
                                         raise BioFlowInsightError(f"The condition '({extracted_condition}' was not extracted correctly. Make sure the condition follows the correct syntaxe.", type="Unable to extract condition")
                                     
                                 
diff --git a/src/graph.py b/src/graph.py
index 2fd13eca88c66faaf91fc7066b7b3a0847a956a0..18b5464f00bffb6020e5b001192087dd26d03765 100644
--- a/src/graph.py
+++ b/src/graph.py
@@ -200,20 +200,54 @@ class Graph():
                 node_2_processes[node] = list(set(temp))
 
  
-        links_added = []
-        def add_edges(dico):
+        #%2x%2x%2x
+        colours = ["#ffbe00", "#0055c8", "#6e6e00", "#a0006e", "#ff5a00", "#82dc73", "#ff82b4", "#d282be", "#d2d200", "#dc9600", "#6e491e", "#00643c", "#82c8e6", "#640082"]
+        links_added, links_added__with_conditions= [], []
+        def add_edges(dico, condition, checking_conditions, index = 0):
             for node in dico['nodes']:
                 edges = node_2_processes[node['id']]
                 for B in edges:
                     link = f"{node['id']} -> {B}"
-                    if(link not in links_added):
-                        dico['edges'].append({'A': node['id'], 'B': B, 'label': ''})
-                        links_added.append(link)   
+                    link_with_condition = f"{node['id']} -> {B} ({condition})"
+                    if(link_with_condition not in links_added__with_conditions):
+                        if(checking_conditions):
+                            p1, p2 = get_object(node['id']), get_object(B)
+                            conditions_p1, conditions_p2 = p1.get_call().get_block().get_all_conditions(conditions = {}), p2.get_call().get_block().get_all_conditions(conditions = {})
+                            for c1 in conditions_p1:
+                                #TODO -> need to check the condition in a smarter way
+                                if(c1.get_value()==condition):
+                                    #for c2 in conditions_p2:
+                                    #    if(c2.get_value()==condition):
+                                    if(link not in links_added):
+                                        dico['edges'].append({'A': node['id'], 'B': B, 'label': '', "colour": colours[index], "condition": condition})
+                                        links_added.append(link)
+                                        links_added.append(link_with_condition)
+                                    else:
+                                        checking_conditions = False
+                        else:
+                            if(link not in links_added):
+                                dico['edges'].append({'A': node['id'], 'B': B, 'label': ''})
+                                links_added.append(link) 
+                    
             for sub in dico['subworkflows']:
-                add_edges(dico["subworkflows"][sub]) 
+                add_edges(dico["subworkflows"][sub], condition, checking_conditions, index=index) 
+            return checking_conditions
             
-        
-        add_edges(dico)
+        if(self.workflow.get_duplicate_status()):
+            checking_conditions = True
+            most_influential_conditions = self.workflow.get_most_influential_conditions()
+            list_most_influential_conditions = list(most_influential_conditions.keys())
+            index = 0
+            while(checking_conditions and\
+                   index<len(list_most_influential_conditions) and \
+                    index<5):
+                condition = list_most_influential_conditions[index]
+                checking_conditions = add_edges(dico, condition, checking_conditions, index=index)
+                index+=1
+            add_edges(dico, condition="", checking_conditions=False)
+            
+        else:
+            add_edges(dico, condition="", checking_conditions=False)
 
 
         self.dico_process_dependency_graph = dico
diff --git a/src/outils_graph.py b/src/outils_graph.py
index 888512d3dba410fb49a8aaeccc403245bdd33f6e..6a243f70456a8d53aca8d100b1ca9a7664e055b9 100644
--- a/src/outils_graph.py
+++ b/src/outils_graph.py
@@ -48,10 +48,14 @@ def add_nodes(dot, dico, label_node = True):
 
 def add_edges(dot, dico, label_edge = True):
     for e in dico["edges"]:
+        try:
+            colour = e['colour']
+        except:
+            colour = "black"
         if(label_edge):
-            dot.edge(e['A'], e['B'], label= e['label'])
+            dot.edge(e['A'], e['B'], label= e['label'], color=colour)
         else:
-            dot.edge(e['A'], e['B'])
+            dot.edge(e['A'], e['B'], color=colour)
 
     for sub in dico["subworkflows"]:
         with dot.subgraph(name="cluster"+sub) as c:
@@ -139,11 +143,42 @@ def fill_dot_2(dot, dico, label_node = True, label_edge = True):
             fill_dot(c, dico["subworkflows"][sub], label_node, label_edge)
             c.attr(label=sub)
 
+def add_legend(dico, dot):
+
+    def get_all_conditions_rec(dico, conditions):
+        for e in dico["edges"]:
+            try:
+                con = e['condition']
+                colour = e['colour']
+                conditions[con] = colour
+            except:
+                None
+        for sub in dico["subworkflows"]:
+            get_all_conditions_rec(dico["subworkflows"][sub], conditions)
+    
+    def get_all_conditions(dico):
+        conditions = {}
+        get_all_conditions_rec(dico, conditions)
+        return conditions
+    conditions = get_all_conditions(dico)
+    if(len(conditions)!=0):
+        with dot.subgraph(name="cluster"+"_123424653") as c:
+            index = 0
+            for con in conditions:
+                c.node(f'{id(dot)}_{index}_0', style = 'invis')
+                c.node(f'{id(dot)}_{index}_1', style = 'invis')
+                c.edge(f'{id(dot)}_{index}_0', f'{id(dot)}_{index}_1', color=conditions[con], label=con)
+                index += 1
+            c.attr(label="Legend")
+
 def generate_pos_graph(filename, dico, relevant_nodes = -1, render_graphs = True):
     if(render_graphs):
         dot = graphviz.Digraph()
         dot.attr(rankdir='LR')
         fill_dot(dot, dico, False, False)
+        bool_add_legend = True
+        if(bool_add_legend):
+            add_legend(dico, dot)
         dot.format = 'dot'
         dot.render(filename=f'{filename}_pos')
         dot.render(filename=f'{filename}_pos', outfile=f'{filename}_pos.png')
@@ -159,6 +194,9 @@ def generate_graph_dot(filename, dico, label_node = True, label_edge = True, ren
     else:
         fill_dot(dot, dico, True, label_edge)
         #metro_dot(dot, dico, relevant_nodes = relevant_nodes)
+    bool_add_legend = False
+    if(bool_add_legend):
+        add_legend(dico, dot)
     dot.save(filename=f'{filename}.dot')
     #dot.format = 'dot'
     #dot.render(filename=f'{filename}_pos')