Free Samples

CSCI203 Algorithms And Data Structures

.cms-body-content table{width:100%!important;} #subhidecontent{ position: relative;

overflow-x: auto;

width: 100%;}

CSCI203 Algorithms And Data Structures

0 Download7 Pages / 1,592 Words

Course Code: CSCI203

University: University Of Wollongong

MyAssignmentHelp.com is not sponsored or endorsed by this college or university

Country: Australia

Question:

Dijkstra’s algorithm finds the shortest path from a given node to all other nodes.

1) We observe that we can modify this algorithm to stop as soon as a particular node is reached; thus producing an algorithm to find the shortest path between a specific pair of points. However, this algorithm may involve the consideration of a number of points which do not lie on the final shortest path.

We now consider 2 alternatives:

2) We can modify the algorithm to add nodes to the solution based on an A* criterion derived from the Euclidean (straight line) distance from each candidate node to the desired end node.

3) We can attempt to improve our efficiency by modifying Dijkstra’s algorithm to start at both the source and destination nodes and to construct two partial solution trees in parallel until one node is in both partial solution trees.

Your task is to:

Code the modified Dijkstra’s algorithm to search from the start node out.

Code the A* variant.

Code the proposed improved algorithm. Input consists of the following data:

1) The number of nodes in the graph.

2) A set of triples containing the node number, its X-coordinate and its Y coordinate – one triple for each node in the graph.

3) The number of edges in the graph.

4) A set of triples consisting of two node numbers and a cost – one triple for each edge in the graph.

5) A pair of node numbers representing the start and end nodes between which a path must be found.

Answer:

Introduction

In this project, we have to find the minimum distance while using the Dijkstra algorithm. To find the minimum distance from starting node to ending node. In this project, we use C++ language for developing a program. In this project contain compilation, an output of the program, planning for the complete solution, workflow, major events states, Dijkstra algorithm, challenges and reflection. The above topics are briefly described below.

Compilation

To find the shortest path using Dijkstra algorithm programs written by C++. This program is compiled in Dev C++. First, click the Execute tab, then click the Compile. The program is starting to compile when press the Compile button in the Dev C++.

The Shortestpath.cpp is the program name. The compilation time shows the three different types of categories such as compiling a single file, processing C++ source file and Compilation results. The compiling single file describes the filename and compiler name. The filename shows the program path. The E:Shortestpath.cpp is the file path. The processing C++ source file describes the C++ compiler and Command. The Compilation results show the errors, warnings, output file name, compilation time and output size. This program does not show any error and warning message. The compilation time is 0.63 seconds.

Output of the program

The program output contains the source, destination, distance and path. The source is referring to the starting point of the vertex. This program the starting point is 0. The destination refers to the ending point of the vertex. This program ending node is all other nodes. For example, the starting node is 0 the ending node is except source node such as the 1, 2, 3, 4, 5, 6 all nodes are called the destination. The source and destination are used to find the minimum distance between the vertices using a Dijkstra algorithm. The distance refers to the cost of the node. The 0 to 1 vertices cost is 3. The path has referred the location of the vertices. The 0 to 3 path is 0 1 4 3. It is the shortest path of the 0 to 3 vertices. The path is used to find the minimum distance

Planning for Complete Solution

The program is implemented to find the minimum distance between the vertices using the Dijkstra algorithm. The undirected graph used in this program for finding the minimum distance. The graph has the vertex and edge. The bidirectional format used in this graph. The undirected graph is also called the undirected network.

Workflow

In this program, the workflow is the source and destination is printed first. Next, find the destination. Then calculate the shortest path from source to all vertices. The graph is based on the number of vertexes. For example, the vertex is 7 the matrix has the seven rows and seven columns. Once developed the program compile the program. After compilation shows the errors when the error in this program otherwise it does not show any error. The compilation is successes, then run the program. The output displayed with the source, destination, distance, and path.

Major Event States

Starting node

In more precisely in graph theory, the undirected graph is a graph, that is a set of vertices linked through the edges, wherever the edges take a direction related to them.

Ending node

In given graph is an undirected graph, here be able to only one edge between every pair of nodes. In every node assists a starting node and the ending node. A sub graph of the graph includes a subset of edges and nodes.

Distance

A distance among the number of the edges in minimum distance between two vertices. This is called geodesic distance. There may be one minimum distance among other than the two vertices.

Path

A path is a curve, an endless injective function as of an intermission of the set of real numbers one or more usually to space for topology and space for metric. A path in a graph which doesn’t take the repeating vertices.

Dijkstra Algorithm

It is for calculating the shortest path from Starting node to sink almost as computation in costly as to manipulate the shortest way from starting node to some other vertex. The solution to be particular in starting node of Shortest Path in graph theory. It is undirected and directed graphs together. In all the edges has necessity weights for non-negative. The graph should be connected

Shortest path using the Dijkstra algorithm

Initially this is the empty set. To create a Shortest Path tree Set as that preserves the path of vertices contain in the Shortest Path tree that is whose shortest distance from starting node is calculated.

