From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2IjjBmeiSGG9xQAAgWs5BA (envelope-from ) for ; Mon, 20 Sep 2021 17:01:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id GJFtAmeiSGHvEAAAbx9fmQ (envelope-from ) for ; Mon, 20 Sep 2021 15:01:59 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B6653CDA0 for ; Mon, 20 Sep 2021 17:01:58 +0200 (CEST) Received: from localhost ([::1]:51562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSKns-0005B5-Ju for larch@yhetil.org; Mon, 20 Sep 2021 11:01:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSKn0-00058W-EC for guix-patches@gnu.org; Mon, 20 Sep 2021 11:01:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSKn0-00017u-68 for guix-patches@gnu.org; Mon, 20 Sep 2021 11:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mSKn0-0008FS-5E for guix-patches@gnu.org; Mon, 20 Sep 2021 11:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50632] [PATCH] graph: Add '--max-depth'. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Sep 2021 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50632 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 50632@debbugs.gnu.org Received: via spool by 50632-submit@debbugs.gnu.org id=B50632.163215004730752 (code B ref 50632); Mon, 20 Sep 2021 15:01:02 +0000 Received: (at 50632) by debbugs.gnu.org; 20 Sep 2021 15:00:47 +0000 Received: from localhost ([127.0.0.1]:43813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSKmk-0007zc-N6 for submit@debbugs.gnu.org; Mon, 20 Sep 2021 11:00:46 -0400 Received: from mail-qt1-f178.google.com ([209.85.160.178]:34590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSKmj-0007tG-3p for 50632@debbugs.gnu.org; Mon, 20 Sep 2021 11:00:45 -0400 Received: by mail-qt1-f178.google.com with SMTP id 2so15821382qtw.1 for <50632@debbugs.gnu.org>; Mon, 20 Sep 2021 08:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=oDeulhE14bSStetOnGHUyQAlAYJ33D4EslWpMB+y0ns=; b=iInoT9TjMohFXGPiWGf2mJ+BBwMZqXH4qtylmysW7lvDso8G30yjvUHtS68FWjR9/Y aa+UGSzoeZRkTgI1PJ07Hobt2GzfTZwazH8vfpZzR+st5yqe6MjAc9qkhYb2/EppJhIN wmTIqoz0iudEoFxwCJlU6pD40mQ7fxZeNuVrFIxGLBbJMGhh4xrhMh2H7wAMYsurECCP OLaFm3jdOzp6JJVPda0YLe6bpa8xR7simVorLy2qElDBQgmx85gOGIsCYGOl4hnQF43D MywLzYhMG+faixisLnLmkcNkUxOLLeaYlLG5wf3Q7x39SrARBynzxOgD0S3oo990IPD0 joQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=oDeulhE14bSStetOnGHUyQAlAYJ33D4EslWpMB+y0ns=; b=PxqXlBICguictTzllvaJV6dMW1wVlVrfvuPyvAAv2fOEr+bnnO667qWuxkOPe9yrAO fE2U4RXLa2PRuqFPbnxxTJJ1RPWr0g5uRUhHsYc4lcyJIvRpIMxK1RpqKOkvdv9LBNaW QfEcS4MoVjvsbFrOu7h3Zqg633W5BaR8spbvaoTi0ae5LmwUmNDxMgWsBDlOFsBh2l1a VEiJ0J7wCUXQtvpCs92/dlaQWpF5YERMbyp4BHXFhEyOrgEEWQpoVBJR7GjHrEqve1Kz v99ScAANfOAY99GczXiYm81DDWSdf2LwBNzbFtzlhuoY6T2jkqC3BPTRRlfCK8jhi91K di2Q== X-Gm-Message-State: AOAM532DCPtZ++ZWniVDSnkYZ1gNZ7GN2RC+CyT/FUGjh/LliYSvANkf 1he6ZtJvDhREZ8H6hSFpDtxwN+dVxPyECAAL+YjEKQCP4CE= X-Google-Smtp-Source: ABdhPJyCwBtiPx3FAIhKrCkx17i0ueJ04kDnjXWnbRaP1o+1Fqd/M1dRb7Xjqgs2Z19CpmukQ2eJTvVFqEz/XyhLL/I= X-Received: by 2002:ac8:570f:: with SMTP id 15mr23705024qtw.335.1632150039395; Mon, 20 Sep 2021 08:00:39 -0700 (PDT) MIME-Version: 1.0 References: <20210917081848.14264-1-ludo@gnu.org> In-Reply-To: <20210917081848.14264-1-ludo@gnu.org> From: zimoun Date: Mon, 20 Sep 2021 17:00:27 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632150118; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oDeulhE14bSStetOnGHUyQAlAYJ33D4EslWpMB+y0ns=; b=Z2SduPO6AUcmdOQE+emOqHH+U6Fr6C8Wn3hswyOCuar/VlsReau4la6xqOrUknmwFdgWpT DCkHHo422mi9X8vCbAhBO52H8OFyec/dyVXWApiUKimAWtK8eOnmpD2YMhAJLuq7bXnZsj QxjpsvtVhSclLDjdQLj8yFq/dB2K/J+quNgzXq6owrAlyl6izjr93+xNun2uR3Z30KShar tLXuXsMbXhghpTXiDSN3Xb/WXfGBlBQh+hj8kwq/nHdMT6jcvaUohgwAvEE0PJXpQ89Uum NGZ0zy2/vUNbJDSLcXuqD7NniX97MunbHvMRF9xL5aqL6DMA1PzYU8kNEppVIQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632150118; a=rsa-sha256; cv=none; b=QapIP8hcucwMlKaShAP7/mGRZvw6iaadIqE/2DmWk/4istadkqCmqR/ity4v0z1GbZuamT QYKuMuERKpi/ue4QUEfzSfzJt/wJVq9Gk9NnNUDDLkbcR3jSWVu9y2pWn/wl9eFyUyY3V7 u2lt4nmPIyP9f3g+HDrztVGaQa+m11Ab+3JjTjlayzSbZs6kQjIpH6g/ct5Zzgop3qwMJU A3x3o8FgL14LPqtCyAzeCokFRgG1UpUAXTSZps7oC4XprXoKZ+z1T3l7C58dTqX5tvLQOS IsbEmLmBK63Pbpp+zOyCgqCak9U+l8BOJB+rSEpbuKu4YIJyuzZlXnxJ5sQZmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=iInoT9Tj; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.29 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=iInoT9Tj; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: B6653CDA0 X-Spam-Score: -1.29 X-Migadu-Scanner: scn0.migadu.com X-TUID: Ku2KusdLLevq Hi, On Fri, 17 Sept 2021 at 10:38, Ludovic Court=C3=A8s 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 libunist= ring > /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