Replace old network diagram generation code with new cleaner approach
Add unit tests for diagram generation