I want to improve the review algorithm of an addon that I wrote for anki for creating flash cards from concept maps. The addon asks questions following the structure of the concept map. This screenshot shows an example of a concept map that is supposed to be imported. The blue boxes contain hyperlinks, if they were grafically displayed, the map would look like this
Relationships between concepts serve as questions while concepts serve as answers. During review, the learner is supposed to answer questions on a higher level in the hierarchy first, followed by questions on lower levels in the hierarchy. Questions are only asked when they are due (which is determined by anki with a spaced retrieval algorithm).
Given the example map, a possible sequence of questions could be "investigates" --> "modulated by" --> "splits up" (if "example" is not due) --> "stands for" --> "completely unrelated animation". The algorithm used in the addon is very simple and takes pretty long when a question has many crosslinks to other questions. I figured it would be nice to internally represent the concept map as a graph during review and then use some algorithm to quickly find the next due question.
I found this post on representing graphs in python which sounds quite promising. I think I could represent the concept map with something similar. I stumbled across Dijkstra's algorithm that is supposed to solve shortest path problems but it doesn't solve my problem since my review order needs to prefer going downwards in the hierarchy over going upwards. For example, if the current question is "requires" and further down "pronounciation" is due, "pronounciation" has to be preferred over "modulated by" even though the path length to pronounciation is 3 and the path length to "modulated by" is only one.
How do I write an algorithm that always prefers going downwards and while doing so finds the closest due question in my concept map?