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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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