Git Product home page Git Product logo

visualization-of-popular-algorithms-in-python's Introduction

Visualization-of-popular-algorithms-in-Python

Description

The project aims to create visual outputs for popular graph algorithms like DFS,BFS and NP-HARD problems like Travelling Salesman Problem and Graph colouring problems using NetworkX graph library of Python. It is not just limited to getting a visual output, but the algorithms will be optimised to its best by using heuristics for non-polynomial time algorithms. The project aims to create a better understanding of the working of the algorithms, in-depth understanding of the application of heuristics to improve the computation time and usage of the later to our advantage in optimising the algorithm. It could be used by analysts as well as students and teachers, as a teaching aid. It could definitely serve all the applications of Np-hard problems like- School scheduling, Tourist Itineraries, etc.

Motivation

DFS,BFS and NP-Hard algorithms have been there for years now and it has been coded out in every programming language as well. This project aims in visulization of them, to create a better understanding. Solving most of the above mentioned algorithm using brute force-technique might give the optimal solution, however, as the problem size increases, the search for an optimal solution will no longer be worth the effort. Hence, by involving heuristics, we aim to improve the time complexity while arriving at a good solution( need not be optimal always). (Heuristics is used, to predict how close the end of path is to a solution, so that the paths which are judged to be closer to a solution are extended first.)

It includes:

1. DFS:

DFS

2. BFS:

BFS

3. Dijsktra's:

Dijsktra's

4. Prim's:

Prim's

5. Kruskal's:

Kruskal's

6. Assignment Problem:

Assignment Problem

7. Travelling Salesman Problem:

Travelling Salesman Problem

8. Greedy Best First Search:

Greedy BFS

9. A* Search:

A* Search

10. Topological Sort:

Topological Sort

11. Graph Coloring Problem:

Graph-Coloring Problem

12. K Centers Problem:

K Centers Problem

13. Egocentric Network:

Egocentric Network

14. Bellman-Ford algorithm:

Bellman Ford

visualization-of-popular-algorithms-in-python's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

visualization-of-popular-algorithms-in-python's Issues

Visualizing directed graphs in DFS

It would be better if the application displays directed graphs with arrows and weights.

Currently it overlaps different weight edges back and forth.

For example,
Sample input:
4 0 1 2 3 0 0 2 1 1 0 0 4 0 0 0 0 0

Sample output:
screen shot 2017-06-13 at 12 28 47 am

A* Search: "SyntaxError: inconsistent use of tabs and spaces in indentation"

Here's the output from my console:

%Run a_star_search.py
File "/Users/student/Downloads/Visualization-of-popular-algorithms-in-Python-master/A* Search/a_star_search.py", line 40
final_path = []
^
SyntaxError: inconsistent use of tabs and spaces in indentation

Any idea as to what i'm doing wrong, or is this a problem with the program itself?

Thanks

Getting an error on 54th line

File "main.py", line 54
color_map = ['blue'] * len(G.nodes())
^
TabError: inconsistent use of tabs and spaces in indentation

Error in greedy best first search

Please tell me how to resolve this error

File "greedy_bfs.py", line 103, in
greedyBFS(G, source, dest, heuristics, pos)
File "greedy_bfs.py", line 41, in greedyBFS
goal = greedyBFSUtil(G, source, visited, final_path, dest, 0)
File "greedy_bfs.py", line 24, in greedyBFSUtil
pq,size = getPriorityQueue(G[v])
File "greedy_bfs.py", line 10, in getPriorityQueue
q.put(Ordered_Node(heuristics[node],node))
File "C:\Users\raghu\AppData\Local\Programs\Python\Python36-32\lib\queue.py", line 143, in put
self._put(item)
File "C:\Users\raghu\AppData\Local\Programs\Python\Python36-32\lib\queue.py", line 227, in _put
heappush(self.queue, item)
TypeError: '<' not supported between instances of 'Ordered_Node' and 'Ordered_Node'

Want more info about Egocentric Network

Hi,

Thanks a lot for this useful repo
I've browsed through all algorithms
However, I can't find any info online regarding "Egocentric Network"
I do not understand what it does either, from the source code
Care to attach some links or add a README.md for it?

Thanks!

Visualization-of-popular-algorithms-in-Python/Prim's/prims.py

i am new in python so using this code i got this error:
Traceback (most recent call last):
File "C:/Users/Nano_/PycharmProjects/graph/graph.py", line 76, in
G = CreateGraph()
File "C:/Users/Nano_/PycharmProjects/graph/graph.py", line 58, in CreateGraph
if wtMatrix[i][j] > 0 :
TypeError: 'map' object is not subscriptable

Travelling Salesman Problem: TypeError: list indices must be integers, not dict

I'm trying to start Travelling Salesman Problem
on both python 2.7 and 3.5 have an error


TypeError Traceback (most recent call last)
in ()
156 plt.figure(1)
157 pos = DrawGraph(G,'black')
--> 158 opGraph = christofedes(G, pos)
159 plt.figure(2)
160 pos1 = DrawGraph(opGraph,'r')

in christofedes(G, pos)
95 # finds the hamiltonian circuit
96 curr = start
---> 97 visited[curr] = True
98 for nd in MST.neighbors(curr):
99 if visited[nd] == False or nd == start:

TypeError: list indices must be integers, not dict

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.