forked from JGSU-open-source-community/go-home
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer.go
40 lines (33 loc) · 723 Bytes
/
transfer.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
// implement of transfer router table based on Dijkstra
package main
import ()
/*
表头结构
---------------
| 车次码 | 指针 |
---------------
头节点
--------------------
|站码 |相关信息 |指针 |
--------------------
表内节点
--------------------------------------------------
| 站码 | 里程 | 线码| 同站的下一车次 | 同一车次的下一个站 |
--------------------------------------------------
*/
type TableHeader struct {
trainCode string
node *Node
}
type Header struct {
trainCode string
info string
next *Header
}
type Node struct {
stationCode string
mileage float64
lineCode int
nextTrain string
nextStation *Node
}