Generate and plot metric and weighted graphs
Project description
MetricGraph
metricgraph is a Python package to generate, manipulate, and visualize metric graphs in 2D and 3D. It supports directed/undirected graphs, self-loops, connectivity constraints, and interactive plotting.
📚 Documentation
Full documentation is available at: https://metricgraph.readthedocs.io/en/latest/
⚡ Installation
You can install the package via pip:
pip install metricgraph
Or install from source:
git clone https://github.com/yourusername/metricgraph.git
cd metricgraph
pip install -e .
🚀 Examples
import numpy as np
import random
from metricgraph import MetricGraph, WeightedGraph
# Constructor test + graph plot
vertices = [[0, 0, 0.1],
[0, 0.8, -0.1],
[1, 0, 0.4],
[0.7, 0.4, 0.3]]
edges = [[0, 1], [0, 2], [1, 1], [2, 3], [3, 2]]
graph = MetricGraph(vertices, edges)
print(graph)
print(graph.get_properties())
graph.plot(directed=True)
# Generate weighted graph test + weight plots
random.seed(42)
graph2 = WeightedGraph.generate_graph(n_vertices=10, n_dim=2)
graph2.set_edges_weight('test', np.arange(9))
graph2.set_vertices_weight('test2', np.arange(10))
graph2.plot_weight('test2', title='test vertices weight')
graph2.plot_weight('test', title='test edges weight')
🛠 Features
- Generate graphs with specified number of vertices, dimensions, and connectivity constraints
- Compute graph metrics and boundary nodes
- Interactive 2D/3D plotting
- Weighted graphs support
- Fully documented API
📄 License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file metricgraph-0.1.0.tar.gz.
File metadata
- Download URL: metricgraph-0.1.0.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ccfb292c2799a626457af3e52f96d509be7d2c6a157393221c97ae2be7e46bd
|
|
| MD5 |
96238d47b6ac61d1dc0c53d4ffa358b7
|
|
| BLAKE2b-256 |
5a950e616a2e9e53e8629a43406fa3dc963ae492660646707013d5dc6d7543d7
|
File details
Details for the file metricgraph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: metricgraph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
491d62ce3258f7ad54cce583b651d33dc1d2b91afe0fa15180e830064af2fa88
|
|
| MD5 |
ae4fd7bee493af96c7478e406d77ac1f
|
|
| BLAKE2b-256 |
4b7907f6e5987187aa24192a5de9aa72e7554ecf70c491e9611a566eb34a5bbe
|