Skip to content

Graphviz

Use ncc graphviz to visualize a NodeSet's nodes and relationships before generating C or Python code. It uses the bundled Graphviz backend's traversal and node styles and writes DOT by default. PDF, SVG, and PNG rendering are optional.

Install Graphviz support

Install the Python integration:

python -m pip install "o6-ncc[graphviz]"

Writing DOT needs only this Python package. To render PDF, SVG, or PNG, also install Graphviz on your operating system and make its dot executable available on PATH. No o6 runtime or open62541 SDK is required.

Generate a diagram

Pass the target XML and its dependencies:

ncc graphviz MyModel.NodeSet2.xml -e ns0 -o model.dot

Omit -o to write DOT to stdout. Dependencies use the same syntax as inventory: repeat -e with bundled names or plain XML paths, including all transitive dependencies in dependency order.

Render directly to SVG, PDF, or PNG by choosing a format and output file:

ncc graphviz MyModel.NodeSet2.xml -e ns0 --format svg -o model.svg
ncc graphviz MyModel.NodeSet2.xml -e ns0 --format pdf -o model.pdf
ncc graphviz MyModel.NodeSet2.xml -e ns0 --format png -o model.png

The format comes from --format, not the filename extension. -o names the exact output file; parent directories are created and existing files are overwritten. Rendered formats require -o. Diagnostics go to stderr.

Focus on a node

By default, traversal starts at the OPC UA Root node and includes reachable dependency nodes. For a smaller diagram, choose a starting NodeId:

ncc graphviz MyModel.NodeSet2.xml -e ns0 --root 'ns=1;i=1001' --format svg -o device.svg

Use a NodeId from your model. Namespace indexes refer to the combined graph; inventory output lists its namespace URIs and node IDs.

The graph follows forward hierarchical references, encoding references, and type definition references. The backend omits PropertyType, BaseDataVariableType, and FolderType to reduce clutter, unless one is explicitly selected as the root. Nodes use different shapes and colors for their OPC UA node classes. This is a visual dependency view; use inventory to inspect the full reference list.

Command reference

ncc graphviz <xml> [-e <name-or-xml> ...] [-o <file>]
            [--format dot|pdf|svg|png] [--root <node-id>] [-v ...]
Argument Meaning
<xml> Target NodeSet XML.
-e, --existing Bundled dependency name or XML path. Repeat for all dependencies.
-o, --output Exact output file. Optional for DOT; required for rendered formats.
--format dot (default), pdf, svg, or png.
--root Starting NodeId; defaults to OPC UA Root.
-v, --verbose Increase diagnostic verbosity; repeat for debug logging.
-h, --help Show command help.

Exit status 0 means success, 2 indicates an argument or unknown bundled dependency error, and 1 indicates a loading, rendering, or output error.