@startuml 

actor       oc_scheduler    as oc
participant graph           as graph

oc -> graph :   loadFrom(worflow_name)
activate graph
activate oc

graph --> oc:   Graph


group if g.Links size > 0

    oc -> graph:   generateArgo()
    graph -> graph:   create slice of end links (strings)

    loop link in links

        alt link is not a DC Link && destination id IS NOT a source id in any other link
            graph -> graph:   add link to list of endLinks
            note right : exemple\n If current link is A-->B\n we look for another link like C-->A
            end

        end
    

    graph -> graph : get list branches (end_lists, unvisited_links, current_branch)
    note left: unvisited links and current branch\n are nilfor the first entry

    loop link in endLinks


        graph -> graph : create a new list representing the current branch

        graph -> graph : copy Links id on a list

        graph -> graph : get list previous links

        group if len(previous_links) == 0 
            graph -> graph : add current list
        end

        loop for link in previous_links
            graph -> graph  :   add the link to the current branch 
            graph -> graph  :   remove current link from unvisited links list
            graph -> graph  :   get list branches (end_lists, unvisited_links, current_branch)
            note right: for each link we retrieve the branch that\nprecedes it recursively,\n so once we hit the end of a branch\n the entire branch is returned\n to the node where a split happened\nor that is its source
        end
    
    end
end
@enduml

créer une liste sans les liens composant - DC
// selectionner toutes les fins de branches :
    creer une liste d'identifiant
    pour chaque lien 
        si dst n'est pas source on ajoute l'id du lien a la liste

// recréer chaque branche
    pour chaque id de fin de branche
        copier les liens dans un nouvel objet
        declarer une variable pour controller s'il y'a encore un lien parent
        tant qu'il y'a un lien parent
            iterer dans la liste des liens 
            si un lien a en dst le même id que la source actuelle :
                afficher "{id_src} s'execute une fois que {id_dst_trouve} est fini"
                changer l'id de la source actuelle par celui de la source du lien trouvé
            sinon
                lien parent = faux