topolib 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.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.
Potentially problematic release.
This version of topolib might be problematic. Click here for more details.
- topolib/analysis/metrics.py +6 -6
- {topolib-0.4.1.dist-info → topolib-0.4.2.dist-info}/METADATA +40 -59
- {topolib-0.4.1.dist-info → topolib-0.4.2.dist-info}/RECORD +5 -5
- {topolib-0.4.1.dist-info → topolib-0.4.2.dist-info}/WHEEL +0 -0
- {topolib-0.4.1.dist-info → topolib-0.4.2.dist-info}/licenses/LICENSE +0 -0
topolib/analysis/metrics.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Metrics module for network topology analysis.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from typing import List,
|
|
5
|
+
from typing import List, Dict, Optional
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
from topolib.topology import Topology
|
|
@@ -12,16 +12,16 @@ class Metrics:
|
|
|
12
12
|
"""
|
|
13
13
|
Provides static methods for computing metrics on network topologies.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
All methods receive a Topology instance.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Methods
|
|
18
18
|
-------
|
|
19
19
|
node_degree(topology)
|
|
20
|
-
|
|
20
|
+
Calculates the degree of each node.
|
|
21
21
|
link_length_stats(topology)
|
|
22
|
-
|
|
22
|
+
Calculates statistics (min, max, avg) of link lengths.
|
|
23
23
|
connection_matrix(topology)
|
|
24
|
-
|
|
24
|
+
Builds the adjacency matrix.
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
@staticmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: topolib
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A compact Python library for modeling, analyzing, and visualizing optical network topologies.
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -31,7 +31,7 @@ Project-URL: Repository, https://gitlab.com/DaniloBorquez/topolib
|
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
33
|
# Topolib 🚀
|
|
34
|
-
|
|
34
|
+
# Topolib 🚀
|
|
35
35
|
|
|
36
36
|
[](https://www.python.org/)
|
|
37
37
|
[](LICENSE)
|
|
@@ -40,99 +40,80 @@ Description-Content-Type: text/markdown
|
|
|
40
40
|
[](https://gitlab.com/DaniloBorquez/topolib/-/pipelines?ref=release)
|
|
41
41
|
[](https://topolib.readthedocs.io/en/latest/?badge=latest)
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
> **Topolib** is a compact, modular Python library for modeling, analyzing, and visualizing optical network topologies.
|
|
44
|
+
> **Goal:** Provide researchers and engineers with a simple, extensible toolkit for working with nodes, links, metrics, and map-based visualizations.
|
|
45
|
+
>
|
|
46
|
+
> 🌐 **Model** | 📊 **Analyze** | 🗺️ **Visualize** | 🧩 **Extend**
|
|
47
|
+
|
|
48
|
+
---
|
|
44
49
|
|
|
45
|
-
##
|
|
50
|
+
## 📂 Examples
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
Explore ready-to-run usage examples in the [`examples/`](examples/) folder!
|
|
53
|
+
- [Show topology on a map](examples/show_topology_in_map.py) 🗺️
|
|
54
|
+
- More coming soon!
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
- `Node` — represents a network node with id, name and geographic coordinates
|
|
51
|
-
- `Link` — connects two `Node` objects and stores link length and id
|
|
56
|
+
---
|
|
52
57
|
|
|
53
|
-
|
|
54
|
-
- `Topology` — holds nodes and links, provides methods to add/remove nodes and links, compute metrics, export JSON, and compute shortest/disjoint paths
|
|
55
|
-
- `Path` — represents a path through the topology
|
|
58
|
+
## 🧭 Overview
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
- `Metrics` — functions to compute node degree, link length statistics, connection matrices, etc.
|
|
60
|
+
Topolib is organized into four main modules:
|
|
59
61
|
|
|
60
|
-
- `
|
|
61
|
-
|
|
62
|
+
- 🧱 **Elements:** `Node`, `Link` — basic building blocks
|
|
63
|
+
- 🕸️ **Topology:** `Topology`, `Path` — manage nodes, links, paths, and adjacency
|
|
64
|
+
- 📈 **Analysis:** `Metrics` — compute node degree, link stats, connection matrices
|
|
65
|
+
- 🖼️ **Visualization:** `MapView` — plot topologies on real maps
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
---
|
|
64
68
|
|
|
65
|
-
## Features
|
|
66
|
-
|
|
69
|
+
## ✨ Features
|
|
70
|
+
|
|
71
|
+
- Modular, extensible design
|
|
67
72
|
- Easy-to-use classes for nodes, links, and paths
|
|
68
73
|
- Built-in metrics and analysis helpers
|
|
69
74
|
- JSON import/export and interoperability
|
|
70
75
|
- Ready for Sphinx, Read the Docs, and PyPI
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
---
|
|
73
78
|
|
|
74
|
-
|
|
79
|
+
## ⚡ Quickstart
|
|
75
80
|
|
|
76
81
|
```bash
|
|
77
82
|
python -m venv .venv
|
|
78
83
|
source .venv/bin/activate
|
|
79
|
-
|
|
80
|
-
python -m pip install -r dev-requirements.txt
|
|
81
|
-
python -m pytest -q
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Installation
|
|
85
|
-
|
|
86
|
-
```bash
|
|
84
|
+
pip install -U pip
|
|
87
85
|
pip install topolib
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
---
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
git clone https://gitlab.com/DaniloBorquez/topolib.git
|
|
94
|
-
cd topolib
|
|
95
|
-
python -m venv .venv
|
|
96
|
-
source .venv/bin/activate
|
|
97
|
-
pip install -e .
|
|
98
|
-
pip install -r dev-requirements.txt
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Documentation
|
|
90
|
+
## 📚 Documentation
|
|
102
91
|
|
|
103
92
|
Full documentation: [https://topolib.readthedocs.io/](https://topolib.readthedocs.io/)
|
|
104
93
|
|
|
105
|
-
|
|
94
|
+
---
|
|
106
95
|
|
|
107
|
-
|
|
96
|
+
## 📝 Basic usage
|
|
97
|
+
|
|
98
|
+
```python
|
|
108
99
|
from topolib.elements.node import Node
|
|
109
100
|
from topolib.topology.topology import Topology
|
|
110
101
|
|
|
111
|
-
# Create nodes
|
|
112
102
|
n1 = Node(1, 'A', 10.0, 20.0)
|
|
113
103
|
n2 = Node(2, 'B', 11.0, 21.0)
|
|
114
|
-
|
|
115
|
-
#
|
|
116
|
-
topo = Topology()
|
|
117
|
-
topo.add_node(n1)
|
|
118
|
-
topo.add_node(n2)
|
|
119
|
-
# add links, compute metrics, visualize
|
|
104
|
+
topo = Topology(nodes=[n1, n2])
|
|
105
|
+
# Add links, compute metrics, visualize, etc.
|
|
120
106
|
```
|
|
121
107
|
|
|
108
|
+
---
|
|
122
109
|
|
|
123
|
-
## Development
|
|
124
|
-
|
|
125
|
-
See `CONTRIBUTING.md` for development guidelines, commit message rules and pre-commit setup.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
## Class diagram
|
|
110
|
+
## 🛠️ Development
|
|
130
111
|
|
|
131
|
-
|
|
112
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for development guidelines, commit message rules, and pre-commit setup.
|
|
132
113
|
|
|
133
|
-
|
|
114
|
+
---
|
|
134
115
|
|
|
135
|
-
## License
|
|
116
|
+
## 📄 License
|
|
136
117
|
|
|
137
|
-
|
|
118
|
+
MIT — see [`LICENSE`](LICENSE) for details.
|
|
138
119
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
topolib/__init__.py,sha256=iLmy2rOkHS_4KZWMD8BgT7R3tLMKeaTCDVf3B4FyYxM,91
|
|
2
2
|
topolib/analysis/__init__.py,sha256=qvUC9wV_jQNQIlwJXk7LJ-dkTXhH1Ttn0lKWIdwBbrc,52
|
|
3
|
-
topolib/analysis/metrics.py,sha256=
|
|
3
|
+
topolib/analysis/metrics.py,sha256=2o5PlMVzepDWwSQjzamtKemggqkxh9JuzzCUaeahfok,2555
|
|
4
4
|
topolib/assets/Abilene_IXP.json,sha256=5cnPMbjsNDjmpySdQDYQ2yd83zOFvCRjlAnbX1wyzgk,6010
|
|
5
5
|
topolib/assets/China_pop.json,sha256=v-bs5qib8-CB81rvBNNM9ssoelrNGuFrPEyRCht9YpY,22262
|
|
6
6
|
topolib/assets/DT-50_pop.json,sha256=hCv1MCvipgdrQ34VT-qXJ68BdATriQ8ZObh0fLPqar4,29719
|
|
@@ -12,7 +12,7 @@ topolib/topology/path.py,sha256=oUNwmpBcS6LMMAJIxokROm3MVqr7vRR44M3Fh5ADq_w,2057
|
|
|
12
12
|
topolib/topology/topology.py,sha256=PzPx80TxWMcOwpOCh4fohcWT2YUra-4m04tBjqyMU40,5605
|
|
13
13
|
topolib/visualization/__init__.py,sha256=wv065-KB5uDbTaQIASPVfMMW5sE76Bs-q0oai48vAzk,29
|
|
14
14
|
topolib/visualization/mapview.py,sha256=4iKJMYsH6oFNj9tOcgSKLVRtoYfUuH3XLjShsGwUXcM,2799
|
|
15
|
-
topolib-0.4.
|
|
16
|
-
topolib-0.4.
|
|
17
|
-
topolib-0.4.
|
|
18
|
-
topolib-0.4.
|
|
15
|
+
topolib-0.4.2.dist-info/METADATA,sha256=O2V7bL8xtAJOhNVmbLX0mHLj1ic5ZZu_3bbnFFbEzAw,3993
|
|
16
|
+
topolib-0.4.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
17
|
+
topolib-0.4.2.dist-info/licenses/LICENSE,sha256=kbnIP0XU6f2ualiTjEawdlU81IGPBbwc-_GF3N-1e9E,1081
|
|
18
|
+
topolib-0.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|