To allocate a distance of value into all the vertices in a graph input. Modify the distance of all value as infinite. Allocate the distance of value as 0 of source vertex. First, it is selected.

Although shortest path tree set does not contain all the vertices.

To choice a vertex 0 while it is not there in the shortest path tree set and it has the smallest value of distance. It contain 0 to the minimum distance tree Set.

To keep posted, the value of distance for all the neighboring vertices of 0. Keep posted, the value of distance, repeat in excess of the all adjacent vertices. In place of each neighboring vertices, if the sum of the value of distance from the starting node and the edge weight as, is smaller than the valued distance, and then to keep posted the valued distance of (GeeksforGeeks, 2018).

The above program has the read function. This function is used to read the number of vertices, matrices and source from the user. The number of vertices is greater than the 0. All members are matrix is must be the positive distance value. The source vertex is always the positive value of the 0 to the number of vertices -1.

Initialize

This function is used to initialize all data members at the opening of the execution. The distance between the sources to all other nodes. The source is considered as 0. The source to source distance is 0. The source to all other vertices is infinity. The infinity is 999. The initialization is false and procedure I initialized to -1.

Closest node

The getclosestunmarkednode is used to find the nearest node. This function returns the node which is a neighbor from the visited node. If the node is visited then it is searching for another node for a visit. The nearest node finds needs the number of vertices, minimum distance and visited node. The number of the vertex is stored in the numofvertices varia

Node with minimum distance

The minimum distance is used to find the distance of the vertices. The calculateDistance () is the function used to find the vertex with the minimum distance value. This value from the set of the vertex. It does not include in the shortest path tree. The minimum value-initialize use the minimum variable.

Solution

The solution contains the vertex, matrix, source, destination, and path. This program is developed to get the input from the user. First, enter the number of the vertex in the graph. Next, enter the weights for the row of the matrix. Then enter the source vertex. Then display the path of the vertices. Suppose enter the negative input for the weights for the row of the matrix it displays the warning message for entering the positive value. The path does not find it displays any path from source to destination.

Shortest Path

The shortest path is very important for this program. Find the shortest path for all vertices. The shortest path finds use the minimum distance method. The shortest path finds to verify the graph and the parent node. The path function is used to print the shortest path from source to destination. It uses the parent array to print the path.

Challenges and Reflection

We specified the output in a single file. We are interested in learning the Dijkstra algorithm and shortest path. The undirected graph used in this program for finding the shortest path between the vertices. First, we learned the Dijkstra algorithm, the shortest path, and undirected graph. The undirected graph contains the vertex and edges. The challenge is finding the minimum distance in the graph of unweighted with the floating point data. But we used the integer data for finding the path in the graph. We print the output has the source, destination, distance, and path. The matrix format, making is small difficult for me. The matrix has the number of rows and number of columns. We used the 7 rows and 7 columns in this program. The Matrix format is

0

3

4

0

0

0

0

5

0

0

0

7

0

0

10

0

0

9

0

1

0

0

0

6

0

11

0

0

0

8

0

2

0

0

7

0

0

11

0

0

0

10

0

0

0

0

4

3

0

It is used to find the minimum distance. The values represent the cost of the vertex. The 0 represents the non-cost of the vertex. We got the error while compiling this program.

The error shows the same small mistake. We define the wrong method name. We declared the calculateditance but assign the calculateDistance.

Conclusion

In this project, we have been finding the shortest path of the algorithm is explained and executed successfully. The output of the program has been verified successfully. This project has been implemented while using C++ language. In this project contained compilation, an output of the program, planning for the complete solution, workflow, major events states, Dijkstra algorithm, challenges and reflection. These are explained in a detailed manner.

References

C++, S. (2018). Shortest path algorithm using Dijkstra’s Algorithm in C++. [Online] Stack Overflow. Available at: https://stackoverflow.com/questions/27207419/shortest-path-algorithm-using-dijkstras-algorithm-in-c [Accessed 30 Oct. 2018].

GeeksforGeeks. (2018). Dijsktra’s algorithm. [Online] Available at: https://www.geeksforgeeks.org/dijkstras-shortest-path-algorithm-greedy-algo-7/ [Accessed 30 Oct. 2018].

Free Membership to World’s Largest Sample Bank

To View this & another 50000+ free samples. Please put

your valid email id.

Yes, alert me for offers and important updates

Submit

Download Sample Now

Earn back the money you have spent on the downloaded sample by uploading a unique assignment/study material/research material you have. After we assess the authenticity of the uploaded content, you will get 100% money back in your wallet within 7 days.

UploadUnique Document

DocumentUnder Evaluation

Get Moneyinto Your Wallet

Total 7 pages

PAY 4 USD TO DOWNLOAD

*The content must not be available online or in our existing Database to qualify as

unique.

Cite This Work

To export a reference to this article please select a referencing stye below:

APA

MLA

Harvard

OSCOLA

Vancouver

