Skip to main content

Graph navigation

Project description

granavi

from granavi import Node

class Rail(Node):
	def __init__(self, name, raillength=1, description=""):
		super().__init__(name, description)
		self.raillength = raillength
	
class Station(Node):
	pass
	
station_a = Station("Station A")
station_b = Station("Station B")
station_c = Station("Station C")

rail_a_b = Rail("A -> B", 5)
[rail_a_b.connect(i, bidirect=True) for i in [station_a, station_b]]

rail_b_c = Rail("B -> C", 3)
for i in [station_b, station_c]:
	rail_b_c.connect(i, bidirect=True)

result = 0
for i in station_a.pathTo(station_c):
	if isinstance(i, Rail):
		result += i.raillength

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

granavi-0.0.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

granavi-0.0.7-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file granavi-0.0.7.tar.gz.

File metadata

  • Download URL: granavi-0.0.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for granavi-0.0.7.tar.gz
Algorithm Hash digest
SHA256 09a016b12879da626747d98b0579893ca3bcf66c3c4fa608d268a22aa457b7c2
MD5 9c99f927801a139df8e203bb9f90a630
BLAKE2b-256 413d758715b88fbc302bbd0c1c5c68df375ed5a164c8c568712f88ae51d3d102

See more details on using hashes here.

File details

Details for the file granavi-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: granavi-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for granavi-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d33f66128afe8336697ea81c108e383a3a09030a35f42868de995715a93b28d5
MD5 e9a15eb06bd5e302b2c2ba1cdca947f4
BLAKE2b-256 2426a28ceb297b4b605a88a025731f1dbec9d87cff6301a28a53fb90727eb5f1

See more details on using hashes here.

Supported by

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