Algorithm to reset the toolchain graph display
As of today, we have toolchains that were created by hand. In that case, the toolchain editor cannot display the toolchain properly. There will be cases in the future as well, in which the user would like to reorganise a toolchain to its best possible representation. For those purposes, we need to implement an algorithm for finding the best graph given the toolchain and some constraints.
- A simple algorithm which would be better than stacking all blocks to the left as it is today:
- Put all databases, spaced to the left, one after the other
- All analyzers, spaced to the right
- All blocks equally randomly around the space left
- Use a more complex graph-theory algorithm. Searching for "topological graph sorting" in Python I did find some resources:
- http://code.activestate.com/recipes/578272-topological-sort/, for acyclic graphs.
- A package in Python that can do it: https://pypi.python.org/pypi/toposort/1.1
- Sorting cyclic graphs is apparently an NP-hard optimisation problem, so we should not try to solve it.