From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +GVQMy9u7GMAVQEAbAwnHQ (envelope-from ) for ; Wed, 15 Feb 2023 06:31:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id ELRsMy9u7GPx/wAAauVa8A (envelope-from ) for ; Wed, 15 Feb 2023 06:31:27 +0100 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 ACD67FD67 for ; Wed, 15 Feb 2023 06:31:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSANm-0006kH-92; Wed, 15 Feb 2023 00:31:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSANi-0006jY-Ib for guix-patches@gnu.org; Wed, 15 Feb 2023 00:31:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSANi-0000Ss-9F for guix-patches@gnu.org; Wed, 15 Feb 2023 00:31:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSANh-0007Wn-OJ for guix-patches@gnu.org; Wed, 15 Feb 2023 00:31:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61527] [PATCH] Add edgelist graph backend Resent-From: Kyle Andrews Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Feb 2023 05:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61527 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61527@debbugs.gnu.org X-Debbugs-Original-To: Guix Patches Received: via spool by submit@debbugs.gnu.org id=B.167643904828911 (code B ref -1); Wed, 15 Feb 2023 05:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Feb 2023 05:30:48 +0000 Received: from localhost ([127.0.0.1]:57581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSANT-0007WE-NR for submit@debbugs.gnu.org; Wed, 15 Feb 2023 00:30:48 -0500 Received: from lists.gnu.org ([209.51.188.17]:39724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSANR-0007W6-Ji for submit@debbugs.gnu.org; Wed, 15 Feb 2023 00:30:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSANQ-0006iw-BD for guix-patches@gnu.org; Wed, 15 Feb 2023 00:30:45 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSANO-0000Aj-AF for guix-patches@gnu.org; Wed, 15 Feb 2023 00:30:44 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C80B4240287 for ; Wed, 15 Feb 2023 06:30:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1676439038; bh=lUr7DIWCDox3PbrpO64vLcDA11izcru2oLBa4rb+h78=; h=From:To:Subject:Date:From; b=S8LVXc8An/+zgH0v3f6d8anfFvLF7ObDgtVxZ+bweNBdmqQJ/2p89UsqI1r3AiOfz U4Cj5bj7+zZcgbGWh9E72AraMURTpOWvx5KlQOpvzysefOR9WfyL4NdRyDn6vMuAFh YAIIAL19cKToIphDAl5JlW3CSx9CkxnM/LlRryOjdaGAgCARptgnCFEV6QMXLvZJDL +9//k1frNicuO0mdFnW/yrHiQKz4LdcZ1WFjm1CTJonCfD/FY18UgvVtwJDuv7NmQi dDGR1JsJzRF9+M51pAvQDQnjsH4N8rqbEgM8olXcjoSLvQVqXGExSRViO1jFYuuZ+p Pk7gXGbZuTjBw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PGmrF5w6Fz9rxH for ; Wed, 15 Feb 2023 06:30:36 +0100 (CET) From: Kyle Andrews Date: Wed, 15 Feb 2023 05:21:35 +0000 Message-ID: <875yc3sdfo.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=kyle@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676439087; a=rsa-sha256; cv=none; b=u2BJYFlxXz7JU//gWDuE+OWH6wMczqz1mA9pPD89Wdb3p2lpn3rVst6DECBMVHNqFcr+KU yOd6UqhFf/vtXOa9BkDMy+IkQElakgLUatYiDRPF2zruGPPWnsB+ioFdNkLMFam2Eji+7V kdxN+0o3TTdoesdcnvrgMQFfycptRvhZz2qHg66MD4iNrOxnBKHSfSlCjFyXHqBmS/iv33 mCoFnHWCJQZOePJY0hsiwrJRGr1Z2w0MlaCLC2l9psfkaAn1rZS1iPy+UdyP6FQ6KRHNxH 2XlZcf5gNoku+TUBs0LJHXgjVhb8Hfo0l4/0z7lQ1MGodBkrFr03f/ZBN5qobw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=S8LVXc8A; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676439087; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=00TlubDLT9CCJ82ZoUgo5sMvMpCLGjB0SmJa28Ixk28=; b=UIhSp0zvWKfqtdY/OimBRWt5ZyTZS9YBA6wSKRP+1fMA7HJv7O76jrytI6TimXE/eBhpvB lUuZqG9bQXMqaehXBz1gm8HlmfmWfy/lZ3yNFsqLdD7RYflVWci6v3P71mRDx39c1+z8UP 5qV9nq79XoMkz1iiNRkK9Iu6U/OzgEuEst8MI9/Xhvayrznnfg3XYD2qdfn9mQ7nVynONL EZ0OGO6Oc3VePMZl82rfMNofWq04+RDtu9aMB8Jwp5fwChw8LkpYIREOLhmaLCD1guprcO poclW83nEcGXIaf0SBknmMWxMBfLbCX8nCZhIBcSeVRN5RAFXJ2sem2pMRsB5g== X-Migadu-Spam-Score: -2.42 X-Spam-Score: -2.42 X-Migadu-Queue-Id: ACD67FD67 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=S8LVXc8A; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-TUID: AecpucOp84dW --=-=-= Content-Type: text/plain Dear Guix, I would like to be able to conveniently analyze Guix package dependencies using general purpose network analysis software such as igraph. To achieve this, I have added another backend to Guix and which is exposed via guix graph which spits out a three column table that, while not technically and edge list, is readily transformed into one with minimal data munging. Please see the attached patch file which I have created with `git diff' from my working tree since I am not yet comfortable with more advanced git workflows. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=edgelist-graph-backend.patch Content-Description: edgelist backend patch diff --git a/guix/graph.scm b/guix/graph.scm index 41219ab67d..e1760ed92a 100644 --- a/guix/graph.scm +++ b/guix/graph.scm @@ -255,6 +255,24 @@ (define %graphviz-backend emit-prologue emit-epilogue emit-node emit-edge)) +(define (emit-edgelist-prologue name port) + (display "" port)) + +(define (emit-edgelist-epilogue port) + (display "" port)) + +(define (emit-edgelist-node id label port) + (format port "package, ~a, ~a\n" label id)) + +(define (emit-edgelist-edge id1 id2 port) + (format port "depends, ~a, ~a\n" id1 id2)) + +(define %edgelist-backend + (graph-backend "edgelist" + "Generate graph in CSV edge list format" + emit-edgelist-prologue emit-edgelist-epilogue + emit-edgelist-node emit-edgelist-edge)) + ;;; ;;; d3js export. @@ -338,7 +356,8 @@ (define %cypher-backend (define %graph-backends (list %graphviz-backend %d3js-backend - %cypher-backend)) + %cypher-backend + %edgelist-backend)) (define (lookup-backend name) "Return the graph backend called NAME. Raise an error if it is not found." --=-=-=--