You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-15
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,16 @@ can also see the [specifications](https://algorithms.jc.id.lv/docs/spock-reports
14
14
15
15
## Demo. Graph Shell
16
16
17
-
To demonstrate the work of search algorithms, I made a small console program '[Graph Shell](graph-shell/README.md)'. The program allows you to select [one of three build-in graph samples](#Graph-Samples) and search for a path using two algorithms. The source code of the program is located in `graph-shell` module.
17
+
To demonstrate the work of search algorithms, I made a small console program '[Graph Shell](graph-shell/README.md)'. The program
18
+
allows you to select [one of three build-in graph samples](#Graph-Samples) and search for a path using two algorithms. The source
19
+
code of the program is located in `graph-shell` module.
These algorithms used in the [Hypermetro](https://rabestro.github.io/hypermetro/) project, where they are
24
-
utilized to find the optimal route in the metro schema.
26
+
utilized to find the optimal route in the metro schema.
25
27
26
28
27
29
## How to use the algorithms in your program
@@ -30,7 +32,11 @@ The first step is to create a graph structure. The Graph interface is generic, s
30
32
and any [Number](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Number.html) type for distance.
31
33
32
34
### Example
33
-
In the following Java code we create a graph structure with eight nodes. We use [Character](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Character.html) class for vertex identification and [Integer](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Integer.html) for the distance. You can see the graphic representation of the scheme [here](docs/assets/complex.gif).
35
+
36
+
In the following Java code we create a graph structure with eight nodes. We
37
+
use [Character](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Character.html) class for vertex
38
+
identification and [Integer](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Integer.html) for the
39
+
distance. You can see the graphic representation of the scheme [here](docs/assets/complex.gif).
34
40
35
41
```java
36
42
var graph =Graph.of(Map.of(
@@ -45,7 +51,7 @@ var graph = Graph.of(Map.of(
45
51
));
46
52
```
47
53
48
-
The second step is creating a search algorithm class. You can choose one of the two algorithms.
54
+
The second step is creating a search algorithm class. You can choose one of the two algorithms.
49
55
50
56
### Example
51
57
@@ -66,11 +72,11 @@ var routeOne = shortest.findPath(graph, source, target);
66
72
var routeTwo = fastest.findPath(graph, source, target);
67
73
```
68
74
69
-
As result, you get a list with the path.
75
+
As result, you get a list with the path.
70
76
71
77
```java
72
-
routeOne==['D','C']
73
-
routeTwo ==['D','E','F','G','C']
78
+
routeOne==['D','C']
79
+
routeTwo==['D','E','F','G','C']
74
80
```
75
81
76
82
## Unit Tests
@@ -83,12 +89,15 @@ Tests are written in Groove language. For unit testing, the [Spock Framework](ht
0 commit comments