GithubHelp home page GithubHelp logo

r-rishabh-j / priority-queues Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 66.08 MB

Implementation of Johnson's APSP algorithm using 4 different priority queues and a comparision of their relative performance.

C++ 100.00%
priority-queues johnson-apsp-algorithm

priority-queues's Introduction

Priority-Queues

Implementation of Johnson's APSP algorithm using 4 different priority queues and a comparision of their relative performance.

Steps to run

Compile the program by-

g++ main.cpp

Execute

./a.out 1 # for simple array-based heap execution  
./a.out 2 # for binary heap based execution
./a.out 3 # For binomial heap based execution
./a.out 4 # For fibonacci heap based execution

If no argument is supplied, fibonacci heap based Johnson algorithm will be executed by default.

Input format

First line of the input will specify the number of test cases.
For each test case, supply two integers N and D in the first line, specifying the number of vertices N, and D=0 for an undirected graph and D=1 for a directed graph. The next N lines of the test case should contain the NxN adjacency matrix of the graph, with each element specifying the edge weight (-999<W<999). If an edge does not exit between two vertices, enter the edge weight as '999999'.

Output format

For each test case,

  1. -1 is printed if a negative cycle exists in the graph.
  2. Else, N lines are printed, in which the kth entry in the ith line tells the lenght of the shortest path to the kth vertex from the ith vertex.

The last line of the output contains the time taken for each of the testcases to complete, with the kth entry corresponding to the kth testcase.

priority-queues's People

Contributors

r-rishabh-j avatar

Watchers

 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.