GNU bug report logs - #30711
[PATCH 1/1] guix: graph: Add Trival Graph Format (TGF) backend.

Previous Next

Package: guix-patches;

Reported by: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Date: Mon, 5 Mar 2018 11:42:02 UTC

Severity: normal

Tags: patch

Done: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#30711: closed ([PATCH 1/1] guix: graph: Add Trival Graph 
 Format (TGF) backend.)
Date: Tue, 06 Mar 2018 20:21:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 6 Mar 2018 21:20:48 +0100
with message-id <8a311dbb-676e-17ee-79df-d0ab52c6f752 <at> crazy-compilers.com>
and subject line Re: [bug#30711] [PATCH 1/1] guix: graph: Add Trival Graph Format (TGF) backend.
has caused the debbugs.gnu.org bug report #30711,
regarding [PATCH 1/1] guix: graph: Add Trival Graph  Format (TGF) backend.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
30711: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30711
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: guix-patches <at> gnu.org
Subject: [PATCH 1/1] guix: graph: Add Trival Graph  Format (TGF) backend.
Date: Mon,  5 Mar 2018 12:41:36 +0100
* guix/graph.scm ((emit-edge, emit-d3js-edge, emit-cypher-edge): New arguments
  label1 , label2.
  (emit-tg-progloug, mit-tgf-epilouge, emit-tgf-node, emit-tgf-edge): New
  variables.
  (%trivial-graph-backend): New variable.
  (%graph-backends): Add %trivial-graph-backend.
  (export-graph): Pass labels to emit-edge.
---
 guix/graph.scm | 40 ++++++++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/guix/graph.scm b/guix/graph.scm
index d7fd5f3e4..650d577f6 100644
--- a/guix/graph.scm
+++ b/guix/graph.scm
@@ -46,6 +46,7 @@
             %graph-backends
             %d3js-backend
             %graphviz-backend
+            %trival-graph-backend
             graph-backend?
             graph-backend
             graph-backend-name
@@ -173,7 +174,7 @@ typically returned by 'node-edges' or 'node-back-edges'."
 (define (emit-node id label port)
   (format port "  \"~a\" [label = \"~a\", shape = box, fontname = Helvetica];~%"
           id label))
-(define (emit-edge id1 id2 port)
+(define (emit-edge id1 label1 id2 label2 port)
   (format port "  \"~a\" -> \"~a\" [color = ~a];~%"
           id1 id2 (pop-color id1)))
 
@@ -219,7 +220,7 @@ nodes[\"~a\"] = {\"id\": \"~a\", \"label\": \"~a\", \"index\": nodeArray.length}
 nodeArray.push(nodes[\"~a\"]);~%"
           id id label id))
 
-(define (emit-d3js-edge id1 id2 port)
+(define (emit-d3js-edge id1 label1 id2 label2 port)
   (format port "links.push({\"source\": \"~a\", \"target\": \"~a\"});~%"
           id1 id2))
 
@@ -245,7 +246,7 @@ nodeArray.push(nodes[\"~a\"]);~%"
   (format port "MERGE (p:Package { id: ~s }) SET p.name = ~s;~%"
           id label ))
 
-(define (emit-cypher-edge id1 id2 port)
+(define (emit-cypher-edge id1 label1 id2 label2 port)
   (format port "MERGE (a:Package { id: ~s });~%" id1)
   (format port "MERGE (b:Package { id: ~s });~%" id2)
   (format port "MATCH (a:Package { id: ~s }), (b:Package { id: ~s }) CREATE UNIQUE (a)-[:NEEDS]->(b);~%"
@@ -260,13 +261,32 @@ nodeArray.push(nodes[\"~a\"]);~%"
 
 
 ;;;
+;;; Trivial graph export.
+;;;
+
+(define (emit-tgf-prologue name port) #t)
+(define (emit-tgf-epilogue port) #t)
+(define (emit-tgf-node id label port) #t)
+(define (emit-tgf-edge id1 label1 id2 label2 port)
+  (format port "~a ~a~%" label1 label2))
+
+(define %trival-graph-backend
+  (graph-backend "tgf"
+                 "Generate graph in Trivial Graph Format."
+                 emit-tgf-prologue emit-tgf-epilogue
+                 emit-tgf-node emit-tgf-edge))
+
+
+
+;;;
 ;;; Shared.
 ;;;
 
 (define %graph-backends
   (list %graphviz-backend
         %d3js-backend
-        %cypher-backend))
+        %cypher-backend
+        %trival-graph-backend))
 
 (define* (export-graph sinks port
                        #:key
@@ -299,8 +319,16 @@ true, draw reverse arrows."
                      (emit-node id (node-label head) port)
                      (for-each (lambda (dependency dependency-id)
                                  (if reverse-edges?
-                                     (emit-edge dependency-id id port)
-                                     (emit-edge id dependency-id port)))
+                                     (emit-edge dependency-id
+                                                (node-label dependency)
+                                                id
+                                                (node-label head)
+                                                port)
+                                     (emit-edge id
+                                                (node-label head)
+                                                dependency-id
+                                                (node-label dependency)
+                                                port)))
                                dependencies ids)
                      (loop (append dependencies tail)
                            (set-insert id visited)))))))))))))
-- 
2.13.6



[Message part 3 (message/rfc822, inline)]
From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 30711-close <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#30711] [PATCH 1/1] guix: graph: Add Trival Graph Format
 (TGF) backend.
Date: Tue, 6 Mar 2018 21:20:48 +0100
Hi,

I'm retracting this patch. The implementation is wrong, fixing it
requires too many changes and the use is arguable. So we should not
spend much tome on it.

Thanks for reviewing and feedback :-)

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |



This bug report was last modified 7 years and 130 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.