My Assignment Help. (2021). Algorithms And Data Structures. Retrieved from https://myassignmenthelp.com/free-samples/csci203-introduction-to-computer-science/shortest-path-algorithm-using-dijkstras.html.

“Algorithms And Data Structures.” My Assignment Help, 2021, https://myassignmenthelp.com/free-samples/csci203-introduction-to-computer-science/shortest-path-algorithm-using-dijkstras.html.

My Assignment Help (2021) Algorithms And Data Structures [Online]. Available from: https://myassignmenthelp.com/free-samples/csci203-introduction-to-computer-science/shortest-path-algorithm-using-dijkstras.html[Accessed 18 December 2021].

My Assignment Help. ‘Algorithms And Data Structures’ (My Assignment Help, 2021)

My Assignment Help. Algorithms And Data Structures [Internet]. My Assignment Help. 2021 [cited 18 December 2021]. Available from: https://myassignmenthelp.com/free-samples/csci203-introduction-to-computer-science/shortest-path-algorithm-using-dijkstras.html.

×

.close{position: absolute;right: 5px;z-index: 999;opacity: 1;color: #ff8b00;}

×

Thank you for your interest

The respective sample has been mail to your register email id

×

CONGRATS!

$20 Credited

successfully in your wallet.

* $5 to be used on order value more than $50. Valid for

only 1

month.

Account created successfully!

We have sent login details on your registered email.

User:

Password:

For years now, MyAssignmenthelp.com is providing affordable essay help to millions of students worldwide. Our essay assistance services have helped us in assisting students with even the toughest essay assignments. We take pride in the fact that we cater the best assistance to search terms like help me with my essay. We offer affordable services in the fastest way possible. For our fast delivering services, students trust us with their urgent essay assignment needs. Two of our most popular essay writing services are maths essay help and English essay help.

Latest Management Samples

div#loaddata .card img {max-width: 100%;

}

MPM755 Building Success In Commerce

Download :

0 | Pages :

9

Course Code: MPM755

University: Deakin University

MyAssignmentHelp.com is not sponsored or endorsed by this college or university

Country: Australia

Answers:

Introduction

The process of developing a successful business entity requires a multidimensional analysis of several factors that relate to the internal and external environment in commerce. The areas covered in this current unit are essential in transforming the business perspective regarding the key commerce factors such as ethics, technology, culture, entrepreneurship, leadership, culture, and globalization (Nzelibe, 1996; Barza, 2…

Read

More

SNM660 Evidence Based Practice

Download :

0 | Pages :

8

Course Code: SNM660

University: The University Of Sheffield

MyAssignmentHelp.com is not sponsored or endorsed by this college or university

Country: United Kingdom

Answers:

Critical reflection on the objective, design, methodology and outcome of the research undertaken Assessment-I

Smoking and tobacco addiction is one of the few among the most basic general restorative issues, particularly to developed nations such as the UK. It has been represented that among all risk segments smoking is the fourth driving purpose behind infections and other several ailments like asthma, breathing and problems in the l…

Read

More

Tags:

Australia Maidstone Management Business management with marketing University of New South Wales Masters in Business Administration

BSBHRM513 Manage Workforce Planning

Download :

0 | Pages :

20

Course Code: BSBHRM513

University: Tafe NSW

MyAssignmentHelp.com is not sponsored or endorsed by this college or university

Country: Australia

Answer:

Task 1

1.0 Data on staff turnover and demographics

That includes the staffing information of JKL industries for the fiscal year of 2014-15, it can be said that the company is having problems related to employee turnover. For the role of Senior Manager in Sydney, the organization needs 4 managers; however, one manager is exiting. It will make one empty position which might hurt the decision making process. On the other hand, In Brisba…

Read

More

MKT2031 Issues In Small Business And Entrepreneurship

Download :

0 | Pages :

5

Course Code: MKT2031

University: University Of Northampton

MyAssignmentHelp.com is not sponsored or endorsed by this college or university

Country: United Kingdom

Answer:

Entrepreneurial ventures

Entrepreneurship is the capacity and willingness to develop, manage, and put in order operations of any business venture with an intention to make profits despite the risks that may be involved in such venture. Small and large businesses have a vital role to play in the overall performance of the economy. It is, therefore, necessary to consider the difference between entrepreneurial ventures, individual, and c…

Read

More

Tags:

Turkey Istanbul Management University of Employee Masters in Business Administration

MN506 System Management

Download :

0 | Pages :

7

Course Code: MN506

University: Melbourne Institute Of Technology

MyAssignmentHelp.com is not sponsored or endorsed by this college or university

Country: Australia

Answer:

Introduction

An operating system (OS) is defined as a system software that is installed in the systems for the management of the hardware along with the other software resources. Every computer system and mobile device requires an operating system for functioning and execution of operations. There is a great use of mobile devices such as tablets and Smartphones that has increased. One of the widely used and implemented operating syste…

Read

More

Tags:

Australia Cheltenham Computer Science Litigation and Dispute Management University of New South Wales Information Technology

Next