Formatting a Network graph

0 votes
asked May 23, 2021 in Question / help by mcon (320 points)

I have multiple problems with the following graph (this is the best I could achieve):

@startuml
nwdiag {
    network BluetoothA {
        description = "<&bluetooth*2> A";
        routerA [description = "<&rss*4>\nCluster A\nRouter"];
        IoTA1 [description = "<&cog*4>\nCluster A\nIoT1"];
        IoTA2 [description = "<&cog*4>\nCluster A\nIoT2"];
        IoTAn [description = "<&cog*4>\nCluster A\nIoTn"];
    }
    group {
        color = "palegreen";
        description = "Cluster A"
        routerA;
        IoTA1;
        IoTA2;
        IoTAn;
    }

    network BluetoothB {
        routerB [description = "<&rss*4>\nCluster B\nRouter"];
        IoTB1 [description = "<&cog*4>\nCluster B\nIoT1"];
        IoTB2 [description = "<&cog*4>\nCluster B\nIoT2"];
        IoTBn [description = "<&cog*4>\nCluster B\nIoTn"];
    }
    group {
        color = "palegreen";
        description = "Cluster B"
        routerB;
        IoTB1;
        IoTB2;
        IoTBn;
    }

    network internet {
        routerI [description = "<&home*4>\nGlobal\nRouter"]
        App1 [description = "<&monitor*4>\nHMI 1"]
        App2 [description = "<&monitor*4>\nHMI 2"]
        routerA;
        routerB;
    }

}
@enduml

My problems are:

  • network description seems to be completely ignored
  • I tried to add a `shape = "cloud"` parameter to "internet" network, but it results in a syntax error.
  • I would like to have the "internet" network on top, but moving "network internet" on top (no other changes) results in rearrangements of router(A|B) position and them dropping out of relative group.
  • ideally I should have a top "internet" cloud connected to all components with "clusters" grouped as tightly as possible.
Can someone help?

2 Answers

0 votes
answered Oct 2, 2021 by Volker

Hi,

so far I couldn't find a way to connect to network bands. Maybe this suffices?

@startuml
nwdiag {

    internet [shape = cloud]
    internet -- routerI

    network internet {
        routerI [description = "<&home*4>\nGlobal\nRouter"]
        App1 [description = "<&monitor*4>\nHMI 1"]
        App2 [description = "<&monitor*4>\nHMI 2"]
    }

    network BluetoothA {
        description = "<&bluetooth*2> A";
        routerI
        routerA [description = "<&rss*4>\nCluster A\nRouter"];
        IoTA1 [description = "<&cog*4>\nCluster A\nIoT1"];
        IoTA2 [description = "<&cog*4>\nCluster A\nIoT2"];
        IoTAn [description = "<&cog*4>\nCluster A\nIoTn"];
    }
    group {
        color = "palegreen";
        description = "Cluster A"
        routerA;
        IoTA1;
        IoTA2;
        IoTAn;
    }

    network BluetoothB {
        routerI
        routerB [description = "<&rss*4>\nCluster B\nRouter"];
        IoTB1 [description = "<&cog*4>\nCluster B\nIoT1"];
        IoTB2 [description = "<&cog*4>\nCluster B\nIoT2"];
        IoTBn [description = "<&cog*4>\nCluster B\nIoTn"];
    }
    group {
        color = "palegreen";
        description = "Cluster B"
        routerB;
        IoTB1;
        IoTB2;
        IoTBn;
    }
}
@enduml

0 votes
answered Oct 3, 2021 by The-Lu (64,760 points)
edited Oct 3, 2021 by The-Lu

Hello A.,

From:

And (the Volker's answer):

Why not mix the both, like:

@startuml
nwdiag {

    internet [shape = cloud]
    internet -- routerI
    App1 
    App2

    network internet {
        routerI [description = "<&home*4>\nGlobal\nRouter"]
        App1 [description = "<&monitor*4>\nHMI 1"]
        App2 [description = "<&monitor*4>\nHMI 2"]
        routerA;
        routerB;
    }

    network BluetoothA {
        description = "<&bluetooth*2> A";
        routerA [description = "<&rss*4>\nCluster A\nRouter"];
        IoTA1 [description = "<&cog*4>\nCluster A\nIoT1"];
        IoTA2 [description = "<&cog*4>\nCluster A\nIoT2"];
        IoTAn [description = "<&cog*4>\nCluster A\nIoTn"];
    }
    group {
        color = "palegreen";
        description = "Cluster A"
        routerA;
        IoTA1;
        IoTA2;
        IoTAn;
    }

    network BluetoothB {
        routerB [description = "<&rss*4>\nCluster B\nRouter"];
        IoTB1 [description = "<&cog*4>\nCluster B\nIoT1"];
        IoTB2 [description = "<&cog*4>\nCluster B\nIoT2"];
        IoTBn [description = "<&cog*4>\nCluster B\nIoTn"];
    }
    group {
        color = "palegreen";
        description = "Cluster B"
        routerB;
        IoTB1;
        IoTB2;
        IoTBn;
    }
}
@enduml

If that can help,
Regards,
Th.

...