mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: add new graph algorithms, make some minor corrections to the programs in examples/graphs (#14562)
This commit is contained in:
parent
dc9ff7cab2
commit
5b97ad15ad
@ -8,7 +8,7 @@ https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/
|
||||
For Portugese reference
|
||||
http://rascunhointeligente.blogspot.com/2010/10/o-algoritmo-de-bellman-ford-um.html
|
||||
|
||||
By CCS
|
||||
code by CCS
|
||||
*/
|
||||
|
||||
const large = 999999 // almost inifinity
|
||||
@ -159,5 +159,3 @@ fn main() {
|
||||
}
|
||||
println('\n BYE -- OK')
|
||||
}
|
||||
|
||||
//=================================================
|
||||
|
@ -237,5 +237,3 @@ fn main() {
|
||||
|
||||
println('\n BYE -- OK')
|
||||
}
|
||||
|
||||
//********************************************************************
|
||||
|
@ -8,8 +8,9 @@ by CCS
|
||||
PS: all the pre-requisites of Dijkstra are considered
|
||||
|
||||
$ v run file_name.v
|
||||
|
||||
Creating a executable
|
||||
$ v run file_name.v -o an_executable.EXE
|
||||
$ v -o an_executable.EXE run file_name.v
|
||||
$ ./an_executable.EXE
|
||||
|
||||
Code based from : Data Structures and Algorithms Made Easy: Data Structures and Algorithmic Puzzles, Fifth Edition (English Edition)
|
||||
@ -45,9 +46,7 @@ fn push_pq<T>(mut prior_queue []T, data int, priority int) {
|
||||
temp << prior_queue[i]
|
||||
i++
|
||||
}
|
||||
prior_queue = temp.clone()
|
||||
// I am not sure if it the right way
|
||||
// IS IT THE RIGHT WAY?
|
||||
prior_queue = temp.clone() // I am not sure if it the right way
|
||||
}
|
||||
|
||||
// Change the priority of a value/node ... exist a value, change its priority
|
||||
@ -193,9 +192,6 @@ fn main() {
|
||||
| / \ |
|
||||
(3)-------(4)
|
||||
9
|
||||
*/
|
||||
|
||||
/*
|
||||
Let us create following weighted graph
|
||||
From https://www.geeksforgeeks.org/kruskals-minimum-spanning-tree-algorithm-greedy-algo-2/?ref=lbp
|
||||
10
|
||||
@ -226,5 +222,3 @@ fn main() {
|
||||
}
|
||||
println('\n BYE -- OK')
|
||||
}
|
||||
|
||||
//********************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user