graph: make graphviz export more readable
PATCH 1/1 graph: make graphviz export more readable
Change the color of arrows leading to sink nodes to dark orange. Remove the node oval shape around the sink nodes and make their text dark orange. This results in a much more readable output for large graphs. See the link below for an example.
--- lib/graph/graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/graph/graph.c +5 -2
@@ -745,7 +745,7 @@ graph_to_dot(FILE *f, struct graph *graph)if (rc <0 ) goto end; }else if (graph_node->node->nb_edges ==0 ) { - rc =fprintf (f," [color=darkorange]" ); + rc =fprintf (f," [fontcolor=darkorange shape=plain]" );if (rc <0 ) goto end; }
@@ -753,9 +753,12 @@ graph_to_dot(FILE *f, struct graph *graph)if (rc <0 ) goto end;for (i =0 ; i < graph_node->node->nb_edges; i++) { +const char *node_attrs = attrs; +if (graph_node->adjacency_list[i]->node->nb_edges ==0 ) + node_attrs =" [color=darkorange]" ; rc =fprintf (f,"\t\"%s\" -> \"%s\"%s;\n" , node_name, graph_node->adjacency_list[i]->node->name, - attrs); + node_attrs);if (rc <0 ) goto end; }
Signature · 1 line
2.46.0
Quoted 19 lines
-----Original Message-----
From: Robin Jarry <[email protected]>
Sent: Wednesday, August 28, 2024 7:12 PM
To: [email protected]; Jerin Jacob <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Zhirun Yan <[email protected]>
Subject: [EXTERNAL] [PATCH dpdk] graph: make graphviz export more readableChange the color of arrows leading to sink nodes to dark orange. Remove the node oval shape around the sink nodes and make their text dark orange. This results in a much more readable output for large graphs. See the link below for an example.
Change the color of arrows leading to sink nodes to dark orange. Remove the node oval shape around the sink nodes and make their text dark orange. This results in a much more readable output for large graphs.
See the link below for an example.
Quoted 8 lines
2Dgraph- 2Ddot_ipv6.svg&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil1 Z6oBURwkTThyuRbLAY9LdfiaT6HA&m=D41w8N- HiTO9kFbxr3kWwW4TVmWav2Zozr9byDbHSj7TRx6egfC1ut70K2HKJQ0y&s=0gZZ VRoev4w7I_KowoRkSn40vymIJgyxS8vBPgEk90c&e=
Signed-off-by Robin Jarry <[email protected]>---
Quoted 34 lines
lib/graph/graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)lib/graph/graph.c index renamed from lib/graph/graph.c +0
-0
d5b8c9f918cf..dff8e690a80d100644lib/graph/graph.c +5
-2@@ -745,7 +745,7 @@ graph_to_dot(FILE *f, struct graph *graph)if (rc <0 ) goto end; }else if (graph_node->node->nb_edges ==0 ) { - rc =fprintf (f," [color=darkorange]" ); + rc =fprintf (f," [fontcolor=darkorange shape=plain]" );if (rc <0 ) goto end; }@@ -753,9 +753,12 @@ graph_to_dot(FILE *f, struct graph *graph)if (rc <0 ) goto end;for (i =0 ; i < graph_node->node->nb_edges; i++) { +const char *node_attrs = attrs; +if (graph_node->adjacency_list[i]->node->nb_edges ==0 ) + node_attrs =" [color=darkorange]" ; rc =fprintf (f,"\t\"%s\" -> \"%s\"%s;\n" , node_name, graph_node->adjacency_list[i]->node- >name, - attrs); + node_attrs);if (rc <0 )lib/graph/graph.c +0
-1goto end; } --2.46.0
David Marchand
AppliedQuoted 7 lines · Robin Jarry
Change the color of arrows leading to sink nodes to dark orange. Remove the node oval shape around the sink nodes and make their text dark orange. This results in a much more readable output for large graphs. See the link below for an example.
Easier to read, thanks.
Quoted 1 line
Signed-off-by Robin Jarry <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand