-
Notifications
You must be signed in to change notification settings - Fork 42
Assignment Completed :) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
srjpn
wants to merge
20
commits into
SimranP:master
Choose a base branch
from
srjpn:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implemented hasEdgesBetween which gives boolean value according to the presence of edge. Also implemented addVertex which add the vertex and addEdge which creates edge between two vertices as a part of implementing the basic graph.
Implemented order method which gives the order of the graph. It is the number of vertices in the graph.
Implemented size method which gives the size of the graph. It is basically the number of edges in the graph.
Implemented pathBetween which returns a path between the given vertices. There is no guarantee that the shortest or farthest will be returned.
Implemented farthestVertex which returns the farthest vertex from a given vertex.
Implemented undirectedGraph which has all methods as directed graph with a little changes in the methods.
Implemented allPaths which gives all the paths between two given vertices. It is working with dense graph also. But may need further optimisation.
Implemented all the methods that directed graph has to undirected graph. All tests are passing.
Instead of repeating the prototype twice for each undirected and directed graph, now i have created a graph object which has the methods that are common for directed and undirected graphs. The additional methods are added to the constructors seperately.
The size method in both directed and undirected graphs were similar except one of them was returning the half of the caluculated value. To avoid the repeatation of code twice, created numberOfEdges method in graph and edited size method in directed and undirected graphs.
Implemented a simple shortestPath method in weightedGraph which gives the shortest path between 2 given vertices in weightedGraph. Also Implemented some necessary objects such as edge for the weightedGraph.
Modified and refactored shortestPath of weightedGraph to work with the graphs having loops. A new test of dense graph is added to prove the working of shortestPath on very complicated dense graph.
Modified dense graph test a little. All tests are passing.
Instead of altering the array by adding a key called pathLength inside the array, now it is using a object called Path. Path is a simple object which has a path and length of tha path. It can be further developed as per requirement.
Implemented and tested the shortestPath method of weightedGraph using Digestra's algorithm. Added more tests to check the working of algorithm with dense, complex and multi graphs.
Refactored the weightedGraph object for common names such as edge, weigth etc.
Instead of having basic graph in graphs module, now it is in differnt module which can be required by other modules to use basic graph.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.