Install-Software "Graphviz"

Install the open-source graph visualization software "Graphviz" on Windows.

Page content

Introduction

Install the network diagram visualization tool “Graphviz ” on Windows using the package manager “WinGet ”.

Prerequisites

Installation

This section explains how to install Graphviz using the package management tool “WinGet ”.

First, Launch PowerShell with administrator privileges:

  1. START MENU → Type pwsh
  2. Click “Run as Administrator”

Verify the latest version of Graphviz :

winget search --id Graphviz.Graphviz -e
Name     Id                Version Source
------------------------------------------
Graphviz Graphviz.Graphviz 12.2.1  winget

Install Graphviz . Specify the verified ID and Source as follows:

winget install --id Graphviz.Graphviz --source winget -e

Add the following path to the system environment variables PATH:

"C:\Program Files\Graphviz\bin"

Verification

Close PowerShell and restart it with administrator privileges. Verify the installation with the following command:

dot -V

Output:

dot - graphviz version 12.2.1 (20241206.2353)

Next, configure the plugins by running the following command (writes plugin information to $prefix/lib/graphviz/config):

dot -c

Installation complete. Now you can use the dot command in PowerShell with user privileges.

Sample Code

Generate and visualize a basic graph (network diagram).

1. Create a DOT File

First, create a DOT format text file named a.dot:

digraph sample {
    // Global node styling: circular shape with a light blue fill
    node [style=filled, fillcolor=lightblue, fontname="Helvetica"];

    // Define nodes and their connections
    A -> B;
    A -> C;
    B -> D;
    C -> D;
    D -> E;
    C -> F;
    E -> F;
    F -> A;
    
    // Additional cross connections for more complexity
    B -> E;
    E -> A;
}

This file defines a basic directed graph. To let you experience how Graphviz automatically calculates the layout of nodes (graph elements), the relationships have been designed to be just complex enough that they’re hard to visualize solely in your head.

2. Generate the Graph Using the dot Command

Next, open PowerShell with user privileges and execute the following command:

dot -Tpng -O a.dot

This command takes a.dot as input and generates a PNG format image file (a.dot.png).

3. Verify the Output

After execution, open the generated a.dot.png file to confirm that the graph is correctly rendered.

Figure: Rendered Graph (Network Diagram)

Note that Graphviz automatically calculates the positions and arranges the layout of nodes (graph elements enclosed in circles).

Terms

Graph (Network Diagram)

A graph here refers to a relationship diagram where nodes are connected by arrows or lines. It is distinct from charts (such as bar-charts or line-charts).

Graphviz

Open-source graph visualization software. It automatically generates images of graph structures, such as network diagrams, based on textual descriptions written in the DOT language. A key feature of Graphviz is its ability to automatically calculate node (graph elements) placement and layout.