Using Graphs to determine parallel order of execution for dependencies

Hello smart people, I have a list of operations which I want to parallelize the order. To do this, I’m using a graph of dependencies. However I’m stuck at what to do next.

I found a nice SO post that explains it well, however I’m having trouble converting the java code to Julia. I seem to be missing the removevertex part.

Here’s my code thus far cloned from the first SO article.

g = SimpleDiGraph(all_edges)

groups =
group =

for task in vertices(g)
x = indegree(g, task)

if x == 0 
    push!(group, task)
end

end

while true
push!(groups, group)
nextGroup =

for task in group
    for nextTask in all_neighbors(g, task)
        if indegree(g, nextTask) == 1
        push!(nextGroup, nextTask)
        end
    end

    removeVertex(g, task) #HMMMMM
end

group = nextGroup;

if length(group) == 0
    break
end

end

return groups

Might be what you are looking for

1 Like

Thanks - ’ Directed acyclic graph’ sounds familiar when I was researching this. I’ll check out that package.