gnu: kdenlive: Add missing dependencies.
[jackhill/guix/guix.git] / gnu / packages / graph.scm
CommitLineData
e57fffad 1;;; GNU Guix --- Functional package management for GNU
06b13f51 2;;; Copyright © 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
5f3616d6 3;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
8c9dcdea 4;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
3776dc09 5;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
f455d99d 6;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
56973172 7;;; Copyright © 2020 Alexander Krotov <krotov@iitp.ru>
6e31d6f3 8;;; Copyright © 2020 Pierre Langlois <pierre.langlos@gmx.com>
e57fffad
RW
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages graph)
26 #:use-module (guix download)
4e35c429 27 #:use-module (guix git-download)
e57fffad 28 #:use-module (guix packages)
51a9971c 29 #:use-module (guix utils)
3e403187 30 #:use-module (guix build-system cmake)
e57fffad 31 #:use-module (guix build-system gnu)
31476df3 32 #:use-module (guix build-system python)
1738138c 33 #:use-module (guix build-system r)
e57fffad
RW
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (gnu packages)
1738138c 36 #:use-module (gnu packages gcc)
f455d99d 37 #:use-module (gnu packages autotools)
d53aeeaf 38 #:use-module (gnu packages bioconductor)
e206de67 39 #:use-module (gnu packages bioinformatics)
3e403187 40 #:use-module (gnu packages check)
e57fffad 41 #:use-module (gnu packages compression)
fff9b884 42 #:use-module (gnu packages cran)
56973172 43 #:use-module (gnu packages gd)
e206de67 44 #:use-module (gnu packages graphviz)
e57fffad
RW
45 #:use-module (gnu packages maths)
46 #:use-module (gnu packages multiprecision)
31476df3 47 #:use-module (gnu packages pkg-config)
5f3616d6 48 #:use-module (gnu packages python)
312ec128 49 #:use-module (gnu packages python-science)
5f3616d6 50 #:use-module (gnu packages python-web)
44d10b1f 51 #:use-module (gnu packages python-xyz)
1738138c 52 #:use-module (gnu packages statistics)
51a9971c 53 #:use-module (gnu packages swig)
5f3616d6 54 #:use-module (gnu packages time)
e57fffad
RW
55 #:use-module (gnu packages xml))
56
57(define-public igraph
58 (package
59 (name "igraph")
2b1c4a5c 60 (version "0.8.2")
e57fffad
RW
61 (source
62 (origin
63 (method url-fetch)
06b13f51
RW
64 (uri (string-append "https://github.com/igraph/igraph/releases/"
65 "download/" version "/igraph-" version ".tar.gz"))
e57fffad 66 (sha256
2b1c4a5c 67 (base32 "158flvl80qh1l1ikfa04p1dzh8kapsvm6q80x3ih5gwcgcg4g2ki"))))
e57fffad
RW
68 (build-system gnu-build-system)
69 (arguments
70 `(#:configure-flags
71 (list "--with-external-glpk"
72 "--with-external-blas"
73 "--with-external-lapack")))
74 (inputs
75 `(("gmp" ,gmp)
76 ("glpk" ,glpk)
77 ("libxml2" ,libxml2)
78 ("lapack" ,lapack)
79 ("openblas" ,openblas)
80 ("zlib" ,zlib)))
00a34333 81 (home-page "https://igraph.org")
e57fffad
RW
82 (synopsis "Network analysis and visualization")
83 (description
84 "This package provides a library for the analysis of networks and graphs.
85It can handle large graphs very well and provides functions for generating
86random and regular graphs, graph visualization, centrality methods and much
87more.")
88 (license license:gpl2+)))
31476df3
RW
89
90(define-public python-igraph
91 (package (inherit igraph)
92 (name "python-igraph")
fe55ff38 93 (version "0.8.2")
31476df3
RW
94 (source
95 (origin
96 (method url-fetch)
97 (uri (pypi-uri "python-igraph" version))
98 (sha256
fe55ff38 99 (base32 "0wkxrs28qdvnrz7d4jzcf2bh6v2yqzx3wyfziihfgsi2gn6n60a6"))))
31476df3 100 (build-system python-build-system)
7daae3c9
RW
101 (arguments
102 '(#:configure-flags
103 (list "--use-pkg-config")
104 #:phases
105 (modify-phases %standard-phases
106 (replace 'build
107 (lambda _
108 (invoke "python" "./setup.py" "build" "--use-pkg-config")))
109 (delete 'check)
110 (add-after 'install 'check
111 (lambda* (#:key inputs outputs #:allow-other-keys)
112 (add-installed-pythonpath inputs outputs)
113 (invoke "pytest" "-v"))))))
31476df3
RW
114 (inputs
115 `(("igraph" ,igraph)))
7daae3c9
RW
116 (propagated-inputs
117 `(("python-texttable" ,python-texttable)))
31476df3 118 (native-inputs
7daae3c9
RW
119 `(("pkg-config" ,pkg-config)
120 ("python-pytest" ,python-pytest)))
e85af137 121 (home-page "https://pypi.org/project/python-igraph/")
31476df3 122 (synopsis "Python bindings for the igraph network analysis library")))
1738138c 123
4e35c429
RW
124(define-public r-rbiofabric
125 (let ((commit "666c2ae8b0a537c006592d067fac6285f71890ac")
126 (revision "1"))
127 (package
128 (name "r-rbiofabric")
129 (version (string-append "0.3-" revision "." (string-take commit 7)))
130 (source (origin
131 (method git-fetch)
132 (uri (git-reference
b0e7b699 133 (url "https://github.com/wjrl/RBioFabric")
4e35c429
RW
134 (commit commit)))
135 (file-name (string-append name "-" version "-checkout"))
136 (sha256
137 (base32
138 "1yahqrcrqpbcywv73y9rlmyz8apdnp08afialibrr93ch0p06f8z"))))
139 (build-system r-build-system)
140 (propagated-inputs
141 `(("r-igraph" ,r-igraph)))
142 (home-page "http://www.biofabric.org/")
143 (synopsis "BioFabric network visualization")
144 (description "This package provides an implementation of the function
145@code{bioFabric} for creating scalable network digrams where nodes are
146represented by horizontal lines, and edges are represented by vertical
147lines.")
148 (license license:expat))))
5f3616d6
LF
149
150(define-public python-plotly
151 (package
152 (name "python-plotly")
6e31d6f3
PL
153 (version "4.8.1")
154 (source (origin
155 (method git-fetch)
156 (uri (git-reference
b0e7b699 157 (url "https://github.com/plotly/plotly.py")
6e31d6f3
PL
158 (commit (string-append "v" version))))
159 (file-name (git-file-name name version))
160 (sha256
161 (base32
162 "08ab677gr85m10zhixr6dnmlfws8q6sra7nhyb8nf3r8dx1ffqhz"))))
5f3616d6
LF
163 (build-system python-build-system)
164 (arguments
6e31d6f3
PL
165 `(#:phases
166 (modify-phases %standard-phases
167 (add-after 'unpack 'chdir
168 (lambda _
169 (chdir "packages/python/plotly")
170 #t))
171 (replace 'check
172 (lambda _
173 (invoke "pytest" "-x" "plotly/tests/test_core")
174 (invoke "pytest" "-x" "plotly/tests/test_io")
175 ;; FIXME: Add optional dependencies and enable their tests.
176 ;; (invoke "pytest" "-x" "plotly/tests/test_optional")
177 (invoke "pytest" "_plotly_utils/tests")))
178 (add-before 'reset-gzip-timestamps 'make-files-writable
179 (lambda* (#:key outputs #:allow-other-keys)
180 (let ((out (assoc-ref outputs "out")))
181 (for-each (lambda (file) (chmod file #o644))
182 (find-files out "\\.gz"))
183 #t))))))
184 (native-inputs
185 `(("python-pytest" ,python-pytest)))
5f3616d6
LF
186 (propagated-inputs
187 `(("python-decorator" ,python-decorator)
6e31d6f3 188 ("python-ipywidgets" ,python-ipywidgets)
1a28b9ab 189 ("python-pandas" ,python-pandas)
5f3616d6 190 ("python-requests" ,python-requests)
6e31d6f3
PL
191 ("python-retrying" ,python-retrying)
192 ("python-six" ,python-six)
193 ("python-statsmodels" ,python-statsmodels)
194 ("python-xarray" ,python-xarray)))
195 (home-page "https://plotly.com/python/")
5f3616d6
LF
196 (synopsis "Interactive plotting library for Python")
197 (description "Plotly's Python graphing library makes interactive,
198publication-quality graphs online. Examples of how to make line plots, scatter
199plots, area charts, bar charts, error bars, box plots, histograms, heatmaps,
200subplots, multiple-axes, polar charts, and bubble charts. ")
201 (license license:expat)))
202
6e31d6f3
PL
203(define-public python-plotly-2.4.1
204 (package (inherit python-plotly)
205 (version "2.4.1")
206 (source
207 (origin
208 (method url-fetch)
209 (uri (pypi-uri "plotly" version))
210 (sha256
211 (base32
212 "0s9gk2fl53x8wwncs3fwii1vzfngr0sskv15v3mpshqmrqfrk27m"))))
213 (native-inputs '())
214 (propagated-inputs
215 `(("python-decorator" ,python-decorator)
216 ("python-nbformat" ,python-nbformat)
217 ("python-pandas" ,python-pandas)
218 ("python-pytz" ,python-pytz)
219 ("python-requests" ,python-requests)
220 ("python-six" ,python-six)))
221 (arguments
222 '(#:tests? #f)))) ; The tests are not distributed in the release
223
5f3616d6 224(define-public python2-plotly
6e31d6f3 225 (package-with-python2 python-plotly-2.4.1))
3e403187 226
6ee48091
RW
227(define-public python-louvain
228 (package
229 (name "python-louvain")
230 (version "0.6.1")
231 ;; The tarball on Pypi does not include the tests.
232 (source (origin
233 (method git-fetch)
234 (uri (git-reference
b0e7b699 235 (url "https://github.com/vtraag/louvain-igraph")
6ee48091
RW
236 (commit version)))
237 (file-name (git-file-name name version))
238 (sha256
239 (base32
240 "0w31537sifkf65sck1iaip5i6d8g64pa3wdwad83d6p9jwkck57k"))))
241 (build-system python-build-system)
242 (propagated-inputs
243 `(("python-ddt" ,python-ddt)
244 ("python-igraph" ,python-igraph)))
245 (inputs
246 `(("igraph" ,igraph)))
247 (native-inputs
248 `(("pkg-config" ,pkg-config)
249 ("python-pytest" ,python-pytest)))
250 (home-page "https://github.com/vtraag/louvain-igraph")
251 (synopsis "Algorithm for methods of community detection in large networks")
252 (description
253 "This package provides an implementation of the Louvain algorithm for use
254with igraph. Louvain is a general algorithm for methods of community
255detection in large networks.
256
257This package has been superseded by the @code{leidenalg} package and should
258not be used for new projects.")
259 (license license:gpl3+)))
260
3e403187
RW
261(define-public faiss
262 (package
263 (name "faiss")
264 (version "1.5.0")
265 (source (origin
266 (method git-fetch)
267 (uri (git-reference
b0e7b699 268 (url "https://github.com/facebookresearch/faiss")
3e403187
RW
269 (commit (string-append "v" version))))
270 (file-name (git-file-name name version))
271 (sha256
272 (base32
3776dc09
EF
273 "0pk15jfa775cy2pqmzq62nhd6zfjxmpvz5h731197c28aq3zw39w"))
274 (modules '((guix build utils)))
275 (snippet
276 '(begin
277 (substitute* "utils.cpp"
278 (("#include <immintrin.h>")
279 "#ifdef __SSE__\n#include <immintrin.h>\n#endif"))
280 #t))))
3e403187
RW
281 (build-system cmake-build-system)
282 (arguments
283 `(#:configure-flags
284 (list "-DBUILD_WITH_GPU=OFF" ; thanks, but no thanks, CUDA.
285 "-DBUILD_TUTORIAL=OFF") ; we don't need those
286 #:phases
287 (modify-phases %standard-phases
288 (add-after 'unpack 'prepare-build
289 (lambda _
290 (let ((features (list ,@(let ((system (or (%current-target-system)
291 (%current-system))))
292 (cond
293 ((string-prefix? "x86_64" system)
3776dc09 294 '("-mavx" "-msse2" "-mpopcnt"))
3e403187 295 ((string-prefix? "i686" system)
3776dc09 296 '("-msse2" "-mpopcnt"))
3e403187
RW
297 (else
298 '()))))))
299 (substitute* "CMakeLists.txt"
3776dc09
EF
300 (("-m64") "")
301 (("-mpopcnt") "") ; only some architectures
3e403187
RW
302 (("-msse4")
303 (string-append
304 (string-join features)
305 " -I" (getcwd)))
306 ;; Build also the shared library
307 (("ARCHIVE DESTINATION lib")
308 "LIBRARY DESTINATION lib")
309 (("add_library.*" m)
310 "\
311add_library(objlib OBJECT ${faiss_cpu_headers} ${faiss_cpu_cpp})
312set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
313add_library(${faiss_lib}_static STATIC $<TARGET_OBJECTS:objlib>)
314add_library(${faiss_lib} SHARED $<TARGET_OBJECTS:objlib>)
315install(TARGETS ${faiss_lib}_static ARCHIVE DESTINATION lib)
316\n")))
317
318 ;; See https://github.com/facebookresearch/faiss/issues/520
319 (substitute* "IndexScalarQuantizer.cpp"
320 (("#define USE_AVX") ""))
321
322 ;; Make header files available for compiling tests.
323 (mkdir-p "faiss")
324 (for-each (lambda (file)
325 (mkdir-p (string-append "faiss/" (dirname file)))
326 (copy-file file (string-append "faiss/" file)))
327 (find-files "." "\\.h$"))
328 #t))
329 (replace 'check
330 (lambda _
331 (invoke "make" "-C" "tests"
332 (format #f "-j~a" (parallel-job-count)))))
333 (add-after 'install 'remove-tests
334 (lambda* (#:key outputs #:allow-other-keys)
335 (delete-file-recursively
336 (string-append (assoc-ref outputs "out")
337 "/test"))
338 #t)))))
339 (inputs
340 `(("openblas" ,openblas)))
341 (native-inputs
342 `(("googletest" ,googletest)))
343 (home-page "https://github.com/facebookresearch/faiss")
344 (synopsis "Efficient similarity search and clustering of dense vectors")
345 (description "Faiss is a library for efficient similarity search and
346clustering of dense vectors. It contains algorithms that search in sets of
347vectors of any size, up to ones that possibly do not fit in RAM. It also
348contains supporting code for evaluation and parameter tuning.")
349 (license license:bsd-3)))
51a9971c
RW
350
351(define-public python-faiss
352 (package (inherit faiss)
353 (name "python-faiss")
354 (build-system python-build-system)
355 (arguments
356 `(#:phases
357 (modify-phases %standard-phases
358 (add-after 'unpack 'chdir
359 (lambda _ (chdir "python") #t))
360 (add-after 'chdir 'build-swig
361 (lambda* (#:key inputs #:allow-other-keys)
362 (with-output-to-file "../makefile.inc"
363 (lambda ()
364 (let ((python-version ,(version-major+minor (package-version python))))
365 (format #t "\
366PYTHONCFLAGS =-I~a/include/python~am/ -I~a/lib/python~a/site-packages/numpy/core/include
367LIBS = -lpython~am -lfaiss
368SHAREDFLAGS = -shared -fopenmp
0fe041bd 369CXXFLAGS = -fpermissive -fopenmp -fPIC
51a9971c
RW
370CPUFLAGS = ~{~a ~}~%"
371 (assoc-ref inputs "python*") python-version
372 (assoc-ref inputs "python-numpy") python-version
373 python-version
8339ccac
EF
374 (list ,@(let ((system (or (%current-target-system)
375 (%current-system))))
376 (cond
377 ((string-prefix? "x86_64" system)
378 '("-mavx" "-msse2" "-mpopcnt"))
379 ((string-prefix? "i686" system)
380 '("-msse2" "-mpopcnt"))
381 (else
382 '()))))))))
51a9971c
RW
383 (substitute* "Makefile"
384 (("../libfaiss.a") ""))
385 (invoke "make" "cpu"))))))
386 (inputs
387 `(("faiss" ,faiss)
388 ("openblas" ,openblas)
389 ("python*" ,python)
390 ("swig" ,swig)))
391 (propagated-inputs
392 `(("python-matplotlib" ,python-matplotlib)
393 ("python-numpy" ,python-numpy)))
394 (description "Faiss is a library for efficient similarity search and
395clustering of dense vectors. This package provides Python bindings to the
396Faiss library.")))
e865e0b9
RW
397
398(define-public python-leidenalg
399 (package
400 (name "python-leidenalg")
401 (version "0.7.0")
402 (source
403 (origin
404 (method url-fetch)
405 (uri (pypi-uri "leidenalg" version))
406 (sha256
407 (base32
408 "15fwld9hdw357rd026mzcwpah5liy4f33vc9x9kwy37g71b2rjf1"))))
409 (build-system python-build-system)
410 (arguments '(#:tests? #f)) ; tests are not included
411 (native-inputs
412 `(("pkg-config" ,pkg-config)))
413 (inputs
414 `(("igraph" ,igraph)))
415 (propagated-inputs
416 `(("python-igraph" ,python-igraph)))
417 (home-page "https://github.com/vtraag/leidenalg")
418 (synopsis "Community detection in large networks")
419 (description
420 "Leiden is a general algorithm for methods of community detection in
421large networks. This package implements the Leiden algorithm in C++ and
422exposes it to Python. Besides the relative flexibility of the implementation,
423it also scales well, and can be run on graphs of millions of nodes (as long as
424they can fit in memory). The core function is @code{find_partition} which
425finds the optimal partition using the Leiden algorithm, which is an extension
426of the Louvain algorithm, for a number of different methods.")
427 (license license:gpl3+)))
f455d99d
AE
428
429(define-public edge-addition-planarity-suite
430 (package
431 (name "edge-addition-planarity-suite")
432 (version "3.0.0.5")
433 (source
434 (origin
435 (method git-fetch)
436 (uri (git-reference
437 (url (string-append "https://github.com/graph-algorithms/"
438 name))
439 (commit (string-append "Version_" version))))
440 (file-name (git-file-name name version))
441 (sha256
442 (base32
443 "01cm7ay1njkfsdnmnvh5zwc7wg7x189hq1vbfhh9p3ihrbnmqzh8"))))
444 (build-system gnu-build-system)
445 (native-inputs
446 `(("autoconf" ,autoconf)
447 ("automake" ,automake)
448 ("libtool" ,libtool)))
449 (synopsis "Embedding of planar graphs")
450 (description "The package provides a reference implementation of the
451linear time edge addition algorithm for embedding planar graphs and
452isolating planarity obstructions.")
453 (license license:bsd-3)
454 (home-page
455 "https://github.com/graph-algorithms/edge-addition-planarity-suite")))
bf473f0c
AE
456
457(define-public rw
458 (package
459 (name "rw")
460 ;; There is a version 0.8, but the tarball is broken with symlinks
461 ;; to /usr/share.
462 (version "0.7")
463 (source (origin
464 (method url-fetch)
465 (uri (string-append "mirror://sourceforge/rankwidth/"
466 "rw-" version ".tar.gz"))
467 (sha256
468 (base32
469 "1rv2v42x2506x7f10349m1wpmmfxrv9l032bkminni2gbip9cjg0"))))
470 (build-system gnu-build-system)
471 (native-inputs
472 `(("pkg-config" ,pkg-config)))
473 (inputs
474 `(("igraph" ,igraph)))
475 (home-page "https://sourceforge.net/projects/rankwidth/")
476 (synopsis "Rank-width and rank-decomposition of graphs")
477 (description "rw computes rank-width and rank-decompositions
478of graphs.")
479 (license license:gpl2+)))
56973172
AK
480
481(define-public mscgen
482 (package
483 (name "mscgen")
484 (version "0.20")
485 (source
486 (origin
487 (method url-fetch)
488 (uri (string-append "http://www.mcternan.me.uk/mscgen/software/mscgen-src-"
489 version ".tar.gz"))
490 (sha256
491 (base32
492 "08yw3maxhn5fl1lff81gmcrpa4j9aas4mmby1g9w5qcr0np82d1w"))))
493 (build-system gnu-build-system)
cfa66669
MB
494 (native-inputs
495 `(("pkg-config" ,pkg-config)))
56973172
AK
496 (inputs
497 `(("gd" ,gd)))
498 (home-page "http://www.mcternan.me.uk/mscgen/")
499 (synopsis "Message Sequence Chart Generator")
500 (description "Mscgen is a small program that parses Message Sequence Chart
501descriptions and produces PNG, SVG, EPS or server side image maps (ismaps) as
502the output. Message Sequence Charts (MSCs) are a way of representing entities
503and interactions over some time period and are often used in combination with
504SDL. MSCs are popular in Telecoms to specify how protocols operate although
505MSCs need not be complicated to create or use. Mscgen aims to provide a simple
506text language that is clear to create, edit and understand, which can also be
507transformed into common image formats for display or printing.")
508 (license license:gpl2+)))