The problem that I'm trying to solve goes like this:
A project is split into tasks. Each task takes a known number of days. Some tasks can be done at any time(lets call these simple tasks), others depend on other tasks that must first be done. Design an algorithm that can find the minimum number of days necessary to finish the project.
I modeled each task as a node in a graph, and an edge from $x$ to $y$ means that task $y$ depends on task $x$. I also added a $0$ node. Edges go from $0$ to all of the free nodes.
I proceeded to implement Kruskal, with some modifications to deal with the task dependency problem. After banging my head against the keyboard for a while, I realized Kruskal doesn't work on directed graphs.
I did some reading and stumbled upon the topological sort, which seemed to be just what I needed for my problem. While topological sort itself is nice and simple, and I can easily find a topological sort of my graph, I can't figure out how to find the one of minimum cost(cost being number of days, of course).
An idea that just came to me is introducing another new node, call it $-1$. All other nodes have edges going to this one, of $0$ cost. This would be the finish node, and now the problem becomes finding the minimum path from $0$ to $-1$, that is also a topological sort.
Any hints are very much appreciated!