KevinMarquette / PSGraph

A set of utilities for working with Graphviz in Powershell
MIT License
206 stars 49 forks source link

Subgraph cmdlet and the invisible node (A Harry Potter Movie) #111

Open rebelinux opened 10 months ago

rebelinux commented 10 months ago

Hi,

Evaluating the generated .dot file I noticed that for each SubGraph a node with the same name as the subgraph is created.

I have seen that in some cases this invisible node messes up or influences the calculation of the edges.

Is there any reason for this?

PSGraph code: https://github.com/KevinMarquette/PSGraph/blob/054765334c12ef9a6549380ae2661fda26c11255/PSGraph/Public/Graph.ps1#L118C1-L123C14

Dot File:

digraph VeeamVBR {
    graph [bb="0,0,963,778",
        compound=true,
        fontcolor="#005f4b",
        fontname="Segoe Ui Black",
        fontsize=32,
        imagepath="C:\Users\jocolon\Documents\WindowsPowerShell\Modules\Veeam.Diagrammer\icons",
        labelloc=t,
        nodesep=0.6,
        overlap=false,
        pad=1,
        penwidth=1.5,
        rankdir=TB,
        ranksep=0.75,
        splines=polyline,
        style=dashed
    ];
    node [fillcolor=white,
        fontsize=14,
        imagescale=True,
        label="",
        labelloc=t,
        shape=none,
        style=filled
    ];
    edge [arrowsize=1,
        arrowtail=dot,
        color="#71797E",
        dir=both,
        penwidth=1.5,
        style=dashed
    ];
    subgraph clusterMainGraph {
        graph [bb="8,8,955,770",
            fontsize=24,
            label=<<TABLE border='0' cellborder='0' cellspacing='20' cellpadding='10'>
            <TR>
                <TD bgcolor='#FFCCCC' ALIGN='center' colspan='1'>Veeam Logo</TD>
            </TR>
            <TR>
                <TD bgcolor='#FFCCCC' ALIGN='center'>Wan Accelerators Diagram</TD></TR><TR><TD ALIGN='center'><font color='red'>Debug ON</font></TD>
            </TR>
            </TABLE>>,
            lheight=3.35,
            lp="481.5,645.38",
            lwidth=5.00,
            penwidth=0
        ];
        subgraph clusterBackupServer {
            graph [bb="146,371,916,512.75",
                bgcolor="#ceedc4",
                fontsize=18,
                label="Backup Server",
                lheight=0.33,
                lp="531,496.75",
                lwidth=1.69,
                penwidth=2,
                style=rounded
            ];
            {
                graph [rank=same];
                "VEEAM-VBR" [fillcolor="#ceedc4",
                    height=1.3021,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-VBR</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP: 192.168.7.73</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Role: Backup Server</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Version: 12.1.0.2131</FONT></TD></TR></TABLE>>,
                    pos="536,425.88",
                    shape=plain,
                    width=1.7431];
                "VEEAM-SQL" [fillcolor="#ceedc4",
                    height=1.0139,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-SQL</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP: 192.168.7.79</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Role: Database Server</FONT></TD></TR></TABLE>>,
                    pos="794,425.88",
                    shape=plain,
                    width=1.8576];
                "VEEAM-EM"  [fillcolor="#ceedc4",
                    height=1.0139,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-EM</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP: 192.168.7.83</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Role: Enterprise Manager Server</FONT></TD></TR></TABLE>>,
                    pos="249,425.88",
                    shape=plain,
                    width=2.6493];
            }
            /****** what is this for?  (they mess up the edges)
            BackupServer    [height=0.05,
                pos="906,425.88",
                shape=point,
                style=invis,
                width=0.05];
            *******/
            "VEEAM-VBR" -> "VEEAM-SQL"  [arrowhead=normal,
                arrowtail=normal,
                minlen=3,
                pos="s,598.5,425.88 e,727.51,425.88 610.36,425.88 617.41,425.88 622,425.88 622,425.88 622,425.88 708,425.88 708,425.88 708,425.88 710.89,\
425.88 715.6,425.88",
                xlabel="1433/TCP",
                xlp="634.11,433.75"];
            "VEEAM-EM" -> "VEEAM-VBR"   [arrowhead=normal,
                arrowtail=normal,
                minlen=3,
                pos="s,344.06,425.88 e,473.26,425.88 356.11,425.88 381.94,425.88 440.33,425.88 440.33,425.88 440.33,425.88 449.06,425.88 461.25,425.88"];
        }
        subgraph clusterMainSubGraph {
            graph [bb="16,16,947,255",
                color=red,
                fontsize=18,
                label=" ",
                labelloc=t,
                lheight=0.33,
                lp="481.5,239",
                lwidth=0.07,
                penwidth=1.5,
                style="dashed,rounded"
            ];
            {
                graph [rank=same];
                "VEEAM-REPO-01V  "  [fontname="Segoe Ui",
                    height=1.5694,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-REPO-01V</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Path: E:\VeeamWAN</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Size: 10 GB</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP:  Unknown</FONT></TD></TR></TABLE>>,
                    pos="122,80.5",
                    width=2.7257];
                "VEEAM-VBR  "   [fontname="Segoe Ui",
                    height=1.5694,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-VBR</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Path: E:\VeeamWAN</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Size: 10 GB</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP: 192.168.7.73</FONT></TD></TR></TABLE>>,
                    pos="361,80.5",
                    width=2.7257];
                "VEEAM-WAN-01V  "   [fontname="Segoe Ui",
                    height=1.5694,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-WAN-01V</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Path: C:\VeeamWAN</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Size: 10 GB</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP:  Unknown</FONT></TD></TR></TABLE>>,
                    pos="601,80.5",
                    width=2.7465];
                "VEEAM-VBR-02V  "   [fontname="Segoe Ui",
                    height=1.5694,
                    label=<<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='Center' colspan='1'></TD></TR><TR><TD align='Center'><B>VEEAM-VBR-02V</B></TD></TR><TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Path: E:\VeeamWAN</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>Cache Size: 100 GB</FONT></TD></TR> <TR><TD align='Center' colspan='1'><FONT POINT-SIZE='14'>IP: 192.168.7.189</FONT></TD></TR></TABLE>>,
                    pos="841,80.5",
                    width=2.7257];
            }
            /****** what is this for?  (they mess up the edges)
            MainSubGraph    [height=0.05,
                pos="796,203",
                shape=point,
                style=invis,
                width=0.05];
            *******/
            WANACCELSERVER  [fontcolor="#005f4b",
                fontname="Segoe Ui Black",
                fontsize=18,
                height=0.33333,
                label="Wan Accelerators",
                pos="536,203",
                shape=plain,
                width=2.0938];
            WANACCELSERVER -> "VEEAM-REPO-01V  "    [color=red,
                constraint=true,
                minlen=1,
                pos="s,486.29,191.05 e,220,127.21 477.15,189.03 391.08,170.07 241,137 241,137 241,137 237.15,135.21 230.84,132.26",
                style=filled];
            WANACCELSERVER -> "VEEAM-VBR  " [color=red,
                constraint=true,
                minlen=1,
                pos="s,520.16,191.09 e,441.27,136.77 512.55,185.86 496.49,174.79 474.04,159.34 451.35,143.71",
                style=filled];
            WANACCELSERVER -> "VEEAM-WAN-01V  " [color=red,
                constraint=true,
                minlen=1,
                pos="s,541.77,191.31 e,571.07,136.98 546.2,183.1 551.51,173.25 558.36,160.55 565.41,147.48",
                style=filled];
            WANACCELSERVER -> "VEEAM-VBR-02V  " [color=red,
                constraint=true,
                minlen=1,
                pos="s,566.96,191.12 e,743.01,126.82 575.68,188.06 630.04,168.96 721,137 721,137 721,137 725.24,135.04 732.13,131.85",
                style=filled];
        }
        /****** what is this for?  (they mess up the edges)
        MainGraph   [height=0.05,
            pos="79,425.88",
            shape=point,
            style=invis,
            width=0.05];
        *******/

        "VEEAM-VBR" -> WANACCELSERVER   [minlen=3,
            pos="s,536,379.11 e,536,214.62 536,369.9 536,323.71 536,260.02 536,226.59",
            xlabel="6165/TCP",
            xlp="507.12,306.12"];
    }
}

Regards,

rebelinux commented 10 months ago

I edited the code to show the extra Nodes:

Output

rebelinux commented 10 months ago

Output