Commit Graph

13 Commits

Author SHA1 Message Date
Ludovic Courtès 36c2192414
graph: Add 'shortest-path'.
* guix/graph.scm (shortest-path): New procedure.
* tests/graph.scm ("shortest-path, packages + derivations")
("shortest-path, reverse packages")
("shortest-path, references"): New tests.
2020-05-11 23:30:55 +02:00
Ludovic Courtès 5e60bef980
Revert "graph: Provide access to the package record in the emit functions."
This reverts commit 5d7e854365, which
broke 'tests/graph.scm' and broke node types not related to <package>
objects, such as '%reference-node-type'.
2017-08-24 23:55:51 +02:00
Roel Janssen 5d7e854365
graph: Provide access to the package record in the emit functions.
* guix/graph.scm (export-graph): Pass the node to the emit functions, instead
  of the node's label.
2017-08-01 22:57:22 +02:00
Roel Janssen 5899fafbfe
graph: Add Cypher backend.
* guix/graph.scm (%cypher-backend): New variable.
* doc/guix.texi: Add documentation for the Cypher backend of 'guix graph'.
2017-05-11 16:17:49 +02:00
Ricardo Wurmus 4d93f312f0
graph: Add d3js backend.
* d3.v3.js, graph.js: New files.
* Makefile.am (EXTRA_DIST): List them.
* guix/graph.scm (%d3js-backend): New variable.
(emit-d3js-prologue, emit-d3js-epilogue, emit-d3js-node,
emit-d3js-edge): New procedures.
(%graph-backends): Add %d3js-backend.
2016-12-14 21:58:32 +01:00
Ricardo Wurmus 642339dc3f
graph: Add "list-backend" and "backend" options.
* guix/graph.scm (%graph-backends): New variable.
* guix/scripts/graph.scm (lookup-backend, list-backends): New
procedures.
(%options): Add options for "backend" and "list-backends".
(show-help): Add help texts for "backend" and "list-backend" options.
(%default-options): Add "backend" default.
(guix-graph): Pass backend argument to "export-graph".
* doc/guix.texi (Invoking guix graph): Document the new options.
2016-12-14 21:57:37 +01:00
Ricardo Wurmus 51377437a1
graph: Backend must have name and description.
* guix/graph.scm (<graph-backend>): Add fields "name" and "description".
(%graphviz-backend): Provide values for name and description.
(export-graph): Ignore name and description when matching backends.
(graph-backend-name, graph-backend-description): New procedures.
* tests/graph.scm (make-recording-backend): Initialize name and
description fields of test graph-backend.
2016-12-14 21:43:06 +01:00
Ludovic Courtès e144e3427d
graph: Add 'node-reachable-count'.
* guix/graph.scm (node-reachable-count): New procedure.
* tests/graph.scm ("node-reachable-count"): New test.
2016-05-24 00:06:01 +02:00
Ludovic Courtès 623e4df42a
graph: Expose 'traverse/depth-first'.
* guix/graph.scm (traverse/depth-first): New procedure, based on code
formerly in 'node-transitive-edges'.
(node-transitive-edges): Rewrite in terms of it.
2016-05-24 00:06:01 +02:00
Ludovic Courtès a773c3142d
graph: Allow store file names for 'derivation' and 'references' graphs.
* guix/scripts/graph.scm (%derivation-node-type)[convert]: Add
'derivation-path?' and catch-all clauses.
(%reference-node-type)[convert]: Add 'store-path?' and catch-all
clauses.
(assert-package, nodes-from-package): New procedures.
(%package-node-type, %bag-node-type,%bag-with-origins-node-type)
(%bag-emerged-node-type): Add 'convert' field
(guix-graph): Rename 'packages' to 'items' and
allow 'store-path?' arguments.
* guix/graph.scm (<node-type>)[convert]: Adjust comment.
* doc/guix.texi (Invoking guix graph): Document it.
2016-05-21 01:35:14 +02:00
Ludovic Courtès 8463d1345e graph: Edges are colored based on their source node.
* guix/graph.scm (%colors): New variable.
(pop-color): New procedure.
(emit-edge): Use it.
2016-04-02 22:40:18 +02:00
Ludovic Courtès 923d846c4d graph: Add procedures to query a node's edges.
* guix/graph.scm (%node-edges, node-edges, node-back-edges)
(node-transitive-edges): New procedures.
* tests/graph.scm ("node-edges")
("node-transitive-edges + node-back-edges"): New tests.
2015-11-21 16:26:43 +01:00
Ludovic Courtès 8fb583714f Add (guix graph).
* guix/scripts/graph.scm (<node-type>, <graph-backend>, emit-prologue)
(emit-epilogue, emit-node, emit-edge, %graphviz-backend, export-graph):
Move to...
* guix/graph.scm: ... here.  New file.
* guix/scripts/system.scm, tests/graph.scm: Use it.
* Makefile.am (MODULES): Add it.
2015-11-21 16:26:43 +01:00