Can not change distance between Nodes/Subgraphs of a graph with nodesep in a dot file generated by k8sviz

Hey there,

have a bit of a problem with a dot file, that visualizes a namespace of a k8s cluster and I want the whole thing grouped a bit more closer together graphically. The file is generated using GitHub - mkimuram/k8sviz: Generate Kubernetes architecture diagrams from the actual state in a namespace. I can apply the attribute ranksep on the main graph and that works by changing the distance of “levels” of nodes/subgraphs. But nodesep does nothing, also tried cellspacing etc for the tables with no effect, also stuff like: pack=false; defaultdist=0.1; applied to main graph G did nothing. Can someone point me to the right direction?

The file is structured as follows. Thanks a lot for your effort guys and girls! Also if anyone knows a better tool than k8sviz that generates graphs from clusters that I can for example export as svg to import them to PP, that would be great, have not found anything better so far.

	rankdir=TD;
    nodesep=0.1;
	ranksep=0.1;
	0->1[ style=solid ]; // Pfeile zwischen Ebenen, braucht es nicht, erscheinen sinnlos auf rechter Seite
	1->2[ style=solid ];
	2->3[ style=solid ];
	3->4[ style=invis ];
	4->5[ style=invis ];
	5->6[ style=invis ];
	sts_almnext_mongodb_mongodb->pod_almnext_mongodb_mongodb_0[ style=solid ];
	rs_almnext_services_basedata_6bff9f8d9f->pod_almnext_services_basedata_6bff9f8d9f_7gc8s[ style=solid ]; // style für Pfeile zwischen TDs
	rs_almnext_services_integration_78b5864fdb->pod_almnext_services_integration_78b5864fdb_vt4j4[ style=dashed ];
	rs_almnext_services_mongodbgui_789bd8ddf->pod_almnext_services_mongodbgui_789bd8ddf_g8kmp[ style=dashed ];
	rs_almnext_services_periodicpfconfig_76bfd6f868->pod_almnext_services_periodicpfconfig_76bfd6f868_qtwtk[ style=dashed ];
	rs_almnext_services_periodicpfquery_7d5b98cd89->pod_almnext_services_periodicpfquery_7d5b98cd89_mz5mq[ style=dashed ];
	rs_almnext_services_periodicpfsim_6c88558f7d->pod_almnext_services_periodicpfsim_6c88558f7d_n2vq4[ style=dashed ];
	rs_almnext_services_servicediscovery_69fc695fd5->pod_almnext_services_servicediscovery_69fc695fd5_lzhdw[ style=dashed ];
	rs_almnext_services_springbootadmin_5d576774dc->pod_almnext_services_springbootadmin_5d576774dc_5z668[ style=dashed ];
	deploy_almnext_services_basedata->rs_almnext_services_basedata_6bff9f8d9f[ style=dashed ];
	deploy_almnext_services_integration->rs_almnext_services_integration_78b5864fdb[ style=dashed ];
	deploy_almnext_services_mongodbgui->rs_almnext_services_mongodbgui_789bd8ddf[ style=dashed ];
	deploy_almnext_services_periodicpfconfig->rs_almnext_services_periodicpfconfig_76bfd6f868[ style=dashed ];
	deploy_almnext_services_periodicpfquery->rs_almnext_services_periodicpfquery_7d5b98cd89[ style=dashed ];
	deploy_almnext_services_periodicpfsim->rs_almnext_services_periodicpfsim_6c88558f7d[ style=dashed ];
	deploy_almnext_services_servicediscovery->rs_almnext_services_servicediscovery_69fc695fd5[ style=dashed ];
	deploy_almnext_services_springbootadmin->rs_almnext_services_springbootadmin_5d576774dc[ style=dashed ];
	pod_almnext_mongodb_mongodb_0->pvc_data_volume_almnext_mongodb_mongodb_0[ dir=none ];
	pod_almnext_mongodb_mongodb_0->pvc_logs_volume_almnext_mongodb_mongodb_0[ dir=none ];
	pod_almnext_mongodb_mongodb_0->svc_almnext_mongodb_mongodb_svc[ dir=back ];
	pod_almnext_services_basedata_6bff9f8d9f_7gc8s->svc_basedata[ dir=back ];
	pod_almnext_services_integration_78b5864fdb_vt4j4->svc_integration[ dir=back ];
	pod_almnext_services_mongodbgui_789bd8ddf_g8kmp->svc_mongodbgui[ dir=back ];
	pod_almnext_services_periodicpfconfig_76bfd6f868_qtwtk->svc_periodicpfconfig[ dir=back ];
	pod_almnext_services_periodicpfquery_7d5b98cd89_mz5mq->svc_periodicpfquery[ dir=back ];
	pod_almnext_services_periodicpfsim_6c88558f7d_n2vq4->svc_periodicpfsim[ dir=back ];
	pod_almnext_services_servicediscovery_69fc695fd5_lzhdw->svc_servicediscovery[ dir=back ];
	pod_almnext_services_springbootadmin_5d576774dc_5z668->svc_springbootadmin[ dir=back ];
	svc_mongodbgui->ing_almnext_mongodbui[ dir=back ];
	svc_springbootadmin->ing_almnext_web[ dir=back ];
	svc_integration->ing_almnext_web[ dir=back ];
	subgraph cluster_alm_4583_undeploy { // leerer Platzhalter für Titel oben
	label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/ns-128.png" /></TD></TR><TR><TD>alm-4583-undeploy</TD></TR></TABLE>>;
	labeljust=l;
	style=solid; // ist border um ganzes Diagram
	subgraph rank_0 {
	rank=same;
	style=solid;
	0 [ height=0, margin=0, style=invis, width=0 ];
}
;
	subgraph rank_1 {
	rank=same;
	nodesep=0.1;
	style=solid; // scheinbar ohne Effekt
	1 [ height=0, margin=0, style=invis, width=0 nodesep=0.1; ]; // style bestimmt ob label 1 ganz rechts sichtbar, nicht gewollt
	deploy_almnext_services_basedata [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-basedata</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_integration [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-integration</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_mongodbgui [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-mongodbgui</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_periodicpfconfig [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfconfig</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_periodicpfquery [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfquery</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_periodicpfsim [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfsim</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_servicediscovery [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-servicediscovery</TD></TR></TABLE>>, penwidth=0 ];
	deploy_almnext_services_springbootadmin [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/deploy-128.png" /></TD></TR><TR><TD>almnext-services-springbootadmin</TD></TR></TABLE>>, penwidth=0 ];
}
;
	subgraph rank_2 {
	rank=same;
	style=invis;
	nodesep=0.1;
	2 [ height=0, margin=0, style=invis, width=0 nodesep=0.1 ];
	rs_almnext_services_basedata_6bff9f8d9f [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-basedata-6bff9f8d9f</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_integration_78b5864fdb [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-integration-78b5864fdb</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_mongodbgui_789bd8ddf [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-mongodbgui-789bd8ddf</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_periodicpfconfig_76bfd6f868 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfconfig-76bfd6f868</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_periodicpfquery_7d5b98cd89 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfquery-7d5b98cd89</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_periodicpfsim_6c88558f7d [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfsim-6c88558f7d</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_servicediscovery_69fc695fd5 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-servicediscovery-69fc695fd5</TD></TR></TABLE>>, penwidth=0 ];
	rs_almnext_services_springbootadmin_5d576774dc [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/rs-128.png" /></TD></TR><TR><TD>almnext-services-springbootadmin-5d576774dc</TD></TR></TABLE>>, penwidth=0 ];
	sts_almnext_mongodb_mongodb [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/sts-128.png" /></TD></TR><TR><TD>almnext-mongodb-mongodb</TD></TR></TABLE>>, penwidth=0 ];
}
;
	subgraph rank_3 {
	rank=same;
	style=invis;
	nodesep=0.1;
	3 [ height=0, margin=0, style=invis, width=0 nodesep=0.1 ];
	pod_almnext_mongodb_mongodb_0 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-mongodb-mongodb-0</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_basedata_6bff9f8d9f_7gc8s [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-basedata-6bff9f8d9f-7gc8s</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_integration_78b5864fdb_vt4j4 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-integration-78b5864fdb-vt4j4</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_mongodbgui_789bd8ddf_g8kmp [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-mongodbgui-789bd8ddf-g8kmp</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_periodicpfconfig_76bfd6f868_qtwtk [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfconfig-76bfd6f868-qtwtk</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_periodicpfquery_7d5b98cd89_mz5mq [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfquery-7d5b98cd89-mz5mq</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_periodicpfsim_6c88558f7d_n2vq4 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-periodicpfsim-6c88558f7d-n2vq4</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_servicediscovery_69fc695fd5_lzhdw [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-servicediscovery-69fc695fd5-lzhdw</TD></TR></TABLE>>, penwidth=0 ];
	pod_almnext_services_springbootadmin_5d576774dc_5z668 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pod-128.png" /></TD></TR><TR><TD>almnext-services-springbootadmin-5d576774dc-5z668</TD></TR></TABLE>>, penwidth=0 ];

}
;
	subgraph rank_4 {
	rank=same;
	nodesep=0.1;
	style=invis;
	4 [ height=0, margin=0, style=invis, width=0 nodesep=0.1 ];
	pvc_data_volume_almnext_mongodb_mongodb_0 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pvc-128.png" /></TD></TR><TR><TD>data-volume-almnext-mongodb-mongodb-0</TD></TR></TABLE>>, penwidth=0 ];
	pvc_logs_volume_almnext_mongodb_mongodb_0 [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/pvc-128.png" /></TD></TR><TR><TD>logs-volume-almnext-mongodb-mongodb-0</TD></TR></TABLE>>, penwidth=0 ];

}
;
	subgraph rank_5 {
	rank=same;
	style=invis;
	nodesep=0.1;
	5 [ height=0, margin=0, style=invis, width=0 nodesep=0.1 ];
	svc_almnext_mongodb_mongodb_svc [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>almnext-mongodb-mongodb-svc</TD></TR></TABLE>>, penwidth=0 ];
	svc_basedata [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>basedata</TD></TR></TABLE>>, penwidth=0 ];
	svc_integration [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>integration</TD></TR></TABLE>>, penwidth=0 ];
	svc_mongodbgui [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>mongodbgui</TD></TR></TABLE>>, penwidth=0 ];
	svc_periodicpfconfig [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>periodicpfconfig</TD></TR></TABLE>>, penwidth=0 ];
	svc_periodicpfquery [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>periodicpfquery</TD></TR></TABLE>>, penwidth=0 ];
	svc_periodicpfsim [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>periodicpfsim</TD></TR></TABLE>>, penwidth=0 ];
	svc_servicediscovery [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>servicediscovery</TD></TR></TABLE>>, penwidth=0 ];
	svc_springbootadmin [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/svc-128.png" /></TD></TR><TR><TD>springbootadmin</TD></TR></TABLE>>, penwidth=0 ];

}
;
	subgraph rank_6 {
	rank=same;
	style=invis;
	nodesep=0.1;
	6 [ height=0, margin=0, style=invis, width=0 nodesep=0.1 ];
	ing_almnext_mongodbui [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/ing-128.png" /></TD></TR><TR><TD>almnext-mongodbui</TD></TR></TABLE>>, penwidth=0 ];
	ing_almnext_web [ label=<<TABLE BORDER="0"><TR><TD><IMG SRC="/home/cmaier/source/k8sviz/bin/icons/ing-128.png" /></TD></TR><TR><TD>almnext-web</TD></TR></TABLE>>, penwidth=0 ];

}
;

}
;

}

.... more subgraphs of similar structure.....

Try dot -Gratio=compress too?

When you look at the generated layout, where is the whitespace that you would like to decrease?

Someone might have to read the code and figure out the relationship between CL_OFFSET (a hard value) and G_margin (settable in the graph file), like here

Thanks, for the suggestions.

I try to decrease whitespaces between the nodes of one rank and the corresponding edges too. The only thing I could really “compress” the graph was setting rankdir=LR; but it of course totally changes the orientation and not for the better.

I tried -Gratio=compress, but it changed nothing visible in the svg output.
I will look at the code and play around with G_margin.