I have a set of tasks of the following format:
class task{
{
int length;
int numdependencies;
int startTime;
int finishTime;
int dependencies[50];
}
I am given a file containing information about their ID, length to complete the task, number of dependent tasks, and those task IDs. for example,
0,43,2,2,4
1,19,0
2,36,2,1,3
3,49,0
4,29,0
task 2 and 4 depend on 0 to complete. Tasks 1 and 3 depend on 2 to complete. nothing depends on tasks 1,3, and 4. In this case, 0 would be the initial task. My code converts this data to fill in the above class and creates a pointer to all tasks, task *list; list[2].numdependencies will contain the value 2 for the above data.
I need to develop a way to get the shortest path starting at an initial task to the rest of the tasks. I'd like to store that path in a form of an adjacency list so that I can quickly look through it to eventually find the critical path of the graph (the longest of the shortest path distances) and assign start and finish times to tasks along that path. I would appreciate suggestions or pseudocode. Thanks in advance
Aucun commentaire:
Enregistrer un commentaire