Code Monkey home page Code Monkey logo

python-graph-algorithmic-problems-visualizations's Introduction

๐ŸŒ Python-Graph-Algorithmic-Problems-Visualizations

1. Getting Started

The package is not currently available on PyPI or any other Python package repository. The easiest way to install it is to clone the GitHub repository and install it from source.

Prerequisites

Installation Instructions

Run the following commands in a shell (a UNIX-like environment is assumed):

$ git clone [email protected]:jimmyg1997/Python-Graph-Algorithmic-Problems-Visualizations/
$ cd Python-Graph-Algorithmic-Problems-Visualizations/
$ make install

The package does not have any dependencies besides Python itself. If you wish to sandbox your installation inside a virtual environment, you may choose to use virtualenvwrapper or a similar utility to do so.

When successfully installed, the following programs will be available and placed on your PATH. See the Usage section below for details about how to use these programs.

  • labyrinth

2. Concept and Contents

This is a project that explores algorithmic graph theory by visiting some of known graph algorithmic problems and visual solutions. The main goal is to systematically present essnetial key examples that highlight efficients algorithms in a visual representation. Most of the key techniques from these algorithms have already found applications in optimization, machine learning and statistics.

Agenda

Program Problem Solved Algorithms Used
#1 Labyrinth Shortest Path (undirected, unweighted) โ€ข Grid Generation : {binary, sidewinder}
โ€ข Shortest Path : {bfs, dfs}

3. Usage

At any time, you can use the -h or --help flags to see a summary of options that the program accepts.

Program #1 - Labyrinth

$ labyrinth -h
usage:labyrinth [-h] [-s SYMBOLS] [-f GRID_FN] [-ag {binary,sidewinder}] [-d DIMENSIONS] [-p BINARY_PCT] [-ap {dfs,bfs}]

Parse or generate labyrinth and find exit paths using different algorithms

optional arguments:
  -h, --help            show this help message and exit
  -s SYMBOLS, --symbols SYMBOLS
                        Give the 4 symbols in the following order : Wall->Move->Start->End
  -f GRID_FN, --grid_fn GRID_FN
                        [Grid][Method#1 Parsing] Give the name of the csv file for the grid
  -ag {binary,sidewinder}, --algorithm_generate {binary,sidewinder}
                        [Grid][Method#2 Generation] The algorithm to generate the grid labyrinth
  -d DIMENSIONS, --dimensions DIMENSIONS
                        [Grid][Method#2 Generation] Give width / height of the generated grid
  -p BINARY_PCT, --binary_pct BINARY_PCT
                        [Grid][Method#2 Generation] Give ghe percentage of the biomial geration
  -ap {dfs,bfs}, --algorithm_shortest_path {dfs,bfs}
                        The algorithm to find the path in a labyrinth

Typical usage is labyrinth -ag <algorithm_generation> -d <dimensions>, where <algorithm_generation> can be binary, sidewinder and <dimensions> is a string like 10x10 describing the dimensions of the maze to generate (width x height). The program will generate a random maze of the given size and print an ASCII representation of the maze to the console

Example

labyrinth -s "# ๐—๐„" -ag binary -d 6x6 -p 0.9 -ap bfs
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
|    โœ… ๐˜€๐˜๐—ฒ๐—ฝ ๐Ÿญ : Constructing (1) Grid (2) Graph      |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
|    โœ… ๐˜€๐˜๐—ฒ๐—ฝ ๐Ÿฎ : Find shortest path (undirected, unweighted)      |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
|    โœ… ๐˜€๐˜๐—ฒ๐—ฝ ๐Ÿฏ : Visualize shortest path if existing      |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
 #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #
 #                    โ‡ฃ  โ‡   โ‡   โ‡   โ‡   โ‡   โ‡   โ‡   โ‡   โ‡   #
 #     #  #     #  #  โ‡ฃ  #  #     #  #     #  #  โ‡ก  #
 #     #  #     #  #  โ‡ฃ  #  #     #  #     #  #  โ‡ก  #
 #     #  #     #  #  โ‡ฃ  #  #     #  #     #  #  โ‡ก  ๐—
 #     #  #     #  #  โ‡ฃ  #  #     #  #     #  #     #
 #     #  #     #  #  โ‡ฃ  #  #     #  #     #  #     #
 #     #  #     #  #  โ‡ฃ  #  #     #  #     #  #     #
 #     #  #  #  #  #  โ‡ฃ  #  #     #  #     #  #     #
 #     #  #  #  #  #  โ‡ฃ  #  #     #  #     #  #     #
 #     #  #  โ‡ฃ  โ‡   โ‡   โ‡   #  #     #  #     #  #     #
 #  #  #  #  โ‡ฃ  #  #     #  #     #  #     #  #     #
 #  #  #  #  โ‡ฃ  #  #     #  #     #  #     #  #     #
 #  โ‡ฃ  โ‡   โ‡   โ‡   #  #     #  #     #  #     #  #     #
 #  โ‡ฃ  #  #     #  #     #  #     #  #     #  #     #
 ๐„  โ‡   #  #     #  #     #  #     #  #     #  #     #
 #     #  #     #  #     #  #     #  #     #  #     #
 #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #

4. References

This project owes a massive debt of gratitude to the following resources :

Program #1 - Labyrinth

python-graph-algorithmic-problems-visualizations's People

Contributors

jimmyg1997 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.