Graphsp Package for Graph Data Structure
Project description
Graphsp
Project description
This project implements algorithms associated with Graph Data Structure.
The following is the list of algorithm this library implements:
- Breadth First Search
- Depth First Search
- Dijkstra (Single Source Shortest Path)
- Floyd Warshall (All Pairs Shortest Path)
Installation
pip install graphsp
Usage
from graphsp import Graph
Initializing graph object
graph = graphsp.Graph(n, graph_type)
- n = Total number of nodes
- graph_type = directed / undirected [in string]
Initializing & Populating the graph
graph = graphsp.Graph(5, "undirected")
graph.bulk_link([(0, 4, 5), (0, 1, 1), (1, 4, 3),
(1, 3, 1), (1, 2, 15), (2, 3, 2), (3, 4, 3)])
print(graph.detect_cycle())
Using different algorithms
dfs = DFS(n, graph)
print(dfs.dfs(start_node))
bfs = BFS(n, graph)
print(bfs.bfs(start_node))
dj = Dijkstra(n, graph)
print(dj.dijkstra(start_node))
bf = BellmanFord(n, graph)
print(bf.bellman_ford(start_node))
fw = FloydWarshall(n, graph)
print(fw.floyd_warshall())
ts = TopoSorting(n, graph)
print(ts.topo_sorting())
pr = Prim(n, graph)
print(pr.prim())
ks = Kruskal(n, graph)
print(ks.kruskal())
kr = Kosaraju(n, graph)
print(kr.kosaraju())
- n = Total number of nodes
- start_node = Number on the desired starting node
- graph = Object of Graph class
Github repository
https://github.com/jainam2385/graphsp
License
© 2022 Jainam Shah
This repository is licensed under the MIT license. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphsp-1.0.0.tar.gz.
File metadata
- Download URL: graphsp-1.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7aecfbb28bde76c0d137a6c44f162537be169346f468d4738f8eb5da230aba7
|
|
| MD5 |
4beeda92ba94a224084cc1b9cc012179
|
|
| BLAKE2b-256 |
e07dac4ce975949a30a3b4eddd2080e5314ea3df261b983aa2f39528346a46d6
|
File details
Details for the file graphsp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: graphsp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01cd89005b5ba9cf29dc3a24bc542f71dc328b2b44af34fabaef1e9e10365dd9
|
|
| MD5 |
857c2cc2ecdfa49a893fb77a4dab31bd
|
|
| BLAKE2b-256 |
e2596c0f0ee1e5360d4d1cce2696da10dd506792afe3a8fc4a07096025cc05cc
|