Example 3
This time we will extend the edges size using the Graphviz minlen attribute.
The diagram below illustrates a 3-tier web application architecture. Each tier—Web, Application, and Database—is depicted as a color-coded rectangle for easy identification. Labeled connections show the communication protocols: the Web server connects to the Application server using gRPC, while the Application server communicates with the Database server via SQL.
The minlen attribute has been applied to the edges to enhance the spacing between the nodes, resulting in a clearer and more organized layout.
[CmdletBinding()]
param (
[System.IO.FileInfo] $Path = '~\Desktop\',
[array] $Format = @('png'),
[bool] $DraftMode = $false
)
Starting with PowerShell v3, modules are auto-imported when needed. Importing the module here ensures clarity and avoids ambiguity.
Since the diagram output is a file, specify the output folder path using $OutputFolderPath.
The $MainGraphLabel variable sets the main title of the diagram.
This section creates connections between the nodes in a herarchical layout. The Edge statements create connections between the nodes.
The minlen attribute is used to increase the minimum length of the edge lines.
https://graphviz.org/docs/attrs/minlen/
New-Diagrammer -InputObject $example3 -OutputFolderPath $OutputFolderPath -Format $Format -MainDiagramLabel $MainGraphLabel -Filename Example3 -LogoName "Main_Logo" -DraftMode:$DraftMode
When you run the script, it generates a PNG file named Example3.png in the specified output folder.
Resulting diagram: