Skip to main content

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/ploki99/metricgraph.git
cd metricgraph
pip install -e .

🚀 Examples

import numpy as np
import random

from metricgraph import MetricGraph, WeightedGraph

# Construct 3D MetricGraph and plot it
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 2D WeightedGraph and plot edges/vertices weights 
random.seed(42)
graph2 = WeightedGraph.generate_graph(n_vertices=10, n_dim=2)
graph2.set_edges_weight('edge_test', np.arange(9))
graph2.plot_weight('edge_test', title='test edges weight')
graph2.set_vertices_weight('vert_test', np.arange(10))
graph2.plot_weight('vert_test', title='test vertices 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

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metricgraph-0.1.1.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metricgraph-0.1.1-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file metricgraph-0.1.1.tar.gz.

File metadata

  • Download URL: metricgraph-0.1.1.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

Hashes for metricgraph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5427ecb97e465cad510a417a36d02b3eec676ec4b6ad9f3c26534c28d3a2509e
MD5 07af216916f5ef5394cc8c4e9a8d3a03
BLAKE2b-256 0e22fcd93881b2732de16f2484e5b2fe87d0e99486a38455ae599c948c9cf642

See more details on using hashes here.

File details

Details for the file metricgraph-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: metricgraph-0.1.1-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

Hashes for metricgraph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f13fa3bbd909004a300ce99ff91a9cc00409272aa625ac3f439f2e706ffc5285
MD5 48a919a4ab527a82f9975668552c8986
BLAKE2b-256 01e5ac8c97b4dd7e2aa163018fd068a769400e75ffbe9a2178aacdf564e6cec7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page