DPDK patches and discussions
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Jerin Jacob <jerinj@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Zhirun Yan <yanzhirun_163@163.com>
Subject: [PATCH dpdk] graph: make graphviz export more readable
Date: Wed, 28 Aug 2024 15:42:27 +0200	[thread overview]
Message-ID: <20240828134226.866655-2-rjarry@redhat.com> (raw)

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.

Link: https://f.jarry.cc/rte-graph-dot/ipv6.svg
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 lib/graph/graph.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/graph/graph.c b/lib/graph/graph.c
index d5b8c9f918cf..dff8e690a80d 100644
--- a/lib/graph/graph.c
+++ b/lib/graph/graph.c
@@ -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;
 		}
-- 
2.46.0


             reply	other threads:[~2024-08-28 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 13:42 Robin Jarry [this message]
2024-08-29  5:47 ` [EXTERNAL] " Kiran Kumar Kokkilagadda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240828134226.866655-2-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=yanzhirun_163@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).