tags:

views:

105

answers:

1

I'm trying to write a VB6 program (for a laugh) that will compute event times + the critical path JUST BASED ON A PRECEDENCE TABLE. I want my students to use it as a checking mechanism ie. to do everything without drawing the activity network. I'm happy that I can do all this once I've got start and finish events for each activity. How do I allocate events without drawing the network. Everything I come up with works for a specific example and then doesn't work for another one. I need a more general algorithm and it's driving me mental. Help!

I am not a professional programmer - I do this in my spare time to create teaching resources - simple English would really be appreciated.

+4  A: 
Charlie Martin
More or less. My problem is that a typical A level question has a table with multiple dependencies so that E depends on B, C and D (say) and then F depends on D and E (say). It's these multiple interconnections that are driving me crazy. I came across the idea of a topological sort today. I don't know much about it but is that the way to go? (I'm O.K. with avoiding cycles)
Yup, that would be it. The links should give you some help. Your graphs should be acyclic, because otherwise you'd have an activity that depends, eventually, on itself. Topo sort and transitive closure are really isomorphic; one is on matrices (the edge matrix) the other uses a graph model. Put some kind of sample data in the question and I'll help you sort of out. (heh) I don't know VB6 at *all* but I can give you some pseudocode that should help.
Charlie Martin
That's what I want really. I'm proud. I want to sort it myself but I need a hint. I'll show you what I'm trying to do tomorrow. In a way it's not the code that's bugging me it's the basic approach. I can (try) to to grind out the code myself. I'll check out some of the links you've suggested. Ta!
You won't have any trouble; therer are two or three good algorithms, and pseudocode in to topo sort wikipedia article I linked.(PS. You *could* upvote my answer, he hinted subtly.)
Charlie Martin
+1 - the subtle hinting would be worth +1 even if this were not an excellent answer
MarkJ
I'm just glad that worked as humor instead of rep-whoring.
Charlie Martin