unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: "Ludovic Courtès" <ludovic.courtes@inria.fr>, 50632@debbugs.gnu.org
Subject: [bug#50632] [PATCH] graph: Add '--max-depth'.
Date: Mon, 20 Sep 2021 17:00:27 +0200	[thread overview]
Message-ID: <CAJ3okZ0Jq_2yResxcoeSShibNDgjhUyZ_+DX5R1UnxXaDx1oEA@mail.gmail.com> (raw)
In-Reply-To: <20210917081848.14264-1-ludo@gnu.org>

Hi,

On Fri, 17 Sept 2021 at 10:38, Ludovic Courtès <ludo@gnu.org> wrote:

> * guix/graph.scm (export-graph): Add #:max-depth and honor it, adding
> 'depths' argument to 'loop'.
> * guix/scripts/graph.scm (%options, show-help): Add '--max-depth'.
> (%default-options): Add 'max-depth'.
> (guix-graph): Pass #:max-depth to 'export-graph'.
> * tests/graph.scm ("package DAG, limited depth"): New test.
> * doc/guix.texi (Invoking guix graph): Document it.
> ---
>  doc/guix.texi          | 14 +++++++++++++
>  guix/graph.scm         | 45 ++++++++++++++++++++++++++----------------
>  guix/scripts/graph.scm | 11 ++++++++++-
>  tests/graph.scm        | 21 +++++++++++++++++++-
>  4 files changed, 72 insertions(+), 19 deletions(-)

LGTM!

> Trimming of nodes beyond the max depth happens at export time.  The
> implementation is a bit naive (with a list containing the depth of
> each node) but performance is mostly unchanged.

Well, I do not see how it could be better. :-)
And export time is also walk time, IIUC. :-)


> diff --git a/doc/guix.texi b/doc/guix.texi
> index 2fc9687910..6c0a581463 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -12598,6 +12598,20 @@ $ guix graph --path -t references emacs libunistring
>  /gnu/store/@dots{}-libunistring-0.9.10
>  @end example
>
> +Sometimes you still want to visualize the graph but would like to trim
> +it so it can actually be displayed.  One way to do it is via the
> +@option{--max-depth} (or @option{-M}) option, which lets you specify the
> +maximum depth of the graph.  In the example below, we visualize only
> +@code{libreoffice} and the nodes whose distance to @code{libreoffice} is
> +at most 2:
> +
> +@example
> +guix graph -M 2 libreoffice | xdot -f fdp -
> +@end example

I am not sure 'xdot' is part of the GraphViz toolsuite.  Instead,

+@example
+guix graph -M 2 libreoffice | fdp -Tsvg > libreoffice.svg
+@end example


Cheers,
simon




  reply	other threads:[~2021-09-20 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  8:18 [bug#50632] [PATCH] graph: Add '--max-depth' Ludovic Courtès
2021-09-20 15:00 ` zimoun [this message]
2021-09-21  8:44   ` Ludovic Courtès
2021-09-21  9:19     ` zimoun
2021-09-21 13:49       ` Ludovic Courtès
2021-09-21 13:45 ` bug#50632: " Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=CAJ3okZ0Jq_2yResxcoeSShibNDgjhUyZ_+DX5R1UnxXaDx1oEA@mail.gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=50632@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=ludovic.courtes@inria.fr \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).