/graph-and-applications

Graphs and its applications in Python based on my lecture notes.

Primary LanguagePython

Graph Implementations and Applications in Python

This repository is to showcase Graph implementations and its use-cases in Python.

Contents


graph.py

Classes

  • AdjMatrixGraph: Implementation of a base class for Undirected & Directed graphs
  • AdjMatrixUndiGraph: Implementation of Undirected Graphs using adjacency matrix.
  • AdjMatrixDiGraph: Implementation of Directed Graphs using adjacency matrix.
  • DFS: Implementation of Depth First Search
  • BFS: Implementation of Breadth First Search
  • GraphUtil: Implementation of a base class for Undirected & Directed Graph Util
  • UndirectedGraphUtil: A utility class for undirected graphs.
  • DirectedGraphUtil: A utility class for directed graphs.

Methods

  • visualize: Visualizes the given graph(s) using networkx
  • samples: Visualizes the sample datasets provided within the repository.

Screenshots

Here are some screenshots of the visualization results of the samples.

Click to expand images

tinyG.png mediumG.png mediumG2.png mediumG3.png largeG2.png

maze.py

maze.py is a great application of the Graph data structure. It's used to find the shortest path in a 10x10 maze. An Undirected Graph and BFS Algorithm are used in this application.

Here is a YouTube video ,recorded by me, showing how it's used.

Click to see the video

Maze Solver