Graph rendering code can be messy. Sometimes we need viz-backend specific logic. It's also hard to test.
The suggestion is to add a AbstractDataType for hiding the details of graph rendering. All it needs is really a set of nodes, edges and node grouping for regions.
Such a class will also allow us to exercise graph rendering in tests. For instance, the sample implementation has a .verify() method to ensure the graph is wellformed; e.g. edges points to existing locations.
Graph rendering code can be messy. Sometimes we need viz-backend specific logic. It's also hard to test.
The suggestion is to add a AbstractDataType for hiding the details of graph rendering. All it needs is really a set of nodes, edges and node grouping for regions.
Sample implementation in: https://github.com/numba/numba/blob/edfc1b95bf633abb346fbbe265acf2bb20560a6e/numba/core/frontend2/regionrenderer.py#L56
Such a class will also allow us to exercise graph rendering in tests. For instance, the sample implementation has a
.verify()
method to ensure the graph is wellformed; e.g. edges points to existing locations.This ADT will allow backend specific code to be isolated: https://github.com/numba/numba/blob/edfc1b95bf633abb346fbbe265acf2bb20560a6e/numba/core/frontend2/regionrenderer.py#L127 Testing for this will be hard to automate but now it's contained in one place without mixing with other logic.