logarithma 0.1.0__tar.gz
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.
- logarithma-0.1.0/LICENSE +21 -0
- logarithma-0.1.0/PKG-INFO +84 -0
- logarithma-0.1.0/README.md +29 -0
- logarithma-0.1.0/pyproject.toml +63 -0
- logarithma-0.1.0/setup.cfg +4 -0
- logarithma-0.1.0/src/logarithma/__init__.py +34 -0
- logarithma-0.1.0/src/logarithma/algorithms/__init__.py +17 -0
- logarithma-0.1.0/src/logarithma/algorithms/shortest_path/__init__.py +22 -0
- logarithma-0.1.0/src/logarithma/algorithms/shortest_path/dijkstra.py +153 -0
- logarithma-0.1.0/src/logarithma/utils/__init__.py +0 -0
- logarithma-0.1.0/src/logarithma/visualization/__init__.py +0 -0
- logarithma-0.1.0/src/logarithma.egg-info/PKG-INFO +84 -0
- logarithma-0.1.0/src/logarithma.egg-info/SOURCES.txt +14 -0
- logarithma-0.1.0/src/logarithma.egg-info/dependency_links.txt +1 -0
- logarithma-0.1.0/src/logarithma.egg-info/requires.txt +12 -0
- logarithma-0.1.0/src/logarithma.egg-info/top_level.txt +1 -0
logarithma-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Can Akyıldırım
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: logarithma
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: High-performance graph algorithms library featuring advanced shortest path algorithms
|
|
5
|
+
Author-email: Can AKYILDIRIM <akyildirimcan@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Can Akyıldırım
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/softdevcan/logarithma
|
|
29
|
+
Project-URL: Repository, https://github.com/softdevcan/logarithma
|
|
30
|
+
Project-URL: Bug Tracker, https://github.com/softdevcan/logarithma/issues
|
|
31
|
+
Keywords: graph,algorithms,shortest-path,optimization
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: numpy>=1.20.0
|
|
45
|
+
Requires-Dist: networkx>=2.6
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
48
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
49
|
+
Requires-Dist: isort>=5.0; extra == "dev"
|
|
50
|
+
Requires-Dist: flake8>=5.0; extra == "dev"
|
|
51
|
+
Provides-Extra: viz
|
|
52
|
+
Requires-Dist: matplotlib>=3.5; extra == "viz"
|
|
53
|
+
Requires-Dist: plotly>=5.0; extra == "viz"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
# 📐 Logarithma
|
|
57
|
+
|
|
58
|
+
> *Next-generation algorithms for computational optimization*
|
|
59
|
+
|
|
60
|
+
[](https://badge.fury.io/py/logarithma)
|
|
61
|
+
[](https://www.python.org/downloads/)
|
|
62
|
+
[](https://opensource.org/licenses/MIT)
|
|
63
|
+
|
|
64
|
+
**Logarithma** is a high-performance Python library that breaks traditional algorithmic barriers. Our flagship implementation features the groundbreaking **O(m log^{2/3} n)** shortest path algorithm, surpassing the classical Dijkstra's O(m + n log n) bound for the first time.
|
|
65
|
+
|
|
66
|
+
## ✨ Features
|
|
67
|
+
|
|
68
|
+
- 🚀 **Revolutionary SSSP**: First deterministic algorithm to break the sorting barrier
|
|
69
|
+
- 📊 **Multiple Domains**: Finance, logistics, social networks, telecommunications
|
|
70
|
+
- ⚡ **High Performance**: Optimized implementations with rigorous complexity analysis
|
|
71
|
+
- 🔬 **Research Ready**: Built for both academic research and production systems
|
|
72
|
+
- 🐍 **Pythonic**: Clean, intuitive API designed for modern Python
|
|
73
|
+
|
|
74
|
+
## 🎯 Quick Start
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import logarithma
|
|
78
|
+
|
|
79
|
+
# Revolutionary shortest path algorithm
|
|
80
|
+
distances = logarithma.paths.shortest_path(graph, source)
|
|
81
|
+
|
|
82
|
+
# Coming soon: Extended algorithmic toolkit
|
|
83
|
+
logarithma.optimization.solve()
|
|
84
|
+
logarithma.analysis.complexity()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 📐 Logarithma
|
|
2
|
+
|
|
3
|
+
> *Next-generation algorithms for computational optimization*
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/logarithma)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
**Logarithma** is a high-performance Python library that breaks traditional algorithmic barriers. Our flagship implementation features the groundbreaking **O(m log^{2/3} n)** shortest path algorithm, surpassing the classical Dijkstra's O(m + n log n) bound for the first time.
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- 🚀 **Revolutionary SSSP**: First deterministic algorithm to break the sorting barrier
|
|
14
|
+
- 📊 **Multiple Domains**: Finance, logistics, social networks, telecommunications
|
|
15
|
+
- ⚡ **High Performance**: Optimized implementations with rigorous complexity analysis
|
|
16
|
+
- 🔬 **Research Ready**: Built for both academic research and production systems
|
|
17
|
+
- 🐍 **Pythonic**: Clean, intuitive API designed for modern Python
|
|
18
|
+
|
|
19
|
+
## 🎯 Quick Start
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import logarithma
|
|
23
|
+
|
|
24
|
+
# Revolutionary shortest path algorithm
|
|
25
|
+
distances = logarithma.paths.shortest_path(graph, source)
|
|
26
|
+
|
|
27
|
+
# Coming soon: Extended algorithmic toolkit
|
|
28
|
+
logarithma.optimization.solve()
|
|
29
|
+
logarithma.analysis.complexity()
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "logarithma"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "High-performance graph algorithms library featuring advanced shortest path algorithms"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Can AKYILDIRIM", email = "akyildirimcan@gmail.com"},
|
|
13
|
+
]
|
|
14
|
+
keywords = ["graph", "algorithms", "shortest-path", "optimization"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.8",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.8"
|
|
27
|
+
dependencies = [
|
|
28
|
+
"numpy>=1.20.0",
|
|
29
|
+
"networkx>=2.6",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=7.0",
|
|
35
|
+
"black>=22.0",
|
|
36
|
+
"isort>=5.0",
|
|
37
|
+
"flake8>=5.0",
|
|
38
|
+
]
|
|
39
|
+
viz = [
|
|
40
|
+
"matplotlib>=3.5",
|
|
41
|
+
"plotly>=5.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/softdevcan/logarithma"
|
|
46
|
+
Repository = "https://github.com/softdevcan/logarithma"
|
|
47
|
+
"Bug Tracker" = "https://github.com/softdevcan/logarithma/issues"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
where = ["src"]
|
|
51
|
+
include = ["logarithma*"]
|
|
52
|
+
|
|
53
|
+
[tool.black]
|
|
54
|
+
line-length = 88
|
|
55
|
+
target-version = ['py38']
|
|
56
|
+
|
|
57
|
+
[tool.isort]
|
|
58
|
+
profile = "black"
|
|
59
|
+
line_length = 88
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
testpaths = ["tests"]
|
|
63
|
+
addopts = ["-v", "--tb=short"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
LOGARITHMA - Graph Algorithms Library
|
|
4
|
+
=====================================
|
|
5
|
+
|
|
6
|
+
High-performance graph algorithms library featuring advanced shortest path algorithms.
|
|
7
|
+
|
|
8
|
+
Quick Start:
|
|
9
|
+
>>> import logarithma as lg
|
|
10
|
+
>>> import networkx as nx
|
|
11
|
+
>>>
|
|
12
|
+
>>> # Create a simple graph
|
|
13
|
+
>>> G = nx.Graph()
|
|
14
|
+
>>> G.add_edge('A', 'B', weight=4)
|
|
15
|
+
>>> G.add_edge('A', 'C', weight=2)
|
|
16
|
+
>>>
|
|
17
|
+
>>> # Find shortest paths
|
|
18
|
+
>>> distances = lg.dijkstra(G, 'A')
|
|
19
|
+
>>> print(distances)
|
|
20
|
+
"""
|
|
21
|
+
__version__ = "0.1.0"
|
|
22
|
+
__author__ = "Can AKYILDIRIM"
|
|
23
|
+
|
|
24
|
+
# Import main algorithms for easy access
|
|
25
|
+
from .algorithms import dijkstra, dijkstra_with_path
|
|
26
|
+
|
|
27
|
+
# Package metadata
|
|
28
|
+
__all__ = [
|
|
29
|
+
'dijkstra',
|
|
30
|
+
'dijkstra_with_path',
|
|
31
|
+
'__version__'
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
print("LOGARITHMA library imported successfully!")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LOGARITHMA Algorithms Module
|
|
3
|
+
===========================
|
|
4
|
+
|
|
5
|
+
Graph algorithms collection including shortest paths,
|
|
6
|
+
minimum spanning trees, and advanced optimization algorithms.
|
|
7
|
+
|
|
8
|
+
Modules:
|
|
9
|
+
- shortest_path: Single-source and all-pairs shortest path algorithms
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from .shortest_path import dijkstra, dijkstra_with_path
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
'dijkstra',
|
|
16
|
+
'dijkstra_with_path'
|
|
17
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shortest Path Algorithms
|
|
3
|
+
========================
|
|
4
|
+
|
|
5
|
+
Collection of shortest path algorithms for graph analysis.
|
|
6
|
+
|
|
7
|
+
Available algorithms:
|
|
8
|
+
- dijkstra: Classic Dijkstra's algorithm
|
|
9
|
+
- dijkstra_with_path: Dijkstra with path reconstruction
|
|
10
|
+
|
|
11
|
+
Future algorithms:
|
|
12
|
+
- fast_sssp: O(m log^{2/3} n) algorithm
|
|
13
|
+
- bellman_ford: For graphs with negative weights
|
|
14
|
+
- floyd_warshall: All-pairs shortest paths
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .dijkstra import dijkstra, dijkstra_with_path
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
'dijkstra',
|
|
21
|
+
'dijkstra_with_path'
|
|
22
|
+
]
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Dijkstra's Shortest Path Algorithm
|
|
3
|
+
=================================
|
|
4
|
+
|
|
5
|
+
Classic O(V² + E) implementation of Dijkstra's algorithm
|
|
6
|
+
for finding shortest paths in weighted graphs.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import heapq
|
|
10
|
+
from typing import Dict, List, Optional, Union
|
|
11
|
+
import networkx as nx
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def dijkstra(graph: nx.Graph, source: Union[int, str]) -> Dict[Union[int, str], float]:
|
|
15
|
+
"""
|
|
16
|
+
Find shortest paths from source to all other vertices using Dijkstra's algorithm.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
graph: NetworkX graph with edge weights
|
|
20
|
+
source: Starting vertex
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
Dictionary mapping each vertex to its shortest distance from source
|
|
24
|
+
|
|
25
|
+
Raises:
|
|
26
|
+
ValueError: If source vertex not in graph
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
>>> import networkx as nx
|
|
30
|
+
>>> from logarithma.algorithms.shortest_path import dijkstra
|
|
31
|
+
>>>
|
|
32
|
+
>>> G = nx.Graph()
|
|
33
|
+
>>> G.add_edge('A', 'B', weight=4)
|
|
34
|
+
>>> G.add_edge('A', 'C', weight=2)
|
|
35
|
+
>>> G.add_edge('B', 'C', weight=1)
|
|
36
|
+
>>>
|
|
37
|
+
>>> distances = dijkstra(G, 'A')
|
|
38
|
+
>>> print(distances)
|
|
39
|
+
{'A': 0, 'C': 2, 'B': 3}
|
|
40
|
+
"""
|
|
41
|
+
# Validate input
|
|
42
|
+
if source not in graph:
|
|
43
|
+
raise ValueError(f"Source vertex '{source}' not found in graph")
|
|
44
|
+
|
|
45
|
+
# Initialize distances
|
|
46
|
+
distances = {node: float('inf') for node in graph.nodes()}
|
|
47
|
+
distances[source] = 0
|
|
48
|
+
|
|
49
|
+
# Priority queue: (distance, vertex)
|
|
50
|
+
pq = [(0, source)]
|
|
51
|
+
visited = set()
|
|
52
|
+
|
|
53
|
+
while pq:
|
|
54
|
+
current_dist, current = heapq.heappop(pq)
|
|
55
|
+
|
|
56
|
+
# Skip if already processed
|
|
57
|
+
if current in visited:
|
|
58
|
+
continue
|
|
59
|
+
|
|
60
|
+
visited.add(current)
|
|
61
|
+
|
|
62
|
+
# Check all neighbors
|
|
63
|
+
for neighbor in graph.neighbors(current):
|
|
64
|
+
# Get edge weight
|
|
65
|
+
weight = graph[current][neighbor].get('weight', 1)
|
|
66
|
+
new_distance = current_dist + weight
|
|
67
|
+
|
|
68
|
+
# Update if shorter path found
|
|
69
|
+
if new_distance < distances[neighbor]:
|
|
70
|
+
distances[neighbor] = new_distance
|
|
71
|
+
heapq.heappush(pq, (new_distance, neighbor))
|
|
72
|
+
|
|
73
|
+
return distances
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def dijkstra_with_path(graph: nx.Graph, source: Union[int, str],
|
|
77
|
+
target: Optional[Union[int, str]] = None) -> Dict:
|
|
78
|
+
"""
|
|
79
|
+
Dijkstra algorithm that also returns the shortest paths.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
graph: NetworkX graph with edge weights
|
|
83
|
+
source: Starting vertex
|
|
84
|
+
target: Target vertex (if None, finds paths to all vertices)
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Dictionary with 'distances' and 'paths' keys
|
|
88
|
+
|
|
89
|
+
Example:
|
|
90
|
+
>>> result = dijkstra_with_path(G, 'A', 'B')
|
|
91
|
+
>>> print(result['distances']['B']) # Distance to B
|
|
92
|
+
>>> print(result['paths']['B']) # Path to B
|
|
93
|
+
"""
|
|
94
|
+
# Validate input
|
|
95
|
+
if source not in graph:
|
|
96
|
+
raise ValueError(f"Source vertex '{source}' not found in graph")
|
|
97
|
+
if target and target not in graph:
|
|
98
|
+
raise ValueError(f"Target vertex '{target}' not found in graph")
|
|
99
|
+
|
|
100
|
+
# Initialize
|
|
101
|
+
distances = {node: float('inf') for node in graph.nodes()}
|
|
102
|
+
distances[source] = 0
|
|
103
|
+
previous = {node: None for node in graph.nodes()}
|
|
104
|
+
|
|
105
|
+
# Priority queue
|
|
106
|
+
pq = [(0, source)]
|
|
107
|
+
visited = set()
|
|
108
|
+
|
|
109
|
+
while pq:
|
|
110
|
+
current_dist, current = heapq.heappop(pq)
|
|
111
|
+
|
|
112
|
+
# Early termination if target found
|
|
113
|
+
if target and current == target:
|
|
114
|
+
break
|
|
115
|
+
|
|
116
|
+
if current in visited:
|
|
117
|
+
continue
|
|
118
|
+
|
|
119
|
+
visited.add(current)
|
|
120
|
+
|
|
121
|
+
# Process neighbors
|
|
122
|
+
for neighbor in graph.neighbors(current):
|
|
123
|
+
weight = graph[current][neighbor].get('weight', 1)
|
|
124
|
+
new_distance = current_dist + weight
|
|
125
|
+
|
|
126
|
+
if new_distance < distances[neighbor]:
|
|
127
|
+
distances[neighbor] = new_distance
|
|
128
|
+
previous[neighbor] = current
|
|
129
|
+
heapq.heappush(pq, (new_distance, neighbor))
|
|
130
|
+
|
|
131
|
+
# Reconstruct paths
|
|
132
|
+
def get_path(target_node):
|
|
133
|
+
if distances[target_node] == float('inf'):
|
|
134
|
+
return []
|
|
135
|
+
|
|
136
|
+
path = []
|
|
137
|
+
current = target_node
|
|
138
|
+
while current is not None:
|
|
139
|
+
path.append(current)
|
|
140
|
+
current = previous[current]
|
|
141
|
+
return path[::-1]
|
|
142
|
+
|
|
143
|
+
# Build paths dictionary
|
|
144
|
+
if target:
|
|
145
|
+
paths = {target: get_path(target)}
|
|
146
|
+
else:
|
|
147
|
+
paths = {node: get_path(node) for node in graph.nodes()
|
|
148
|
+
if distances[node] != float('inf')}
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
'distances': distances,
|
|
152
|
+
'paths': paths
|
|
153
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: logarithma
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: High-performance graph algorithms library featuring advanced shortest path algorithms
|
|
5
|
+
Author-email: Can AKYILDIRIM <akyildirimcan@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Can Akyıldırım
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/softdevcan/logarithma
|
|
29
|
+
Project-URL: Repository, https://github.com/softdevcan/logarithma
|
|
30
|
+
Project-URL: Bug Tracker, https://github.com/softdevcan/logarithma/issues
|
|
31
|
+
Keywords: graph,algorithms,shortest-path,optimization
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: numpy>=1.20.0
|
|
45
|
+
Requires-Dist: networkx>=2.6
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
48
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
49
|
+
Requires-Dist: isort>=5.0; extra == "dev"
|
|
50
|
+
Requires-Dist: flake8>=5.0; extra == "dev"
|
|
51
|
+
Provides-Extra: viz
|
|
52
|
+
Requires-Dist: matplotlib>=3.5; extra == "viz"
|
|
53
|
+
Requires-Dist: plotly>=5.0; extra == "viz"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
# 📐 Logarithma
|
|
57
|
+
|
|
58
|
+
> *Next-generation algorithms for computational optimization*
|
|
59
|
+
|
|
60
|
+
[](https://badge.fury.io/py/logarithma)
|
|
61
|
+
[](https://www.python.org/downloads/)
|
|
62
|
+
[](https://opensource.org/licenses/MIT)
|
|
63
|
+
|
|
64
|
+
**Logarithma** is a high-performance Python library that breaks traditional algorithmic barriers. Our flagship implementation features the groundbreaking **O(m log^{2/3} n)** shortest path algorithm, surpassing the classical Dijkstra's O(m + n log n) bound for the first time.
|
|
65
|
+
|
|
66
|
+
## ✨ Features
|
|
67
|
+
|
|
68
|
+
- 🚀 **Revolutionary SSSP**: First deterministic algorithm to break the sorting barrier
|
|
69
|
+
- 📊 **Multiple Domains**: Finance, logistics, social networks, telecommunications
|
|
70
|
+
- ⚡ **High Performance**: Optimized implementations with rigorous complexity analysis
|
|
71
|
+
- 🔬 **Research Ready**: Built for both academic research and production systems
|
|
72
|
+
- 🐍 **Pythonic**: Clean, intuitive API designed for modern Python
|
|
73
|
+
|
|
74
|
+
## 🎯 Quick Start
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import logarithma
|
|
78
|
+
|
|
79
|
+
# Revolutionary shortest path algorithm
|
|
80
|
+
distances = logarithma.paths.shortest_path(graph, source)
|
|
81
|
+
|
|
82
|
+
# Coming soon: Extended algorithmic toolkit
|
|
83
|
+
logarithma.optimization.solve()
|
|
84
|
+
logarithma.analysis.complexity()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/logarithma/__init__.py
|
|
5
|
+
src/logarithma.egg-info/PKG-INFO
|
|
6
|
+
src/logarithma.egg-info/SOURCES.txt
|
|
7
|
+
src/logarithma.egg-info/dependency_links.txt
|
|
8
|
+
src/logarithma.egg-info/requires.txt
|
|
9
|
+
src/logarithma.egg-info/top_level.txt
|
|
10
|
+
src/logarithma/algorithms/__init__.py
|
|
11
|
+
src/logarithma/algorithms/shortest_path/__init__.py
|
|
12
|
+
src/logarithma/algorithms/shortest_path/dijkstra.py
|
|
13
|
+
src/logarithma/utils/__init__.py
|
|
14
|
+
src/logarithma/visualization/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
logarithma
|