-
Book Overview & Buying
-
Table Of Contents
Learn Bosque Programming
By :
In this section, we will implement the program in Bosque to calculate the optimal route following the tasks defined in the previous section.
In order to correctly represent our practical case, we will represent our graph through an adjacency matrix stored in a two-dimensional array, as we can see in the next figure:
Figure 14.3 – Adjacency matrix
In this adjacency matrix, we represent the section's weight between two points on the graph. When there is no connection between two points or the same place, it is assigned zero to denote that they are not possible routes.
Now that we have a data matrix, we can implement it in Bosque using Int value lists, as we can see in the following code:
var graph: List<List<Int>> = List<List<Int>>@{
List<Int>@{0, 2, 3, 0, 0, 0, 0, 0, 0, 0},
...