What I am Doing
I am making a course tree in graphviz. Each course is a node and prerequisites and corequisites are signified as edges between nodes.
What is working
The layout does a pretty good job of putting courses below their prerequisites
What is not working
I have put constraint='false'
on corequisites. However, I want corequisites to be on at least the same rank as each other (aka, corequisites should either point sideways and/or downwards).
Code
for course in data['CPEN']['courses']:
cpen.node(course['id'])
for course in data['CPEN']['courses']:
for pre in course['prerequisites']:
cpen.edge(pre, course['id'], color='Black')
for co in course['corequisites']:
cpen.edge(co, course['id'], color='Blue', constraint='false')
cpen.render(f'test-output/cpen_{time.time()}.gv', view=True)
Current Output
Math 101 as a corequisite of Math 152, so they should be on at least the same rank (not necessarily the same rank). However, the arrow is pointing up because the edge is not used in ranking due to no constraint.
Questions
How do I make a node be on the same or higher rank than another node
How do I set the rank of a node to a number? (How do I set a second year course to be at least rank 3?)