PHP Code to Generate Simple Flowchart

Posted by revbackup on Stack Overflow See other posts from Stack Overflow or by revbackup
Published on 2010-03-07T08:54:42Z Indexed on 2010/06/17 19:03 UTC
Read the original article Hit count: 283

Filed under:
|
|

I am making a flowchart out the subjects in the curriculum of our school.

a flowchart is generated through its preRequisite.... for example

FIRST YEAR FIRST SEMESTER
SUBJECTS ---- PREREQUISITE
MATH 1 ---- NONE
MATH 2 ---- NONE
ENGL 1 ---- NONE
SOCIO 1 ----- NONE
POLSCI 1 ----- NONE

FIRSTE YEAR SECOND SEMESTER
SUBJECTS ---- PREREQUISITE
MATH 3 ----- MATH 1
MATH 4 ----- MATH 2, MATH 1
ENGL 2 ----- ENGL 1
POLSCI 2 ----- POLSCI 1

So, I must print it this way, just using simple PHP but difficult Logic.:

MATH1 -----> MATH3
-----> MATH4
MATH 2 ----->MATH 4
ENGL1 -----> ENGL 2
SOCIO 1
POLSCI 1 -----> POLSCI 2

Can anyone give me a good algorithm for this, because this is really difficult. I am planning to echo the results in an HTML table, and it makes it more complicated.

Do you have suggestions how to solve this problem properly and display the results also properly????

Thank you in advance!

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript