'How to create alternative graphs automatically?
Graphs are useful tools to represent some pipe of processes. For example, there are methods to create a graph according to the set of calculations. For example, compilers take instructions and converted them to a graph to optimize code size and speed. Is there any way to create alternative graphs by defining one of the possibilities?
I mean that the order of the process is not important sometimes. In this case, several graphs represent the same process in a different order. For example, the first graph is the same as the second graph.
DIV
/\
/ \
a \
\
MUL
/ \
/ \
/ \
MUL SHIFT
/\ /\
MUL b c d
/ \
e f
a/((e*f)*b*(c<<d))
DIV
/\
/ \
a \
\
MUL
/ \
/ \
/ \
MUL MUL
/\ /\
/ \ / \
e b f SHIFT
/ \
c d
a/((e*b)*(f*(c<<d)))
In these two graphs, processes are the same with different representations. Can I create all the possible graphs automatically by defining the rules for each process?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|