Guidance on Implementing a Third-Party Network Topology Diagram in Node-RED Dashboard

I am working on integrating a third-party network topology visualization tool into the Node-RED dashboard dynamically. I’d appreciate guidance or recommendations on the following:

Native Support for Topology Visualizations:
Are there any libraries or nodes natively supported by Node-RED for visualizing network topologies?
If not, what are the best practices for embedding third-party libraries into the dashboard?

Dynamic Data Integration:
How can I dynamically fetch and update topology data in real-time using Node-RED flows?
What nodes (e.g., HTTP Request, WebSocket) work best for sending data to the visualization?

Third-Party Library Recommendations:
Any suggestions for libraries that integrate well with Node-RED
Examples of successful implementations using these or other libraries.

UI Template Configuration:
How to configure the Node-RED UI Template node to host and render the third-party topology tool?
Tips for managing dependencies like external CSS and JS files within the dashboard.

Performance and Responsiveness:
Best practices to ensure the topology visualization is responsive and performs well, especially for larger datasets.
How to handle resizing events and clean up DOM elements when switching tabs?

Event Handling and Interactivity:
Guidance on implementing interactive features like node selection, drag-and-drop, and live updates within the dashboard.

I would appreciate any advice, examples, or resources to help me achieve this. Your input will be incredibly valuable!
Thank you in advance!

mermaid supports an 'architecture' option, but this is only available in the latest 11.x version, node-red has native mermaid support, but it does not include the latest version.

I tried to include the cdn version with a markdown node (which supports mermaid), but it uses the internal version from node-red and I could not find a way to override it, as it is initialized based on the mermaid class name.

Long story short, with this flow, you can create dynamic mermaid architecture maps:

[{"id":"ac080e3433e4fcc9","type":"http in","z":"c8d44844ba5acdbd","name":"","url":"/network_map","method":"get","upload":false,"swaggerDoc":"","x":330,"y":4160,"wires":[["6756125209907198"]]},{"id":"49ac2f6d633dd7f8","type":"http response","z":"c8d44844ba5acdbd","name":"","statusCode":"","headers":{},"x":670,"y":4160,"wires":[]},{"id":"6756125209907198","type":"template","z":"c8d44844ba5acdbd","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>network map</title>\n\n  </head>\n  <body>\n    <pre class=\"mermaid\">\narchitecture-beta\n    group api(cloud)[API]\n\n    service db(database)[Database] in api\n    service disk1(disk)[Storage] in api\n    service disk2(disk)[Storage] in api\n    service server(server)[Server] in api\n\n    db:L -- R:server\n    disk1:T -- B:server\n    disk2:T -- B:db\n    </pre>\n    <script type=\"module\">\n      import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs'\n      mermaid.registerIconPacks([\n      {\n        name: 'logos',\n        loader: () =>\n          fetch('https://unpkg.com/@iconify-json/logos@1/icons.json').then((res) => res.json()),\n      },\n      {\n    name: 'mdi',\n    loader: () =>\n      fetch('https://unpkg.com/@iconify-json/mdi/icons.json').then((res) => res.json()),\n  }\n    ])\n    </script>\n  </body>\n</html>\n","output":"str","x":520,"y":4160,"wires":[["49ac2f6d633dd7f8"]]}]

It creates an endpoint on http://<ip:1880>/network_map and renders the following:

It uses a (normal) template node to render the html etc. This means you can have a dynamic description of your map using mustache and it will render it accordingly. This can all be made dynamic too, but I would suggest to explore this option first.

mermaid uses a textual description of the map:

architecture-beta
    group api(cloud)[API]

    service db(database)[Database] in api
    service disk1(disk)[Storage] in api
    service disk2(disk)[Storage] in api
    service server(server)[Server] in api

    db:L -- R:server
    disk1:T -- B:server
    disk2:T -- B:db

I recently posted an example of using Mermaid with UIBUILDER if that is of any use. You could possibly adapt it to work with D2 if you really need that.

Mermaid is pretty static though (e.g. you have to rebuild the whole thing if something changes) so not really a good choice if you are looking for something more dynamic.

Network topologies are actually examples of GRAPH's rather than CHART's. So searching for graph libraries should give you more options.

Here is a dump from my Obsidian notebook on Graph libraries:

