-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
59 lines (55 loc) · 1.67 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"github.com/lebovski/simple_pathes/graph"
)
func main() {
// CREATE SIMPLE GRAPH AND GET PATHS
var simpleEdges = graph.Edges{
{"a", "b"},
{"b", "f"},
{"b", "d"},
{"a", "c"},
{"c", "d"},
{"c", "j"},
{"d", "e"},
{"e", "f"},
{"j", "f"},
{"e", "c"},
}
simpleEdgesRes := simpleEdges.DFS("a", "f")
fmt.Println("\nGet vertexes from a to f")
fmt.Printf("%v", "====== Simple paths")
for _, v := range simpleEdgesRes {
fmt.Printf("\n%v", v)
}
fmt.Printf("\n%v\n", "======")
// // CREATE GRAPH FROM YAML AND GET PATHS
// states := utils.GetStatesFromYaml("./example.yml")
//
// fmt.Println("\nGet actions from INITIAL to BROKEN")
// edges := graph.MakeEdges(states, 0)
// brokenRes := edges.DFS(
// graph.Vertex{Name: "INITIAL", Type: "state", Loop: false, LoopCount: 0, Index: 0},
// graph.Vertex{Name: "BROKEN", Type: "state", Loop: false, LoopCount: 0, Index: 0},
// )
// fmt.Printf("Broken count: %v\n%v", len(brokenRes), "====== Paths:")
// iniToBroPaths := graph.GetPathsOfNames(brokenRes, "Chunk")
// for _, v := range iniToBroPaths {
// fmt.Printf("\n%v", v)
// }
// fmt.Printf("\n%v\n", "======")
//
// fmt.Println("\nGet actions from INITIAL to FINISHED")
// finishedRes := edges.DFS(
// graph.Vertex{Name: "INITIAL", Type: "state", Loop: false, LoopCount: 0, Index: 0},
// graph.Vertex{Name: "FINISHED", Type: "state", Loop: false, LoopCount: 0, Index: 0},
// )
//
// fmt.Printf("Finished count: %v\n%v", len(finishedRes), "====== Paths:")
// iniToFinPaths := graph.GetPathsOfNames(finishedRes, "Chunk")
// for _, v := range iniToFinPaths {
// fmt.Printf("\n%v", v)
// }
// fmt.Printf("\n%v\n", "======")
}