DAA Project
DAA Project
GUIDED BY: -
2301020349@cgu-
O1. Muskan 2301020394 9006893673
odisha.ac.in
2301020761@cgu-
02. Akhilesh Kumar 2301020761 9142311287
odisha.ac.in
2301020562@cgu-
03. Sagar Pratap 2301020562 8210166803
odisha.ac.in
2301020223@cgu-
04. Anisha Mahto 2301020223 9835463672
odisha.ac.in
INTRODUCTION 05
HISTORICAL CONTEXT 06
THEORICAL CONTEXT 07
CONCLUSION 19
REFERENCES 20
3|P a ge
Group-2 Sub-group-1 Pipeline Connection System
1) ABSTRACT
3) HISTORICAL CONTEXT
7|P a ge
Group-2 Sub-group-1 Pipeline Connection System
the available hardware. This work laid the foundation for the widely used
Dijkstra algorithm that we recognize today.
Interestingly, a new problem arose from hardware engineers who
sought a method to minimize the amount of wire needed to connect the
pins on the back panel of the machine. Dijkstra revisited an earlier
problem, known as the minimal spanning tree problem, and re-
discovered an algorithm that would later be known as Prim's algorithm
(also re-discovered by Prim). This algorithm is used to find a subset of
edges in a weighted graph that connects all the vertices together, without
any cycles, and with the minimum possible total edge weight.
4) THEORITICAL CONTEXT
5) PROPOSED SOLUTION
Why This Algorithm Only Works with Graphs with Positive Weights:
Dijkstra’s algorithm works only with graphs that have positive edge
weights. This is because the algorithm’s mechanism relies on adding the
weights of edges to find the shortest path. If negative weights were
allowed, the algorithm could prematurely mark a node as visited, which
could prevent the discovery of a shorter path later on due to the possibility
of decreasing edge weights.
9|P a ge
Group-2 Sub-group-1 Pipeline Connection System
Implementation Steps:
1. Set Up Distances:
o The distance from the Main Supply Station (source node) is
initialized to 0, and the distances to all other houses (nodes)
are set to infinity (∞) because their shortest paths are initially
unknown.
2. Choose the Next Vertex:
o From the unvisited vertices, select the one with the smallest
distance value.
3. Update Distances:
o For the selected vertex, check all its neighbours. If a shorter
path is found via this vertex, update the neighbor’s distance
accordingly.
4. Repeat:
o Repeat the process until all vertices have been processed.
1. Initialization:
o Set the distance from the Main Supply Station to 0. All other
houses/facilities are set to infinity (∞).
2. Evaluate Neighbouring Facilities of the Main Supply Station:
o For each neighbouring facility, calculate the distance from the
Main Supply Station. If a shorter path is found, update the
distance for that house.
3. Select the Next Facility:
o Choose the unvisited facility with the smallest distance.
4. Repeat the Process:
o Continue selecting the next unvisited facility, marking it as
visited, and updating distances for its unvisited neighbours.
5. Completion:
Group-2 Sub-group-1 Pipeline Connection System
o The algorithm concludes when all facilities are visited and the
shortest distances to each facility from the Main Supply Station
are determined.
11 | P a g e
Group-2 Sub-group-1 Pipeline Connection System
GRAPH:
6) DIJKSTRA’S ALGORITHM
Find the unvisited node with the smallest known distance (this is
the "next node" to be processed).
Mark this node as visited.
Record this node in vertexseq to keep track of the visitation order.
• Update the distances for all unvisited neighbouring nodes
(relaxation):
Group-2 Sub-group-1 Pipeline Connection System
After completing the main loop, print a matrix showing the shortest
distances from the source to each node after each step.
• User Input for Destination:
Result Display:
For the example graph:
Path: A → B → D
Cost is X.
Here X is the total minimum cost from A to D. The code traces the
shortest path and provides the result in a clear step-by-step path
sequence.
Algorithm:
13 | P a g e
Group-2 Sub-group-1 Pipeline Connection System
Set the initial distance for the source node to 0 and all other nodes
to infinity (INT_MAX).
Initialize visivertices, an array to keep track of visited nodes (0
means unvisited, 1 means visited).
Identify the index of the source node (in this code, it’s A) and
initialize its distance as 0 in dijcomp.
Step 6: Output:
#include <ctype.h>
#define num_vertex 25
#define max 99999
int main() {
int visivertices[num_vertex], vertexseq[num_vertex];
char vertex[num_vertex] =
{'S','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','T','U','V','W','X','Y'};
char vertex_name[][10] = {
"CGU", "DVPL1", "DVPL2", "HVJ", "GREP1",
"GREP2", "EPC", "Dahej", "EPC2", "Dabhol",
"Kochi", "Bengaluru", "Assam", "Agartala", "End",
"Pata", "VSPL", "KG", "Cauvery", "Nangal",
"Vijaypur", "Phulpur", "Haldia", "Bokaro", "Dhamra"
};
int dijcomp[num_vertex][num_vertex];
for (int i = 0; i < num_vertex; i++) {
visivertices[i] = 0;
for (int j = 0; j < num_vertex; j++) {
15 | P a g e
Group-2 Sub-group-1 Pipeline Connection System
dijcomp[i][j] = max;
}
}
char source = 'S';
int row = -1;
for (int i = 0; i < num_vertex; i++) {
if (vertex[i] == source) {
row = i;
break;
}
}
dijcomp[row][row] = 0;
int seq = 1;
}
}
printf(" ");
for (int i = 0; i < num_vertex; i++) {
printf("%3c ", vertex[i]);
}
printf("\n");
char destination;
printf("\nEnter Your Destination: ");
scanf(" %c", &destination);
int pick = -1, sum = 0;
17 | P a g e
Group-2 Sub-group-1 Pipeline Connection System
char vert[num_vertex];
int col = pick, k = 0, min = max, prev_min = -1, prev_col = -1;
vert[k++] = vertexseq[pick];
printf("\n\n");
return 0;
}
19 | P a g e
Group-2 Sub-group-1 Pipeline Connection System
OUTPUT:
Group-2 Sub-group-1 Pipeline Connection System
1. Social Networking
3. Map Applications
21 | P a g e
Group-2 Sub-group-1 Pipeline Connection System
9) CONCLUSION
The findings presented here are drawn from various scholarly sources,
including Trudeau, R. J. (2013). Introduction to Graph Theory and
Abderrahim, M., et al. (2019). A clustering routing based on Dijkstra
algorithm for WSNs. These sources demonstrate the broad applicability
of Dijkstra's algorithm, from network design and optimization to practical
usage in modern navigation and communication systems. Dijkstra’s
algorithm remains a foundational tool in optimizing routes, minimizing
costs, and improving system efficiency across a wide range of industries.
10) REFERENCES
[1] Abderrahim, M., Hakim, H., Boujemaa, [10] Grobelny, J., & Michalski, R. (2017). A
H., & Touati, F. (2019, March). A novel version of simulated annealing
clustering routing based on Dijkstra based on linguistic patterns for solving
algorithm for WSNs. Proceedings of the facility layout problems. Knowledge-
2019 19th International Conference on Based Systems, 124, 55–69.
Sciences and Techniques of Automatic [11] Harb, A., Kassem, H., & Ghorayeb, K.
Control and Computer Engineering (2019). Black hole particle swarm
(STA), IEEE, 605–610. optimization for well placement
[2] Alawieh, A., Sabra, M., Sabra, Z., optimization. Computers & Geosciences,
Tomlinson, S., & Zaraket, F. A. (2015a). 1–22.
Molecular architecture of spinal cord [12] Hart, P. E., Nilsson, N. J., & Raphael,
injury protein interaction network. PloS B. (1968). A formal basis for the heuristic
One, 10(8), e0135024. determination of minimum cost paths.
[3] Alawieh, A., Sabra, Z., Sabra, M., IEEE Transactions on Systems Science
Tomlinson, S., & Zaraket, F. A. (2015b). A and Cybernetics, 4(2), 100–107.
rich-club organization in brain ischemia [13] He, G., Chen, D., Liao, K., Sun, J., &
protein interaction network. Scientific Nie, S. (2019a). A methodology for the
Reports, 5, 13513. optimal design of gathering pipeline
[4] BP Energy Outlook. (2020). Retrieved system in old oilfield during its phased
from development process. Computers &
https://www.bp.com/en/global/corporate/ Industrial Engineering, 130, 14–34.
energy-economics/energy-outlook.html [14] He, G., Li, Y., Lin, M., Liao, K., &
[5] Broumi, S., Bakal, A., Talea, M., Liang, Y. (2019b). Optimization of
Smarandache, F., & Vladareanu, L. gathering and transmission pipe network
(2016, November). Applying Dijkstra layout in gas field and pipeline route in 3D
algorithm for solving neutrosophic terrain. Journal of Pipeline Systems
shortest path problem. Proceedings of the Engineering and Practice, 10(2),
2016 International Conference on 04019009.
Advanced Mechatronic Systems [15] Imanparast, M., & Hashemi, S. N.
(ICAMechS), IEEE, 412–416. (2019). A linear time randomized
[6] de Lucena, R. R., Baioco, J. S., de Lima, approximation algorithm for Euclidean
B. S. L. P., Albrecht, C. H., & Jacob, B. P. matching. Journal of Supercomputing,
(2014). Optimal design of submarine 75(5), 2648–2664.
pipeline routes by genetic algorithm with [16] Iqbal, M., Zhang, K., Iqbal, S., & Tariq,
different constraint handling techniques. I. (2018). A fast and reliable Dijkstra
Advances in Engineering Software, 76, algorithm for online shortest path.
110–124. International Journal of Computer
[7] Dbouk, H. M., et al. (2021). Journal of Science and Engineering, 5, 24–27.
Petroleum Science and Engineering, 197, [17] Jia, J., Pan, J. S., & Xu, H. R. (2016,
107934. November). The middle of the specified
[8] Fan, A., Gardent, C., Braud, C., & Bordes, node set of shortest path algorithm.
A. (2019). Using Local Knowledge Graph Proceedings of the 2016 IEEE 13th
Construction to Scale Seq2seq Models to International Conference on Signal
Multi-Document Inputs. arXiv preprint Processing (ICSP), IEEE, 1823–1826.
arXiv:1910.08435. [18] Joret, G., Micek, P., de Mendez, P. O.,
[9] Fu, E., Bravo, M., & Roskos, B. (2015). & Wiechert, V. (2019). Nowhere dense
Single-destination navigation in a graph classes and dimension.
multiple-destination environment: a new Combinatorica, 39(5), 1055–1079.
“later-destination attractor” bias in route
choice. Memory & Cognition, 43(7),
1043–1055.