Name Descr $ Comments
baklavajs Graph/node editor for VueJs 0 Interesting Unreal engine style flow-based display and processing.
beautiful-react-diagrams React components and hooks to build diagrams
butterfly Renderer for interactive diagrams and flowcharts
cytoscape.js Canvas based renderer with utilities and algorithms blog
d3-graphviz Graphviz DOT rendering and animated transitions using D3 0
diagram-maker Interactive editor for any graph-like data 0 Online editor
Flowy Flowchart library 0 Flowcharts only
flow-builder React-based renderer for workflows and process diagrams
Flume A React-powered node editor and runtime engine 0 Unreal engine style flow-based display and processing.
GoJS Diagramming library with a focus on customization and interactivity $$$ Go library
jointjs JavaScript diagramming library $$$
jsplumb Open source project written in Typescript that gives you the tools you need to visually connect DOM elements 0 (Limited), $$$ Free version is too limiting
kedro-viz Visualises Kedro data and machine-learning pipelines Specialist
litegraph.js A graph node engine and editor 0 Unreal engine style flow-based display and processing.
mermaid JavaScript based diagramming and charting tool that renders Markdown-inspired text definitions to create and modify diagrams dynamically. 0 Widely embedded in other tools.
ngx-graph Graph visualization library for Angular Angular only
nice-dag Lightweight javascript library, which is used to present a DAG diagram
nodl Framework for computational node graphs 0 Unreal engine style flow-based display and processing.
Pintora Extensible javascript text-to-diagrams library that works in both browser and Node.js. Inspired by Mermaid and PlantUML 0
react-dag-editor React component to create graphic user interface
react-digraph A library for creating directed graph editors
react-flow React library for rendering node-based UIs
reaflow React library for building workflow editors
rete Framework for visual programming and node editors 0 Unreal engine style flow-based display and processing.
sigma.js Visualization framework for large graphs
vue-flow Flowchart component for Vue 3 Simplified graph view
X6 X6 is an HTML and SVG-based graph editing engine that provides low-cost customization capabilities and out-of-the-box built-in extensions to quickly build DAG diagrams, ER diagrams, flowcharts, lineage diagrams, and more. Mostly Chinese.

Apache ECharts

Website Docs GitHub
Includes Graph types.

Arbor.js

arbor.js » introduction (arborjs.org) samizdatco/arbor: a graph visualization library using web workers and jQuery (github.com)

"a graph visualization library built with web workers and jQuery."

D3.js

Website Docs GitHub
Data visualisation

d3-graphviz

magjac/d3-graphviz: Graphviz DOT rendering and animated transitions using D3 (github.com)

Dracula

strathausen/dracula: JavaScript layout and representation of connected graphs. (github.com) Dracula Graph Library – Graph Computation, Layout, Algorithms for JavaScript (graphdracula.net)

G6 (AntV)

Introduction | G6 (gitee.io)

Graphviz (C)

DOT Language. Command line only.

Vega - Incl Tree & Network views

A Visualization Grammar | Vega

Vis.js (Community Edition) - Incl Network view

vis.js (visjs.org)

A dynamic, browser based visualization library. The library is designed to be easy to use, to handle large amounts of dynamic data, and to enable manipulation of and interaction with the data. The library consists of the components DataSet, Timeline, Network, Graph2d and Graph3d.

VivaGraphJS

website


Layouting

  • elkjs - A port of the Java ELK layouting library to Javascript
  • d3-hierarchy - Helpers and algorithms for working with hierarchical graphs
  • d3-force - Library for creating interactive force directed graphs
  • d3-dag - D3 plugin to work with DAG data structures
  • dagrejs - Directed graph layout algorithms for Javascript
  • graphology-layout - Layout algorithms
  • springy - Force directed graph layouts

Graph Utilities

  • behave-graph - Extensible behaviour-graph execution engine
  • graphlib - Helpers for directed graphs in JS
  • graphology - Utilities and algorithms for all kinds of graphs

Misc

  • flume - Business logic graph editor
  • mermaid - Flowchart and sequence diagrams generation
  • pintora - Text-to-diagrams library
  • quick-erd - Generate entity-relationship diagrams (ERD) from text, and reverse engineer ERD text from live database

Overview | Welcome to PyFlow homepage! (wonderworks-software.github.io) is a general purpose visual scripting framework for python.

Ryven - Flow-based visual scripting for Python - A simple and powerful visual nodes editor for Python, and a framework for building nodes executing any Python code.

2 Likes

Mermaid is pretty static though (e.g. you have to rebuild the whole thing if something changes) so not really a good choice if you are looking for something more dynamic.

which is a matter of:

mermaid.run()

Then again, we don't really know what OP is looking for.

After resending all the data. Not necessarily a problem for smaller charts but might get "interesting" for larger ones. I've not had time to test.