edsger 0.1.1__cp39-cp39-win32.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.cp39-win32.pyd +0 -0
- edsger/commons.pxd +25 -0
- edsger/commons.pyx +34 -0
- edsger/dijkstra.cp39-win32.pyd +0 -0
- edsger/dijkstra.pyx +504 -0
- edsger/networks.py +414 -0
- edsger/path.py +786 -0
- edsger/path_tracking.cp39-win32.pyd +0 -0
- edsger/path_tracking.pyx +93 -0
- edsger/pq_4ary_dec_0b.cp39-win32.pyd +0 -0
- edsger/pq_4ary_dec_0b.pxd +33 -0
- edsger/pq_4ary_dec_0b.pyx +692 -0
- edsger/spiess_florian.cp39-win32.pyd +0 -0
- edsger/spiess_florian.pyx +368 -0
- edsger/star.cp39-win32.pyd +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 +26 -0
- edsger-0.1.1.dist-info/WHEEL +5 -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
|
Binary file
|
@@ -0,0 +1,33 @@
|
|
1
|
+
""" Priority queue based on a minimum binary heap. Header file.
|
2
|
+
"""
|
3
|
+
|
4
|
+
cimport numpy as cnp
|
5
|
+
|
6
|
+
from edsger.commons cimport DTYPE_t, ElementState
|
7
|
+
|
8
|
+
|
9
|
+
cdef struct Element:
|
10
|
+
DTYPE_t key
|
11
|
+
ElementState state
|
12
|
+
size_t node_idx
|
13
|
+
|
14
|
+
cdef struct PriorityQueue:
|
15
|
+
size_t length # number of elements in the array
|
16
|
+
size_t size # number of elements in the heap
|
17
|
+
size_t* A # array storing the binary tree
|
18
|
+
Element* Elements # array storing the elements
|
19
|
+
|
20
|
+
cdef void init_pqueue(PriorityQueue*, size_t, size_t) nogil
|
21
|
+
cdef void free_pqueue(PriorityQueue*) nogil
|
22
|
+
cdef void insert(PriorityQueue*, size_t, DTYPE_t) nogil
|
23
|
+
cdef DTYPE_t peek(PriorityQueue*) nogil
|
24
|
+
cdef size_t extract_min(PriorityQueue*) nogil
|
25
|
+
cdef bint is_empty(PriorityQueue*) nogil
|
26
|
+
cdef void decrease_key(PriorityQueue*, size_t, DTYPE_t) nogil
|
27
|
+
cdef cnp.ndarray copy_keys_to_numpy(PriorityQueue*, size_t)
|
28
|
+
|
29
|
+
|
30
|
+
# author : Francois Pacull
|
31
|
+
# copyright : Architecture & Performance
|
32
|
+
# email: francois.pacull@architecture-performance.fr
|
33
|
+
# license : MIT
|