Skip to main content

A Python implementation for networks of nodes.

Project description

pynetworks

Description

A Python package that provides structure for networks of interconnected nodes using the DOT language for representation.

Installation

The source code for pynetworks is hosted on GitHub. You can install pynetworks with pip:

pip install pynetworks

Documentation

Read the full documentation for pynetworks here.

Example Usage

Node

>>> a = Node('A')
>>> b = Node('B')
>>> a.connect(b, 3)

Printing a gives:

graph {
    "A" -- "B" [label=3]
}

shortest_path()

>>> a = Node('A')
>>> b = Node('B')
>>> c = Node('C')
>>> a.connect(b, 3)
>>> b.connect(c, 5)
>>> path = shortest_path(a, c)
>>> path.weight
8

Printing path gives:

graph {
    "B" -- "C" [label=5]
    "A" -- "B" [label=3]
}

Network

>>> a = Node('A')
>>> b = Node('B')
>>> c = Node('C')
>>> a.connect(b, 3)
>>> net = Network([a, b, c])

Printing net gives:

graph {
	"C"
	"A" -- "B" [label=3]
}

License

GNU.

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

pynetworks-0.4.13.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file pynetworks-0.4.13.tar.gz.

File metadata

  • Download URL: pynetworks-0.4.13.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pynetworks-0.4.13.tar.gz
Algorithm Hash digest
SHA256 3fac6fab5adeb7ee962d99af38ca8dd52ea15795f0659e3c515beeebd7689b17
MD5 cdae884dca6ec5a43382b85d73e26d1b
BLAKE2b-256 a2e97e0c30b599b6d4576dbec7e8cf4a110cb3cd0c9935b4e580ebd0463813f1

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