Skip to main content

A Python implementation for networks of nodes.

Project description

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 latest 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.

Files for pynetworks, version 0.6.1
Filename, size File type Python version Upload date Hashes
Filename, size pynetworks-0.6.1-py3-none-any.whl (20.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pynetworks-0.6.1.tar.gz (10.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page