3C Tecnología. Glosas de innovación aplicadas a la pyme. ISSN: 2254 – 4143 Ed. 34 Vol. 9 N.º 2 Junio - Septiembre
61
http://doi.org/10.17993/3ctecno/2020.v9n2e34.49-69
8
B. Dijkstra's algorithm
The Dijkstra algorithm, also called the minimum path algorithm, is a model that is
classified within the search algorithms. Its objective is to determine the shortest route,
from the origin node to any node in the network. Its methodology is based on iterations,
so that, in practice, its development becomes difficult as the size of the network
increases, leaving it at a clear disadvantage, compared to optimization methods based
on mathematical programming (Jungnickel, 1999).
(ℎ, )
∈ []
[] =
_[] =
[] =
[] = 0
(, (, []))
! ()
= _í()
[] =
∈ []
¡
[
]
[] > []+ ℎ(, )
[] = [] + ℎ(, )
_[] =
(, (, []))
C. Prim Algorithm
Prim's algorithm, given a related graph, not directed and weighted, finds a minimal
expansion tree. That is, it can find a subset of the edges that form a tree that includes
all the vertices of the initial graph, where the total weight of the edges of the tree is the
minimum possible (Jungnickel, 1999).
Given a set of nodes N, a set of edges E, and a cost function p, our network (graph) G
is defined. To apply the Prim algorithm and solve the problem of the minimum
expansion tree, all costs associated with the edges mustn't be negative. It is an algorithm
that continuously increases the size of a tree, starting with an initial node, chosen at
random, to which nodes are added whose distance successively to the previous ones is
minimal. In each step, we will consider the edges that contain nodes that already belong
to the tree. The minimum cost expansion tree is entirely constructed when there are no
more nodes left to add (Jungnickel, 1999).
(ℎ(, , ))
[] =
[] =
(, < , [] >)
[] = 0
! ()
= í()
′′
9
(( ∈ )&&([] > (, ))
[] =
[] = (, )
(, < , [] >)[10]
3.3. Route size indicator
The size of the route is defined as the sum of the weights of all the edges of the graph
that the algorithm has traveled.
For the graph in above Figure 2:
A. Routes that each algorithm has followed
• Naive Algorithm: 0 → 1 → 2
• Dijkstra algorithm: 0 → 2
• Prim Algorithm: 0 → 2
B. Route size obtained with each algorithm
• Naive Algorithm: 1 + 20 = 21
• Dijkstra Algorithm: 5
• Prim Algorithm: 5
Both the Dijkstra and Prim algorithms have obtained an optimal route size, with a value
of 5.
3.4. Algorithmic efficiency complexity indicator
Big O notation is used to asymptotically limit the growth of a runtime that is within
constant factors above and below. Sometimes we want to limit only above. It is
convenient to have a form of asymptotic notation that means "the execution time grows
at most by this much, but it can grow more slowly." We use the "big O" notation just
for these occasions. If execution time is O (f (n)), then for a sufficiently large n, the
execution time is at most k * f (n) for some constant k (Magzhan & Jani, 2013).
A. The efficiency of the naive algorithm (approximate)
(||) = (|||)
B. Dijkstra algorithm efficiency
((|| + ||)||) = (||||)
C. Prim algorithm efficiency
(
!
)
To observe results quantitatively, the table 1 will show the data obtained from a
previous study (Magzhan & Jani, 2013), regarding Dijkstra's algorithm and others;
subsequently, the values will be extrapolated to the cases of the naive algorithm, of
3.3. ROUTE SIZE INDICATOR
The size of the route is dened as the sum of the weights of all the edges of the graph that the algorithm
has traveled.
For the graph in above Figure 2:
A. Routes that each algorithm has followed
• Naive Algorithm: 0 → 1 → 2
• Dijkstra algorithm: 0 → 2
• Prim Algorithm: 0 → 2
B. Route size obtained with each algorithm
• Naive Algorithm: 1 + 20 = 21
• Dijkstra Algorithm: 5
• Prim Algorithm: 5
Both the Dijkstra and Prim algorithms have obtained an optimal route size, with a value of 5.