edsger 0.1.1__cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edsger/.gitignore +1 -0
- edsger/__init__.py +1 -0
- edsger/_version.py +1 -0
- edsger/commons.c +8409 -0
- edsger/commons.cpython-39-x86_64-linux-gnu.so +0 -0
- edsger/commons.pxd +25 -0
- edsger/commons.pyx +34 -0
- edsger/dijkstra.c +35866 -0
- edsger/dijkstra.cpython-39-x86_64-linux-gnu.so +0 -0
- edsger/dijkstra.pyx +504 -0
- edsger/networks.py +414 -0
- edsger/path.py +786 -0
- edsger/path_tracking.c +30259 -0
- edsger/path_tracking.cpython-39-x86_64-linux-gnu.so +0 -0
- edsger/path_tracking.pyx +93 -0
- edsger/pq_4ary_dec_0b.c +35887 -0
- edsger/pq_4ary_dec_0b.cpython-39-x86_64-linux-gnu.so +0 -0
- edsger/pq_4ary_dec_0b.pxd +33 -0
- edsger/pq_4ary_dec_0b.pyx +692 -0
- edsger/spiess_florian.c +34538 -0
- edsger/spiess_florian.cpython-39-x86_64-linux-gnu.so +0 -0
- edsger/spiess_florian.pyx +368 -0
- edsger/star.c +33914 -0
- edsger/star.cpython-39-x86_64-linux-gnu.so +0 -0
- edsger/star.pyx +356 -0
- edsger/utils.py +63 -0
- edsger-0.1.1.dist-info/METADATA +111 -0
- edsger-0.1.1.dist-info/RECORD +32 -0
- edsger-0.1.1.dist-info/WHEEL +6 -0
- edsger-0.1.1.dist-info/licenses/AUTHORS.rst +5 -0
- edsger-0.1.1.dist-info/licenses/LICENSE +21 -0
- edsger-0.1.1.dist-info/top_level.txt +1 -0
Binary file
|
edsger/path_tracking.pyx
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
"""
|
2
|
+
Path tracking module.
|
3
|
+
|
4
|
+
cpdef functions:
|
5
|
+
|
6
|
+
- compute_path
|
7
|
+
Compute path from predecessors or successors.
|
8
|
+
|
9
|
+
cdef functions:
|
10
|
+
|
11
|
+
- _compute_path_first_pass
|
12
|
+
Returns the path length.
|
13
|
+
- _compute_path_second_pass
|
14
|
+
Compute the sequence of vertices forming a path.
|
15
|
+
"""
|
16
|
+
|
17
|
+
import numpy as np
|
18
|
+
cimport numpy as cnp
|
19
|
+
|
20
|
+
|
21
|
+
cpdef cnp.ndarray compute_path(cnp.uint32_t[::1] path_links, int vertex_idx):
|
22
|
+
"""Compute path from predecessors or successors.
|
23
|
+
|
24
|
+
Parameters:
|
25
|
+
-----------
|
26
|
+
|
27
|
+
path_links : cnp.uint32_t[::1]
|
28
|
+
predecessors or successors.
|
29
|
+
|
30
|
+
vertex_idx : int
|
31
|
+
source or target vertex index.
|
32
|
+
"""
|
33
|
+
|
34
|
+
cdef int path_length
|
35
|
+
|
36
|
+
path_length = _compute_path_first_pass(path_links, vertex_idx)
|
37
|
+
path_vertices = np.empty(path_length, dtype=np.uint32)
|
38
|
+
_compute_path_second_pass(path_links, path_vertices, vertex_idx)
|
39
|
+
|
40
|
+
return path_vertices
|
41
|
+
|
42
|
+
|
43
|
+
cdef int _compute_path_first_pass(
|
44
|
+
cnp.uint32_t[::1] path_links,
|
45
|
+
int vertex_idx
|
46
|
+
) nogil noexcept:
|
47
|
+
"""Returns the path length.
|
48
|
+
"""
|
49
|
+
|
50
|
+
cdef:
|
51
|
+
size_t i, j
|
52
|
+
int k
|
53
|
+
|
54
|
+
# initialization
|
55
|
+
j = <size_t>vertex_idx
|
56
|
+
i = j + 1
|
57
|
+
k = 0
|
58
|
+
|
59
|
+
# loop
|
60
|
+
while i != j:
|
61
|
+
i = j
|
62
|
+
j = <size_t>path_links[j]
|
63
|
+
k += 1
|
64
|
+
|
65
|
+
return k
|
66
|
+
|
67
|
+
|
68
|
+
cdef void _compute_path_second_pass(
|
69
|
+
cnp.uint32_t[::1] path_links,
|
70
|
+
cnp.uint32_t[::1] path_vertices,
|
71
|
+
int vertex_idx
|
72
|
+
) nogil noexcept:
|
73
|
+
"""Compute the sequence of vertices forming a path.
|
74
|
+
"""
|
75
|
+
cdef size_t i, j, k
|
76
|
+
|
77
|
+
# initialization
|
78
|
+
j = <size_t>vertex_idx
|
79
|
+
i = j + 1
|
80
|
+
k = 0
|
81
|
+
|
82
|
+
# loop
|
83
|
+
while i != j:
|
84
|
+
i = j
|
85
|
+
path_vertices[k] = j
|
86
|
+
j = <size_t>path_links[j]
|
87
|
+
k += 1
|
88
|
+
|
89
|
+
|
90
|
+
# author : Francois Pacull
|
91
|
+
# copyright : Architecture & Performance
|
92
|
+
# email: francois.pacull@architecture-performance.fr
|
93
|
+
# license : MIT
|