Skip to main content

ShabiiNetwork

ShabiiNetwork is a Python library for dealing with Graphs and Dijkstra’s algorithm.

Installation

Use the package manager pip to install ShabiiNetwork.

pip install ShabiiNetwork

Usage

from ShabiiNetwork import Digraph,Dijkstra

graph2 = Digraph()

    #To check add_edge and add_edges functions
    graph2.add_edges([('A','B',0.3),('A','C',0.5),
                     ('B','A',0.3),('B','C',0.9),
                     ('C','A',0.5),('C','D',1.2),
                     ('D','C',1.2)])
    print(graph2.Edict)

    graph2.add_edges([('A','D',45),('A','E',23)])
    print(graph2.Edict)

    #To check remove_edge and remove_edges functions
    graph2.remove_edges([('A','D'),('A','E')])
    print(graph2.Edict)

    #To check add_vertex and add_vertices functions
    graph2.add_vertices(['I','J','K'])
    print(graph2.Edict)

    #To check remove_vertex and remove_vertices functions
    graph2.remove_vertices(['I','J','K'])
    print(graph2.Edict)

    #To check Dijkstra class and its functions
    dijkstra = Dijkstra(graph2, start_vertex='A')
    dijkstra.dijkstra()
    dijkstra.print_result()

    """
    Output:

    {'A': {'B': 0.3, 'C': 0.5}, 'B': {'A': 0.3, 'C': 0.9}, 'C': {'A': 0.5, 'D': 1.2}, 'D': {'C': 1.2}}
    {'A': {'B': 0.3, 'C': 0.5, 'D': 45, 'E': 23}, 'B': {'A': 0.3, 'C': 0.9}, 'C': {'A': 0.5, 'D': 1.2}, 'D': {'C': 1.2}}
    {'A': {'B': 0.3, 'C': 0.5}, 'B': {'A': 0.3, 'C': 0.9}, 'C': {'A': 0.5, 'D': 1.2}, 'D': {'C': 1.2}}
    {'A': {'B': 0.3, 'C': 0.5}, 'B': {'A': 0.3, 'C': 0.9}, 'C': {'A': 0.5, 'D': 1.2}, 'D': {'C': 1.2}, 'I': {}, 'J': {}, 'K': {}}
    {'A': {'B': 0.3, 'C': 0.5}, 'B': {'A': 0.3, 'C': 0.9}, 'C': {'A': 0.5, 'D': 1.2}, 'D': {'C': 1.2}}
    A -> A: ['A'] distance: 0
    A -> B: ['A', 'B'] distance: 0.3
    A -> C: ['A', 'C'] distance: 0.5
    A -> D: ['A', 'C', 'D'] distance: 1.7
    """

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Author

Charawi Detphumi

License

MIT

Release files for ShabiiNetwork 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ShabiiNetwork 0.0.1
File Size Uploaded
ShabiiNetwork-0.0.1.tar.gz 4.3 kB Details

Release files / ShabiiNetwork-0.0.1.tar.gz

Download URL ShabiiNetwork-0.0.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
32879bdc5edd332f7f47d86cf07f9b63485f4441f3ba29ad2d84603ba35e1030
BLAKE2b-256 checksum
How to use checksums
544ea73d939eaf0032cdc0171108ad3f89853c474d5bb38091b31b9f83e6dae6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page