[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help adding a graph backend
From: |
Kyle Andrews |
Subject: |
Help adding a graph backend |
Date: |
Fri, 10 Feb 2023 03:10:02 +0000 |
Dear Guix,
I am not very comfortable editing Guix source code. However, I would
very much like to add a new backend for `guix graph`. Right now guix
graph descriptions can only be exported into special purpose tools like
graphviz, D3, and cypher. I would like to add a fourth option which
would support loading the dependency data into general purpose network analysis
software tools: an edgelist backend.
=> https://en.wikipedia.org/wiki/Edge_list
I think this code will do the job, but I don't know how to test it. So, I don't
know for sure.
``` guix/graph.scm
(define (el-prologue name port)
(display "from, to" port))
(define (el-epilogue port)
(display "\n" port))
(define (el-node id label port)
(display "" port))
(define (el-edge id1 id2 port)
(format port "~a, ~a\n"))
(define %edgelist-backend
(graph-backend "edgelist"
"Generate graph in CSV edge list format"
el-prologue el-epilogue
el-node el-edge))
(define %graph-backends
(list %graphviz-backend
%d3js-backend
%cypher-backend
%edgelist-backend)) ; <- the new proposed backend
```
Maybe it would be using some incantation involving ./pre-inst-env? I gave it a
try following the manual:
```
cd ~/{{path/to/guix}}
guix shell -D guix
./bootstrap
./configure
```
This gave an error:
```
configure: error: chosen localstatedir '/usr/local/var' does not match that of
the existing installation '/var'
Installing may corrupt /gnu/store!
Use './configure --localstatedir=/var'.
```
Since I am not that excited about corrupting my /gnu/store given that I don't
know what I am doing, I didn't proceed further.
I figured because I wanted to extend Guix with a new feature and that I
could piece together a story in my head about how the code should look, my
query should be sent to this list rather than to help-guix.
Thanks in advance for any helpful suggestions towards getting this backend
added to Guix!
Cheers,
Kyle
- Help adding a graph backend,
Kyle Andrews <=