projects/guix·blob java-team · refs

1015 lines · 39.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017-2026 Ricardo Wurmus <[email protected]>
3;;; Copyright © 2018 Joshua Sierles, Nextjournal <[email protected]>
4;;; Copyright © 2018, 2020, 2022 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2019, 2021, 2022, 2024 Efraim Flashner <[email protected]>
6;;; Copyright © 2019 Andreas Enge <[email protected]>
7;;; Copyright © 2020 Alexander Krotov <[email protected]>
8;;; Copyright © 2020 Pierre Langlois <[email protected]>
9;;; Copyright © 2021, 2023, 2025 Vinicius Monego <[email protected]>
10;;; Copyright © 2021 Alexandre Hannud Abdo <[email protected]>
11;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <[email protected]>
12;;; Copyright © 2022 Marius Bakke <[email protected]>
13;;; Copyright © 2023 David Elsing <[email protected]>
14;;; Copyright © 2025 Mark Walker <[email protected]>
15;;; Copyright © 2025 Tiago de Paula Peixoto <[email protected]>
16;;; Copyright © 2026 Luca Alloatti <[email protected]>
17;;; Copyright © 2026 Arun Isaac <[email protected]>
18;;;
19;;; This file is part of GNU Guix.
20;;;
21;;; GNU Guix is free software; you can redistribute it and/or modify it
22;;; under the terms of the GNU General Public License as published by
23;;; the Free Software Foundation; either version 3 of the License, or (at
24;;; your option) any later version.
25;;;
26;;; GNU Guix is distributed in the hope that it will be useful, but
27;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29;;; GNU General Public License for more details.
30;;;
31;;; You should have received a copy of the GNU General Public License
32;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34(define-module (gnu packages graph)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system pyproject)
39 #:use-module (guix build-system r)
40 #:use-module (guix download)
41 #:use-module (guix gexp)
42 #:use-module (guix git-download)
43 #:use-module (guix packages)
44 #:use-module (guix utils)
45 #:use-module (gnu packages)
46 #:use-module (gnu packages autotools)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages bioconductor)
49 #:use-module (gnu packages bioinformatics)
50 #:use-module (gnu packages bison)
51 #:use-module (gnu packages boost)
52 #:use-module (gnu packages c)
53 #:use-module (gnu packages check)
54 #:use-module (gnu packages compression)
55 #:use-module (gnu packages cran)
56 #:use-module (gnu packages datastructures)
57 #:use-module (gnu packages docbook)
58 #:use-module (gnu packages compiler-tools)
59 #:use-module (gnu packages fontutils)
60 #:use-module (gnu packages gd)
61 #:use-module (gnu packages graphics)
62 #:use-module (gnu packages graphviz)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages image)
65 #:use-module (gnu packages linux)
66 #:use-module (gnu packages machine-learning)
67 #:use-module (gnu packages maths)
68 #:use-module (gnu packages mpi)
69 #:use-module (gnu packages multiprecision)
70 #:use-module (gnu packages ncurses)
71 #:use-module (gnu packages pkg-config)
72 #:use-module (gnu packages pretty-print)
73 #:use-module (gnu packages python)
74 #:use-module (gnu packages python-build)
75 #:use-module (gnu packages python-check)
76 #:use-module (gnu packages python-compression)
77 #:use-module (gnu packages python-science)
78 #:use-module (gnu packages python-web)
79 #:use-module (gnu packages python-xyz)
80 #:use-module (gnu packages qt)
81 #:use-module (gnu packages statistics)
82 #:use-module (gnu packages swig)
83 #:use-module (gnu packages time)
84 #:use-module (gnu packages xml))
85
86(define-public plfit
87 (package
88 (name "plfit")
89 (version "0.9.4")
90 (source (origin
91 (method git-fetch)
92 (uri (git-reference
93 (url "https://github.com/ntamas/plfit")
94 (commit version)))
95 (file-name (git-file-name name version))
96 (sha256
97 (base32
98 "042b60cnsz5wy27sz026xs0mnn9p58j46crgs78skncgkvzqyyc6"))))
99 (build-system cmake-build-system)
100 (arguments
101 '(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON")))
102 (home-page "https://github.com/ntamas/plfit")
103 (synopsis "Tool for fitting power-law distributions to empirical data")
104 (description "The @command{plfit} command fits power-law distributions to
105empirical (discrete or continuous) data, according to the method of Clauset,
106Shalizi and Newman (@cite{Clauset A, Shalizi CR and Newman MEJ: Power-law
107distributions in empirical data. SIAM Review 51, 661-703 (2009)}).")
108 (license license:gpl2+)))
109
110(define-public igraph
111 (package
112 (name "igraph")
113 (version "0.10.15")
114 (source
115 (origin
116 (method git-fetch)
117 (uri (git-reference
118 (url "https://github.com/igraph/igraph")
119 (commit version)))
120 (file-name (git-file-name name version))
121 (modules '((guix build utils)
122 (ice-9 ftw)
123 (srfi srfi-26)))
124 (snippet '(begin
125
126 (delete-file-recursively "vendor")
127 (delete-file-recursively "src/isomorphism/bliss")
128 (substitute* '("src/CMakeLists.txt"
129 "etc/cmake/benchmark_helpers.cmake")
130 ;; Remove extraneous bundling related variables.
131 ((".*_IS_VENDORED.*") "")
132 ((".*add_sub.*isomorphism/bliss.*") "")
133 (("(.*TARGETS.*)bliss(.*)cxsparse_vendored(.*)pcg(.*)"
134 _ part1 part2 part3 part4)
135 (string-append part1 part2 part3 part4))
136 (("cxsparse_vendored") "cxsparse")
137 ((" pcg ") " pcg_random "))
138 (substitute* "CMakeLists.txt"
139 (("add_sub.*vendor.*") ""))))
140 (sha256
141 (base32
142 "0z9jqvl65j4z6brrjlfyykba2bs10az6dx6m8g41snlfnx21a82d"))))
143 (build-system cmake-build-system)
144 (arguments
145 (list
146 #:configure-flags
147 #~(list "-DBUILD_SHARED_LIBS=ON"
148 ;; Use the same integer width as suitesparse-cxsparse, which
149 ;; uses int64_t in SuiteSparse v6.0.0 and later.
150 "-DIGRAPH_INTEGER_SIZE=64")
151 #:modules '((guix build cmake-build-system)
152 ((guix build gnu-build-system) #:prefix gnu:)
153 (guix build utils))
154 #:phases
155 #~(modify-phases %standard-phases
156 (add-after 'unpack 'version-file
157 (lambda _
158 (let ((port (open-file "IGRAPH_VERSION" "w")))
159 (display #$version port)
160 (close port))))
161 (add-after 'unpack 'patch-suitesparse
162 (lambda _
163 (substitute* '("src/core/sparsemat.c"
164 "include/igraph_sparsemat.h")
165 (("<cs/cs\\.h>") "<cs.h>")
166 (("cs_igraph") "cs_dl")
167 (("__BEGIN_DECLS.*" all)
168 (string-append all "\n#define CS_LONG\n")))))
169 (add-after 'unpack 'patch-pcg
170 (lambda _
171 (substitute* '("src/random/rng_pcg32.c"
172 "src/random/rng_pcg64.c")
173 (("#include \"pcg/(.*)\"" _ name)
174 (string-append "#include <" name ">")))))
175 (add-after 'unpack 'patch-bliss
176 (lambda _
177 (substitute* "src/isomorphism/bliss.cc"
178 (("#include \"bliss.*")
179 (string-append
180 "#include <bliss/graph.hh>\n"
181 "#include <bliss/digraph.hh>\n")))))
182 (add-after 'build 'build-doc
183 (lambda _
184 (invoke "cmake" "--build" "." "--target" "html")))
185 (replace 'check (assoc-ref gnu:%standard-phases 'check))
186 (add-after 'install 'install-doc
187 (lambda _
188 (copy-recursively
189 "doc/html"
190 (string-append #$output "/share/doc/"
191 #$name "-" #$version "/html")))))))
192 (native-inputs
193 (list bison
194 docbook-xml-4.3
195 docbook-xsl
196 flex
197 pcg-c
198 pkg-config
199 ;; For the HTML documentation.
200 python
201 source-highlight
202 xmlto))
203 (inputs
204 (list arpack-ng
205 bliss
206 glpk
207 ;lapack
208 openblas
209 plfit
210 suitesparse-cxsparse))
211 ;; libxml2 is in the 'Requires.private' of igraph.pc.
212 (propagated-inputs (list libxml2))
213 (home-page "https://igraph.org")
214 (synopsis "Network analysis and visualization")
215 (description
216 "This package provides a library for the analysis of networks and graphs.
217It can handle large graphs very well and provides functions for generating
218random and regular graphs, graph visualization, centrality methods and much
219more.")
220 (license license:gpl2+)))
221
222;; This is not really for r-rigraphlib; it is rather to replace the need for
223;; r-rigraphlib, which is merely repackaging igraph as a static library for
224;; use with R packages.
225(define-public igraph-for-r-rigraphlib
226 (hidden-package
227 (package
228 (inherit igraph)
229 (name "igraph")
230 (version "1.0.1")
231 (source
232 (origin
233 (inherit (package-source igraph))
234 (patches '())
235 (method git-fetch)
236 (uri (git-reference
237 (url "https://github.com/igraph/igraph")
238 (commit version)))
239 (file-name (git-file-name name version))
240 (sha256
241 (base32
242 "01mynhbl2ph0gkc0zr5klwqvczwcimfs2kdn6didwg4k8gsrcxlr"))
243 (modules '((guix build utils)
244 (ice-9 ftw)
245 (srfi srfi-26)))
246 ;; We need the vendored versions of qhull and cxsparse.
247 (snippet '(begin
248 (delete-file-recursively "src/isomorphism/bliss")
249 (substitute* '("src/CMakeLists.txt"
250 "etc/cmake/benchmark_helpers.cmake")
251 ;; Remove extraneous bundling related variables.
252 ((".*_IS_VENDORED.*") "")
253 ((".*add_sub.*isomorphism/bliss.*") "")
254 (("(.*TARGETS.*)bliss(.*)pcg(.*)"
255 _ part1 part2 part3)
256 (string-append part1 part2 part3))
257 ((" pcg ") " pcg_random "))))))
258 (arguments
259 (substitute-keyword-arguments (package-arguments igraph)
260 ((#:phases phases '%standard-phases)
261 #~(modify-phases #$phases
262 ;; We have to use the bundled version because it has been
263 ;; modified from upstream.
264 (delete 'patch-suitesparse)))
265 ((#:configure-flags flags)
266 #~(list "-DBUILD_SHARED_LIBS=ON"
267 "-DIGRAPH_INFOMAP_SUPPORT=OFF"
268 "-DCMAKE_C_FLAGS=-Wno-error=incompatible-pointer-types"
269 ;; Use the same integer width as suitesparse-cxsparse, which
270 ;; uses int64_t in SuiteSparse v6.0.0 and later.
271 "-DIGRAPH_INTEGER_SIZE=64"))))
272 (inputs
273 (modify-inputs (package-inputs igraph)
274 (delete "suitesparse-cxsparse"))))))
275
276(define-public python-igraph
277 (package
278 (inherit igraph)
279 (name "python-igraph")
280 (version "0.11.8")
281 (source (origin
282 (method git-fetch)
283 ;; The PyPI archive lacks tests.
284 (uri (git-reference
285 (url "https://github.com/igraph/python-igraph")
286 (commit version)))
287 (file-name (git-file-name name version))
288 (sha256
289 (base32
290 "1c73nypzm2apqqwzqxxhbh692h4ri2x8q4i8f7q2kwczz156v19k"))))
291 (build-system pyproject-build-system)
292 (arguments
293 (list
294 #:phases
295 #~(modify-phases %standard-phases
296 (add-after 'unpack 'specify-libigraph-location
297 (lambda _
298 (let ((igraph #$(this-package-input "igraph")))
299 (substitute* "setup.py"
300 (("(LIBIGRAPH_FALLBACK_INCLUDE_DIRS = ).*" _ var)
301 (string-append
302 var (format #f "[~s]~%"
303 (string-append igraph "/include/igraph"))))
304 (("(LIBIGRAPH_FALLBACK_LIBRARY_DIRS = ).*" _ var)
305 (string-append
306 var (format #f "[~s]~%"
307 (string-append igraph "/lib")))))))))))
308 (inputs (list igraph))
309 (propagated-inputs
310 (list python-texttable))
311 (native-inputs
312 (list python-pytest
313 python-setuptools
314 python-wheel))
315 (home-page "https://igraph.org/python/")
316 (synopsis "Python bindings for the igraph network analysis library")))
317
318(define-public r-rbiofabric
319 (let ((commit "666c2ae8b0a537c006592d067fac6285f71890ac")
320 (revision "1"))
321 (package
322 (name "r-rbiofabric")
323 (version (string-append "0.3-" revision "." (string-take commit 7)))
324 (source (origin
325 (method git-fetch)
326 (uri (git-reference
327 (url "https://github.com/wjrl/RBioFabric")
328 (commit commit)))
329 (file-name (string-append name "-" version "-checkout"))
330 (sha256
331 (base32
332 "1yahqrcrqpbcywv73y9rlmyz8apdnp08afialibrr93ch0p06f8z"))))
333 (build-system r-build-system)
334 (propagated-inputs
335 (list r-igraph))
336 (home-page "http://www.biofabric.org/")
337 (synopsis "BioFabric network visualization")
338 (description "This package provides an implementation of the function
339@code{bioFabric} for creating scalable network digrams where nodes are
340represented by horizontal lines, and edges are represented by vertical
341lines.")
342 (license license:expat))))
343
344(define-public python-ece608-toposort
345 ;; No releases.
346 (let ((commit "c6c0187327de27139f58e944d488e025d901792c")
347 (revision "0"))
348 (package
349 (name "python-ece608-toposort")
350 (version (git-version "0.0.0" revision commit))
351 (source
352 (origin
353 (method git-fetch)
354 (uri (git-reference
355 (url "https://github.com/suntosh/ece608-toposort")
356 (commit commit)))
357 (file-name (git-file-name name version))
358 (sha256
359 (base32 "1fs8mip83p7724yjnzrhxa4x3zyhx7x44jfyfy8vf3kp6nnrjg24"))))
360 (build-system pyproject-build-system)
361 (native-inputs
362 (list python-hatchling python-pytest))
363 (home-page "https://github.com/suntosh/ece608-toposort")
364 (synopsis "Topological sorting of directed graphs")
365 (description
366 "This package provides a Python implementation of topological ordering
367of directed graphs by two independent routes - Kahn's algorithm and DFS
368reverse postorder - with cycle detection that tells you which nodes cycle, not
369merely that one exists.
370
371No runtime dependencies. The graph container is part of the package, in about
372170 lines. That is a deliberate choice for a teaching implementation: the
373point is to show the algorithms, and a dependency on @code{networkx} would
374mean the interesting parts live in someone else's repository.")
375 (license license:expat))))
376
377(define-public python-louvain
378 ;; The latest release doesn't build with [email protected].
379 (let ((commit "def91793772c3e77ab4167d175903a5365c24b4b")
380 (revision "0"))
381 (package
382 (name "python-louvain")
383 (version (git-version "0.16" revision commit))
384 (source
385 (origin
386 (method git-fetch)
387 (uri (git-reference
388 (url "https://github.com/taynaud/python-louvain")
389 (commit commit)))
390 (file-name (git-file-name name version))
391 (sha256
392 (base32 "014wzmwnbqgp1lrsc93p4mq3dqar01zv0v8cqrgm5jggvnskqn0c"))))
393 (build-system pyproject-build-system)
394 (arguments (list #:test-backend #~'unittest))
395 (native-inputs (list python-setuptools))
396 (propagated-inputs (list python-networkx python-numpy))
397 (home-page "https://github.com/taynaud/python-louvain")
398 (synopsis "Louvain algorithm for community detection")
399 (description
400 "This package provides a pure Python implementation of the Louvain
401algorithm for community detection in large networks.")
402 (license license:bsd-3))))
403
404(define-public python-graphtools
405 (package
406 (name "python-graphtools")
407 (version "2.1.0")
408 (source
409 (origin
410 (method git-fetch)
411 (uri (git-reference
412 (url "https://github.com/KrishnaswamyLab/graphtools")
413 (commit (string-append "v" version))))
414 (file-name (git-file-name name version))
415 (sha256
416 (base32 "03zbdaqkg2ply7d0zr75rfjncg6xk45bamn1z6xpaqs9nh69hvk8"))))
417 (build-system pyproject-build-system)
418 (arguments
419 (list
420 ;; tests: 230 passed, 1 deselected
421 #:test-flags
422 ;; XXX: Arrays are not equal.
423 #~(list "--deselect=test/test_mnn.py::test_mnn_graph_decay")
424 #:phases
425 #~(modify-phases %standard-phases
426 (add-after 'unpack 'fix-pytest-config
427 (lambda _
428 (delete-file "pytest.ini"))))))
429 (propagated-inputs
430 (list python-deprecated
431 python-future
432 python-numpy
433 python-pygsp
434 python-scikit-learn
435 python-scipy
436 python-tasklogger))
437 (native-inputs
438 (list python-anndata
439 python-igraph
440 python-pandas
441 python-parameterized
442 python-pytest
443 python-setuptools))
444 (home-page "https://github.com/KrishnaswamyLab/graphtools")
445 (synopsis "Tools for building and manipulating graphs in Python")
446 (description "This package provides tools for building and manipulating
447graphs in Python.")
448 (license license:gpl3)))
449
450(define-public python-louvain-igraph
451 (package
452 (name "python-louvain-igraph")
453 (version "0.8.2")
454 (source
455 (origin
456 (method git-fetch)
457 (uri (git-reference
458 (url "https://github.com/vtraag/louvain-igraph")
459 (commit version)))
460 (file-name (git-file-name name version))
461 (sha256
462 (base32
463 "1aab6rnsnssi6wib939zy4vdzz3s2gcwwingn2dfjrijk05zjapv"))))
464 (build-system pyproject-build-system)
465 (arguments
466 (list
467 #:phases
468 #~(modify-phases %standard-phases
469 (add-after 'unpack 'find-igraph
470 (lambda _
471 (substitute* "setup.py"
472 (("/usr/include/igraph")
473 (string-append #$(this-package-input "igraph")
474 "/include/igraph"))))))))
475 (propagated-inputs (list python-igraph))
476 (inputs (list igraph))
477 (native-inputs
478 (list pkg-config
479 python-ddt
480 python-pytest
481 python-setuptools
482 python-setuptools-scm))
483 (home-page "https://github.com/vtraag/louvain-igraph")
484 (synopsis "Implementation of the Louvain algorithm")
485 (description "This package implements the Louvain algorithm for community
486detection in C++ and exposes it to Python. Besides the relative flexibility
487of the implementation, it also scales well, and can be run on graphs of
488millions of nodes (as long as they can fit in memory). The core function is
489@code{find_partition} which finds the optimal partition using the louvain
490algorithm for a number of different methods.")
491 (license license:gpl3+)))
492
493(define-public python-pygsp
494 (package
495 (name "python-pygsp")
496 (version "0.6.0")
497 (source
498 (origin
499 (method url-fetch)
500 (uri (pypi-uri "pygsp" version))
501 (sha256
502 (base32 "0zbyka8pvcy7rmw65cpkss2k6sn420k67wcrcp8nka36l9pjadam"))))
503 (build-system pyproject-build-system)
504 (arguments
505 (list
506 ;; tests: 97 passed, 6 skipped, 3 deselected, 10 warnings
507 #:test-flags
508 ;; Not equal to tolerance rtol=1e-07, atol=1e-12
509 #~(list "--deselect=pygsp/tests/test_graphs.py::test_eigendecompositions"
510 ;; ValueError: Only p-norms with 1<=p<=infinity permitted
511 "--deselect=pygsp/tests/test_graphs.py::test_nngraph"
512 ;; This test needs pyqtgraph and PyQt6.
513 "--deselect=pygsp/tests/test_plotting.py::TestGraphs::test_all_graphs")))
514 (native-inputs
515 (list python-matplotlib
516 python-pytest
517 python-pyunlocbox
518 python-scikit-image
519 python-setuptools))
520 (propagated-inputs
521 (list python-numpy
522 python-scipy))
523 (home-page "https://github.com/epfl-lts2/pygsp")
524 (synopsis "Graph Signal Processing in Python")
525 (description "The PyGSP is a Python package to ease signal processing on
526graphs.")
527 (license license:bsd-3)))
528
529(define-public python-pyunlocbox
530 (package
531 (name "python-pyunlocbox")
532 (version "0.6.1")
533 (source
534 (origin
535 (method git-fetch)
536 (uri (git-reference
537 (url "https://github.com/epfl-lts2/pyunlocbox")
538 (commit (string-append "v" version))))
539 (file-name (git-file-name name version))
540 (sha256
541 (base32 "0pv3srpkyprp0vamlg1pgzqk5ws4ydjb8y9nabndjf2f8519kgv4"))))
542 (build-system pyproject-build-system)
543 (arguments
544 (list
545 ;; tests: 38 passed, 3 warnings
546 #:test-flags
547 #~(list "--numprocesses" (number->string (min 8 (parallel-job-count)))
548 ;; Not equal to tolerance rtol=0.001, atol=0
549 "--deselect=pyunlocbox/tests/test_functions.py::TestFunctions::test_proj_b2")))
550 (native-inputs
551 (list python-pytest
552 python-pytest-xdist
553 python-setuptools
554 python-setuptools-scm))
555 (propagated-inputs
556 (list python-numpy
557 python-pytest-cov ;XXX: Why... it's in a dependency list?
558 python-scipy))
559 (home-page "https://github.com/epfl-lts2/pyunlocbox")
560 (synopsis "Convex Optimization in Python using Proximal Splitting")
561 (description
562 "PyUNLocBoX uses @url{https://en.wikipedia.org/wiki/Proximal_gradient_method,
563proximal splitting methods} to solve non-differentiable convex optimization
564problems.")
565 (license license:bsd-3)))
566
567(define-public qvge
568 (package
569 (name "qvge")
570 (version "0.7.0")
571 (source
572 (origin
573 (method git-fetch)
574 (uri (git-reference
575 (url "https://github.com/ArsMasiuk/qvge")
576 (commit (string-append "v" version))))
577 (file-name (git-file-name name version))
578 (sha256
579 (base32 "1mijb0yr71xh9cq43vflbhz6zp1qvhjmvzrs2pbxka63hqk60pfk"))))
580 (build-system gnu-build-system)
581 (arguments
582 (list
583 #:configure-flags
584 #~(list (string-append "PREFIX=" #$output))
585 #:phases
586 #~(modify-phases %standard-phases
587 (replace 'configure
588 (lambda* (#:key (configure-flags '())
589 #:allow-other-keys)
590 (chdir "src")
591 (apply invoke "qmake" "-r" configure-flags))))))
592 (inputs
593 (list qtbase-5
594 qtsvg-5
595 qtx11extras))
596 (home-page "https://arsmasiuk.github.io/qvge/")
597 (synopsis "Visual graph editor")
598 (description
599 "QVGE is a multiplatform graph editor written in C++/Qt. Its main goal
600is to make possible visually edit two-dimensional graphs in a simple and
601intuitive way.")
602 (license license:expat)))
603
604(define-public faiss
605 (package
606 (name "faiss")
607 (version "1.10.0")
608 (source
609 (origin
610 (method git-fetch)
611 (uri (git-reference
612 (url "https://github.com/facebookresearch/faiss")
613 (commit (string-append "v" version))))
614 (file-name (git-file-name name version))
615 (sha256
616 (base32
617 "1x6z94f6vhh7ppsn7wll46k7i63lzcnc3r3rv5zfarljybqhrsjd"))
618 ;; Including but skipping perf_tests requires to patch
619 ;; perf_tests/CMakeLists.txt. KISS: Remove it instead.
620 (modules '((guix build utils)))
621 (snippet #~(begin
622 (delete-file-recursively "perf_tests")
623 (substitute* "CMakeLists.txt"
624 (("add_subdirectory\\(perf_tests\\)") ""))))
625 (patches
626 (search-patches "faiss-tests-CMakeLists-find-googletest.patch"))))
627 (build-system cmake-build-system)
628 (arguments
629 (list #:configure-flags
630 #~'("-DFAISS_ENABLE_C_API=ON"
631 "-DFAISS_ENABLE_GPU=OFF" ; thanks, but no thanks, CUDA.
632 "-DFAISS_ENABLE_PYTHON=OFF"
633 "-DBUILD_SHARED_LIBS=ON")))
634 (inputs
635 (list openblas))
636 (native-inputs
637 (list googletest openmpi))
638 (home-page "https://github.com/facebookresearch/faiss")
639 (synopsis "Efficient similarity search and clustering of dense vectors")
640 (description "Faiss is a library for efficient similarity search and
641clustering of dense vectors. It contains algorithms that search in sets of
642vectors of any size, up to ones that possibly do not fit in RAM. It also
643contains supporting code for evaluation and parameter tuning.")
644 (license license:bsd-3)))
645
646(define-public faiss-for-go-faiss
647 (let ((commit "608356b7c9630e891ff87cc49cc7bb460c3870d3")
648 (revision "0"))
649 (package
650 (inherit faiss)
651 (name "faiss-for-go-faiss")
652 (version (git-version "1.11.0" revision commit))
653 (source
654 (origin
655 (inherit (package-source faiss))
656 (uri (git-reference
657 (url "https://github.com/blevesearch/faiss")
658 (commit commit)))
659 (file-name (git-file-name name version))
660 (sha256
661 (base32 "0m0hyqn9db0xdbvan0lin7xf11dl4xdpjwwpagw01hl4z72w3al0"))))
662 (arguments
663 (substitute-keyword-arguments arguments
664 ((#:configure-flags flags '())
665 ;; Add -fpermissive to suppress errors about non-conforming code.
666 #~(cons "-DCMAKE_CXX_FLAGS=-fpermissive"
667 #$flags))
668 ((#:test-exclude test-exclude #f)
669 "Threading.openmp|IVF.list_context")
670 ((#:phases phases #~%standard-phases)
671 #~(modify-phases #$phases
672 (add-after 'unpack 'fix-bugs
673 (lambda _
674 ;; Add include directory to target.
675 (substitute* "c_api/CMakeLists.txt"
676 (("add_library\\(faiss_c [^\n]*" line)
677 (string-append line "\n"
678 "target_include_directories(faiss_c PRIVATE ${CMAKE_SOURCE_DIR})\n")))
679 ;; Do not assign using initializer list.
680 (substitute* "tests/test_hamming.cpp"
681 (("\\{na, k, ids_ham_knn.data[^\n]*" all)
682 (string-append "faiss::int_maxheap_array_t" all)))))))))
683 (description "This package provides an alternative build of Faiss.")
684 (license (list license:bsd-3 ;faiss code
685 license:expat))))) ;blevesearch fork
686
687(define-public python-faiss
688 (package (inherit faiss)
689 (name "python-faiss")
690 (build-system cmake-build-system)
691 (arguments
692 (list
693 #:imported-modules (append %cmake-build-system-modules
694 %pyproject-build-system-modules)
695 #:modules '((guix build cmake-build-system)
696 ((guix build pyproject-build-system) #:prefix py:)
697 (guix build utils))
698 #:phases
699 (with-extensions (list (pyproject-guile-json))
700 #~(modify-phases %standard-phases
701 (add-after 'unpack 'chdir
702 (lambda _
703 (chdir "faiss/python")))
704 (add-before 'install 'python-build
705 (assoc-ref py:%standard-phases 'build))
706 (replace 'install
707 (assoc-ref py:%standard-phases 'install))
708 (add-after 'install 'cleanup
709 (lambda _
710 (let ((external "_*faiss_example_external_module\\.(so|py)$"))
711 (for-each delete-file (find-files #$output external)))))
712 ;; Move check phase after 'install.
713 (delete 'check)
714 (add-after 'install 'check
715 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
716 (if tests?
717 (with-directory-excursion "../../tests"
718 (setenv "PYTHONPATH"
719 (string-append (py:site-packages inputs outputs)
720 ":" (getenv "GUIX_PYTHONPATH")))
721 (let ((ignored '(;; External module removed
722 "./external_module_test.py"
723 ;; Avoid torch dependency
724 "./torch_test_contrib.py"
725 "./torch_test_neural_net.py")))
726 (for-each
727 (lambda (file)
728 (invoke "python" file))
729 (find-files "." (lambda (file stat)
730 (and (string-suffix? ".py" file)
731 (not (member file ignored))))))))
732 (format #t "test suite not run~%"))))))))
733 (native-inputs
734 (list python-scipy python-setuptools))
735 (inputs
736 (list faiss openblas python-wrapper swig-4.4))
737 (propagated-inputs
738 (list python-numpy))
739 (description "Faiss is a library for efficient similarity search and
740clustering of dense vectors. This package provides Python bindings to the
741Faiss library.")))
742
743(define-public lemon-graph
744 (package
745 (name "lemon-graph")
746 (version "1.3.1.1")
747 (source
748 (origin
749 (method git-fetch)
750 (uri (git-reference
751 ;; Copy of http://lemon.cs.elte.hu/pub
752 (url "https://github.com/The-OpenROAD-Project/lemon-graph")
753 (commit version)))
754 (file-name (git-file-name name version))
755 (sha256
756 (base32 "0j4vwyghlcsyzbr3f8fm99zdl5zr25d2799ahbq0z9057brgm7r0"))))
757 (build-system cmake-build-system)
758 (arguments
759 (list
760 #:configure-flags
761 #~(list "-DLEMON_ENABLE_COIN=OFF"
762 "-DLEMON_ENABLE_GLPK=OFF"
763 "-DLEMON_ENABLE_ILOG=OFF"
764 "-DLEMON_ENABLE_SOPLEX=OFF")
765 #:phases
766 #~(modify-phases %standard-phases
767 (add-after 'unpack 'fix-tests
768 (lambda _
769 ;; Fix missing import in source code of tests.
770 (substitute* "test/maps_test.cc"
771 (("distance")
772 "std::distance"))))
773 (replace 'check
774 (lambda* (#:key tests? #:allow-other-keys)
775 (when tests?
776 (invoke "make" "check")))))))
777 (native-inputs (list python-minimal-wrapper))
778 (home-page "https://lemon.cs.elte.hu/trac/lemon")
779 (synopsis "C++ library of optimized algorithms and data structures")
780 (description
781 "@acronym{LEMON, Library for Efficient Modeling and Optimization in
782Networks} is a C++ template library providing efficient implementations of
783common data structures and algorithms with focus on combinatorial optimization
784tasks connected mainly with graphs and networks. This is the OpenROAD
785Project's fork with C++20 compatibility fixes.")
786 (license license:boost1.0)))
787
788(define-public libleidenalg
789 (package
790 (name "libleidenalg")
791 (version "0.11.1")
792 (source (origin
793 (method git-fetch)
794 (uri (git-reference
795 (url "https://github.com/vtraag/libleidenalg")
796 (commit version)))
797 (file-name (git-file-name name version))
798 (sha256
799 (base32
800 "0fqy79yrgnrifhyc2lys5jv84siq01ph6038qyz7qagl1yq5gdw8"))))
801 (build-system cmake-build-system)
802 (arguments
803 (list
804 #:tests? #f ;tests are not included
805 #:phases
806 #~(modify-phases %standard-phases
807 (add-after 'unpack 'version-file
808 (lambda _
809 (let ((port (open-file "VERSION" "w")))
810 (display #$version port)
811 (close port)))))))
812 (inputs (list igraph))
813 (home-page "https://github.com/vtraag/libleidenalg")
814 (synopsis "Community detection in large networks")
815 (description "Leiden is a general algorithm for methods of community
816detection in large networks and is an extension of the Louvain algorithm.
817This package implements the Leiden algorithm in C++ and can be run on graphs
818of millions of nodes (as long as they can fit in memory).")
819 (license license:gpl3+)))
820
821(define-public python-leidenalg
822 (package
823 (name "python-leidenalg")
824 (version "0.10.2")
825 (source
826 (origin
827 (method git-fetch) ; no tests in PyPI release
828 (uri (git-reference
829 (url "https://github.com/vtraag/leidenalg")
830 (commit version)))
831 (file-name (git-file-name name version))
832 (sha256
833 (base32 "0p46g8drpnsciphy3iagrkagzh8hi3l5xmdab00q9z812bwdb951"))))
834 (build-system pyproject-build-system)
835 (native-inputs
836 (list pkg-config
837 python-ddt
838 python-pytest
839 python-setuptools
840 python-setuptools-scm
841 python-wheel))
842 (inputs
843 (list igraph
844 libleidenalg))
845 (propagated-inputs
846 (list python-igraph))
847 (home-page "https://github.com/vtraag/leidenalg")
848 (synopsis "Community detection in large networks")
849 (description
850 "Leiden is a general algorithm for methods of community detection in
851large networks and is an extension of the Louvain algorithm. This packages
852provides a Python wrapper to the C++ implementation.")
853 (license license:gpl3+)))
854
855(define-public edge-addition-planarity-suite
856 (package
857 (name "edge-addition-planarity-suite")
858 (version "3.0.2.0")
859 (source
860 (origin
861 (method git-fetch)
862 (uri (git-reference
863 (url (string-append "https://github.com/graph-algorithms/"
864 name))
865 (commit (string-append "Version_" version))))
866 (file-name (git-file-name name version))
867 (sha256
868 (base32
869 "1c7bnxgiz28mqsq3a3msznmjq629w0qqjynm2rqnnjn2qpc22h3i"))))
870 (build-system gnu-build-system)
871 (native-inputs
872 (list autoconf automake libtool))
873 (synopsis "Embedding of planar graphs")
874 (description "The package provides a reference implementation of the
875linear time edge addition algorithm for embedding planar graphs and
876isolating planarity obstructions.")
877 (license license:bsd-3)
878 (home-page
879 "https://github.com/graph-algorithms/edge-addition-planarity-suite")))
880
881(define-public plantri
882 (package
883 (name "plantri")
884 (version "5.5")
885 (source (origin
886 (method url-fetch)
887 (uri (string-append "https://users.cecs.anu.edu.au/~bdm/plantri/"
888 "plantri" (string-join
889 (string-split version #\.)
890 "") ".tar.gz"))
891 (sha256
892 (base32
893 "1vbxpjih293d9nmb65fsh6xgg0w12kygwycg1yw4wad7ridxy74i"))))
894 (build-system gnu-build-system)
895 (arguments
896 (list
897 #:tests? #f ; there are no tests
898 #:phases #~(modify-phases %standard-phases
899 (delete 'configure)
900 (replace 'install
901 (lambda _
902 (for-each
903 (lambda (bin)
904 (install-file bin (string-append #$output "/bin")))
905 '("fullgen" "plantri")))))))
906 (home-page "https://users.cecs.anu.edu.au/~bdm/plantri/")
907 (synopsis "Generate certain types of planar graphs")
908 (description
909 "@code{plantri} and @code{fullgen} (contained in the same package)
910are programs for the generation of certain types of planar graphs. Graphs
911are generated in such a way that exactly one member of each isomorphism
912class is output without the need for storing them.")
913 (license license:asl2.0)))
914
915(define-public rw
916 (package
917 (name "rw")
918 ;; There is a version 0.8, but the tarball is broken with symlinks
919 ;; to /usr/share.
920 (version "0.9")
921 (source (origin
922 (method url-fetch)
923 (uri (string-append "mirror://sourceforge/rankwidth/"
924 "rw-" version ".tar.gz"))
925 (sha256
926 (base32
927 "0hdlxxmlccb6fp7g58zv0rdzpbyjn9bgqlf052sgrk95zq33bq61"))
928 (patches (search-patches "rw-igraph-0.10.patch"))))
929 (build-system gnu-build-system)
930 (native-inputs (list pkg-config))
931 (inputs (list igraph))
932 (home-page "https://sourceforge.net/projects/rankwidth/")
933 (synopsis "Rank-width and rank-decomposition of graphs")
934 (description "rw computes rank-width and rank-decompositions
935of graphs.")
936 (license license:gpl2+)))
937
938(define-public mscgen
939 (package
940 (name "mscgen")
941 (version "0.20")
942 (source
943 (origin
944 (method url-fetch)
945 (uri (string-append "http://www.mcternan.me.uk/mscgen/software/mscgen-src-"
946 version ".tar.gz"))
947 (sha256
948 (base32
949 "08yw3maxhn5fl1lff81gmcrpa4j9aas4mmby1g9w5qcr0np82d1w"))))
950 (build-system gnu-build-system)
951 (native-inputs
952 (list pkg-config))
953 (inputs
954 (list fontconfig freetype gd libjpeg-turbo libpng zlib))
955 (home-page "https://www.mcternan.me.uk/mscgen/")
956 (synopsis "Message Sequence Chart Generator")
957 (description "Mscgen is a small program that parses Message Sequence Chart
958descriptions and produces PNG, SVG, EPS or server side image maps (ismaps) as
959the output. Message Sequence Charts (MSCs) are a way of representing entities
960and interactions over some time period and are often used in combination with
961SDL. MSCs are popular in Telecoms to specify how protocols operate although
962MSCs need not be complicated to create or use. Mscgen aims to provide a simple
963text language that is clear to create, edit and understand, which can also be
964transformed into common image formats for display or printing.")
965 (license license:gpl2+)))
966
967(define-public python-graph-tool
968 (package
969 (name "python-graph-tool")
970 (version "2.98")
971 (source (origin
972 (method url-fetch)
973 (uri (string-append
974 "https://downloads.skewed.de/graph-tool/graph-tool-"
975 version ".tar.bz2"))
976 (sha256
977 (base32
978 "09y5djq70y73anfmx50xalvg1s6pqvh5zrzf94vh8pvzjf5r9wgf"))))
979 (build-system gnu-build-system)
980 (arguments
981 (list
982 ;; The build process peaks around 4GB/RAM per core.
983 #:parallel-build? #f
984 #:configure-flags
985 #~(list (string-append "--with-boost=" #$(this-package-input "boost"))
986 (string-append "--with-python-module-path=" #$output "/lib/python"
987 #$(version-major+minor (package-version python))
988 "/site-packages"))))
989 (native-inputs
990 (list ncurses pkg-config))
991 (inputs
992 (list boost-1.83
993 cairomm-1.14
994 cgal-5
995 expat
996 gmp
997 gtk+
998 python-wrapper
999 sparsehash))
1000 (propagated-inputs
1001 (list python-matplotlib
1002 python-numpy
1003 python-pycairo
1004 python-scipy
1005 python-zstandard))
1006 (synopsis "Manipulate and analyze graphs with Python efficiently")
1007 (description "Graph-tool is an efficient Python module for manipulation
1008and statistical analysis of graphs (a.k.a. networks). Contrary to most other
1009Python modules with similar functionality, the core data structures and
1010algorithms are implemented in C++, making extensive use of template
1011metaprogramming, based heavily on the Boost Graph Library. This confers it a
1012level of performance that is comparable (both in memory usage and computation
1013time) to that of a pure C/C++ library.")
1014 (home-page "https://graph-tool.skewed.de/")
1015 (license license:lgpl3+)))