graph desktop {
    label = "desktop"
    rankdir = LR
    
    subgraph legend {
        label = "Legend"
        
        legend_label [label = ""; xlabel = "Legend"; width = 0; height = 0]
        unavailable [label = ""; xlabel = "unavailable"; width = 0.25; height = 0.25; shape = box; color = grey]
        unused [label = ""; xlabel = "unused slot"; width = 0.25; height = 0.25; shape = box]
        used [label = ""; xlabel = "used slot"; width = 0.25; height = 0.25; shape = box; color = "#333"; style = filled]
        component [label = ""; xlabel = "component"; width = 0.25; height = 0.25; shape = box; color = grey; style = filled]
        warning [label = ""; xlabel = "warning"; width = 0.25; height = 0.25; shape = box; color = orange; style = filled]
        
        legend_label -- unavailable [style = invis]
        legend_label -- unused [style = invis]
        legend_label -- used [style = invis]
        legend_label -- component [style = invis]
        legend_label -- warning [style = invis]
    }
    
    node [
        shape = box
        height = 0.5
        width = 1
    ]
    
    edge [
        penwidth = 1.25
    ]
    
    subgraph cluster_motherboard {
        label = "Motherboard: Aorus MASTER rev1.2 (X570)"
        
        subgraph cluster_usb3 {
            label = "USB headers"
            
            usb2_1
            usb2_2
            
            usb3_1
            usb3_2
            
            usbc_1
        }
        
        subgraph cluster_sata {
            label = "SATA 3.0\nheaders"
            
            sata_1
            sata_2
            sata_3
            sata_4
            sata_5
            sata_6
        }
        
        subgraph cluster_nvme {
            label = "3x PCIe 4.0 M.2 NVME"
            
            # The Aorus Master 1.2 has 3x NVME slots
            nvme_1
            nvme_2
            nvme_3
            
            # My NVME drives
            nvme_drive_1 [label = "WD SN850 2TB PCIe 4.0"; width = 2.5; color = grey; style = filled]
            nvme_drive_2 [label = "WD SN850 2TB PCIe 4.0"; width = 2.5; color = grey; style = filled]
            nvme_drive_3 [label = "WD SN850 2TB PCIe 4.0"; width = 2.5; color = grey; style = filled]
            
            nvme_1 -- nvme_drive_1; nvme_1 [color = "#333"; style = filled; fontcolor = white]
            nvme_2 -- nvme_drive_2; nvme_2 [color = "#333"; style = filled; fontcolor = white]
            nvme_3 -- nvme_drive_3; nvme_3 [color = "#333"; style = filled; fontcolor = white]
            
            # Filling the 3rd NVME slot disables two SATA slots
            sata_5 [color = grey; fontcolor = grey]
            sata_6 [color = grey; fontcolor = grey]
            sata_5 -- nvme_3 [color = orange]
            sata_6 -- nvme_3 [color = orange]
        }

        subgraph cluster_pcie {
            label = "PCIe slots"
            
            subgraph pcie_cpu_lanes {
                label = "PCIe slots from CPU lanes are linked."
                rank = same
                
                pcie_x16_1 [label = "PCIe 4.0 x16 (running x16)"; width = 3]
                pcie_x16_2 [label = "PCIe 4.0 x16 (running x8)"; width = 3; color = grey; fontcolor = grey]
                # using the 8x slot reduces the 16x to 8x
                pcie_x16_2 -- pcie_x16_1 [color = orange; tailport = n; headport = s]
            }
            pcie_x1 [label = "PCIe 4.0 x1 (running x1)"; width = 3]
            pcie_x16_3 [label = "PCIe 4.0 x16 (running x4)"; width = 3]
            
            # graphics card 16x
            asrock_5700xt [label = "AMD RX 5700 XT\n(AsROCK Challenger D OC 8GB)"; color = grey; style = filled]
            pcie_x16_1 -- asrock_5700xt; pcie_x16_1 [color = "#333"; style = filled; fontcolor = white]
            
            # capture card 4x
            bm_ip4k [label = "Blackmagic Intensity Pro 4K"; width = 3; color = grey; style = filled]
            pcie_x16_3 -- bm_ip4k; pcie_x16_3 [color = "#333"; style = filled; fontcolor = white]
        }

        subgraph cluster_cpu {
            label = "AM4 socket"
            
            cpu [label = "AMD Ryzen 5950x"; width = 2; color = grey; style = filled]
        }
        
        subgraph cluster_ram {
            label = "DDR4 RAM slots"
            
            ram_1
            ram_2
            ram_3
            ram_4
            
            # 128gb kit
            vengeance_128gb [label = "128GB (4x32GB) DDR4-3600 C18\nCorsair Vengeance LPX"; width = 3.5; height = 2.75; color = grey; style = filled]
            ram_1 -- vengeance_128gb; ram_1 [color = "#333"; style = filled; fontcolor = white]
            ram_2 -- vengeance_128gb; ram_2 [color = "#333"; style = filled; fontcolor = white]
            ram_3 -- vengeance_128gb; ram_3 [color = "#333"; style = filled; fontcolor = white]
            ram_4 -- vengeance_128gb; ram_4 [color = "#333"; style = filled; fontcolor = white]
        }

    }
    
    subgraph cluster_case {
        label = "Case: CM HAF 932"
        
        subgraph cluster_front_bays {
            label="5.25\" Front bays"
            
            # 6x front bays
            bay_1
            bay_2
            bay_3
            bay_4
            bay_5
            bay_6
            
            # Bay 1: USB 3.0 card reader
            kingwin_bay_adapter [label = "Kingwin 5.25\" to 3.5\" adapter"; width = 3]
            vantec_card_reader [label = "3.5\" USB 3.0 Card Reader\n(Vantec UGT-CR935)"; width = 3; color = grey; style = filled]
            bay_1 -- kingwin_bay_adapter -- vantec_card_reader; bay_1 [color = "#333"; style = filled; fontcolor = white]
            vantec_card_reader -- usb3_1 [tailport = n; headport = w]; usb3_1 [color = "#333"; style = filled; fontcolor = white]
            
            # Bay 2: SATA hotswap bays
            syba_hotswap [label = "Syba 5.25\" Hotswap Bay"; width = 3; color = grey; style = filled]
            bay_2 -- syba_hotswap; bay_2 [color = "#333"; style = filled; fontcolor = white]
            syba_hotswap -- sata_1 [tailport = e; headport = w]; sata_1 [color = "#333"; style = filled; fontcolor = white]
            syba_hotswap -- sata_2 [tailport = e; headport = w]; sata_2 [color = "#333"; style = filled; fontcolor = white]
            syba_hotswap -- usb3_2 [tailport = e; headport = w]; usb3_2 [color = "#333"; style = filled; fontcolor = white]
            
            # Bay 3: DVD drive
            asus_dvd [label = "ASUS DVD Drive 24x"; width = 3; color = grey; style = filled]
            bay_3 -- asus_dvd; bay_3 [color = "#333"; style = filled; fontcolor = white]
            asus_dvd -- sata_3 [tailport = e; headport = w]; sata_3 [color = "#333"; style = filled; fontcolor = white]

            # Bay 4: Kloud City drawer
            kloud_city_1 [label = "Kloud City 5.25\" drawer"; width = 3; color = grey; style = filled]
            bay_4 -- kloud_city_1; bay_4 [color = "#333"; style = filled; fontcolor = white]
            
            # Bays 5-6: Evercool Dual
            evercool_dual [label = "Evercool Dual\n5.25\" to 3x 3.5 drives"; height = 1.25; width = 3]
            bay_5 -- evercool_dual; bay_5 [color = "#333"; style = filled; fontcolor = white]
            bay_6 -- evercool_dual; bay_6 [color = "#333"; style = filled; fontcolor = white]
        }
        
        subgraph cluster_drive_sleds {
            label = "Drive sleds"
            
            sled_1
            sled_2
            sled_3
            sled_4
            sled_5
        }
        
        subgraph cluster_cpu_clearance {
            label = "CPU cooler\nclearance: 172mm"
            
            cpu_cooler [label = "Noctua NH-D15S"; width = 1.75 color = grey; style = filled]
        }
        
    }
   
}