Refactoring of the `diagrams` tool to abstract nodes and edges output