jssandh2 / graph-algorithms

An implementation of certain Graph Algorithms in Python 3.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graph Algorithms

Language

  • Python 3.0

Repository

File Structure

  • src/graph/* -- Implementation of the Vertex, Edge & Graph classes with appropriate Data-Structures

  • src/algorithms/* -- Implementation of the Algorithms that utilize the Graph objects from src/graph/Graph.py

Purpose

  • This is a repository that shall contain the following :

    • Implementation of the Graph, Vertex and Edge Classes

    • Implementation of Shortest-Path (Djikstra & Bellman-Ford), All-pairs Shortest-Path (Floyd-Warshall) Algorithms

    • Implementation of 2 Minimum Spanning Tree Algorithms (Kruskal & Prim)

    • Implementation of a 2-partite-ness predictor (Predicts whether a Graph is Bi-Partite)

    • Implementation of Matching Algorithms

Running Instructions

  • Clone the repo: git clone git@github.com:jssandh2/graph_algorithms.git in a suitable local directory.

  • You can instantiate new Graph Classes by adding a main method in Graph.py. Example:

if __name__ == "__main__":
    graph_a = Graph(["a", "b", "c", "d"], [["a", "b", 3], ["b", "d"], ["d", "a", 2], ["a", "c", 5]])
    graph_a.add_vertex("e")
    graph_a.add_edge(["b", "e", 6])
  • You can also remove edges & vertices, along with use the Graph object to implement Algorithms (Coming Soon!)

About

An implementation of certain Graph Algorithms in Python 3.0

License:Artistic License 2.0


Languages

Language:Python 100.0%