-
Notifications
You must be signed in to change notification settings - Fork 0
/
eki.ml
609 lines (563 loc) · 37.2 KB
/
eki.ml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
(* 8.5:eki *)
(* data type: ekimei_t
kanji of the terminal, kana of it, romaji of it, and shozoku of it. *)
type ekimei_t = {
kanji: string;
kana: string;
romaji: string;
shozoku: string;
}
(* 8.6:eki *)
(* purpose: to show information of the terminal(eki) *)
(* hyoji: ekimei_t -> str *)
let hyoji eki = match eki with
{kanji = j; kana = n; romaji = r; shozoku = s;} -> s ^ "," ^ j ^ "(" ^ n ^ ")"
(* test *)
let hyoji_test = hyoji {kanji = "茗荷谷"; kana = "みょうがだに";
romaji = "myogadani"; shozoku = "丸ノ内線";}
= "丸ノ内線,茗荷谷(みょうがだに)"
(* 8.7:eki *)
(* type: ekikan_t *)
(* kiten... start point
shuten... terminal point
keiyu... the name of route
kyori... distance of 2 station
jikan... time required travel
*)
type ekikan_t = {
kiten: string;
shuten: string;
keiyu: string;
kyori: float;
jikan: int;
}
let global_ekimei_list = [
{kanji="代々木上原"; kana="よよぎうえはら"; romaji="yoyogiuehara"; shozoku="千代田線"};
{kanji="代々木公園"; kana="よよぎこうえん"; romaji="yoyogikouen"; shozoku="千代田線"};
{kanji="明治神宮前"; kana="めいじじんぐうまえ"; romaji="meijijinguumae"; shozoku="千代田線"};
{kanji="表参道"; kana="おもてさんどう"; romaji="omotesandou"; shozoku="千代田線"};
{kanji="乃木坂"; kana="のぎざか"; romaji="nogizaka"; shozoku="千代田線"};
{kanji="赤坂"; kana="あかさか"; romaji="akasaka"; shozoku="千代田線"};
{kanji="国会議事堂前"; kana="こっかいぎじどうまえ"; romaji="kokkaigijidoumae"; shozoku="千代田線"};
{kanji="霞ヶ関"; kana="かすみがせき"; romaji="kasumigaseki"; shozoku="千代田線"};
{kanji="日比谷"; kana="ひびや"; romaji="hibiya"; shozoku="千代田線"};
{kanji="二重橋前"; kana="にじゅうばしまえ"; romaji="nijuubasimae"; shozoku="千代田線"};
{kanji="大手町"; kana="おおてまち"; romaji="otemachi"; shozoku="千代田線"};
{kanji="新御茶ノ水"; kana="しんおちゃのみず"; romaji="shin-ochanomizu"; shozoku="千代田線"};
{kanji="湯島"; kana="ゆしま"; romaji="yushima"; shozoku="千代田線"};
{kanji="根津"; kana="ねづ"; romaji="nedu"; shozoku="千代田線"};
{kanji="千駄木"; kana="せんだぎ"; romaji="sendagi"; shozoku="千代田線"};
{kanji="西日暮里"; kana="にしにっぽり"; romaji="nishinippori"; shozoku="千代田線"};
{kanji="町屋"; kana="まちや"; romaji="machiya"; shozoku="千代田線"};
{kanji="北千住"; kana="きたせんじゅ"; romaji="kitasenjyu"; shozoku="千代田線"};
{kanji="綾瀬"; kana="あやせ"; romaji="ayase"; shozoku="千代田線"};
{kanji="北綾瀬"; kana="きたあやせ"; romaji="kitaayase"; shozoku="千代田線"};
{kanji="浅草"; kana="あさくさ"; romaji="asakusa"; shozoku="銀座線"};
{kanji="田原町"; kana="たわらまち"; romaji="tawaramachi"; shozoku="銀座線"};
{kanji="稲荷町"; kana="いなりちょう"; romaji="inaricho"; shozoku="銀座線"};
{kanji="上野"; kana="うえの"; romaji="ueno"; shozoku="銀座線"};
{kanji="上野広小路"; kana="うえのひろこうじ"; romaji="uenohirokoji"; shozoku="銀座線"};
{kanji="末広町"; kana="すえひろちょう"; romaji="suehirocho"; shozoku="銀座線"};
{kanji="神田"; kana="かんだ"; romaji="kanda"; shozoku="銀座線"};
{kanji="三越前"; kana="みつこしまえ"; romaji="mitsukoshimae"; shozoku="銀座線"};
{kanji="日本橋"; kana="にほんばし"; romaji="nihonbashi"; shozoku="銀座線"};
{kanji="京橋"; kana="きょうばし"; romaji="kyobashi"; shozoku="銀座線"};
{kanji="銀座"; kana="ぎんざ"; romaji="ginza"; shozoku="銀座線"};
{kanji="新橋"; kana="しんばし"; romaji="shinbashi"; shozoku="銀座線"};
{kanji="虎ノ門"; kana="とらのもん"; romaji="toranomon"; shozoku="銀座線"};
{kanji="溜池山王"; kana="ためいけさんのう"; romaji="tameikesannou"; shozoku="銀座線"};
{kanji="赤坂見附"; kana="あかさかみつけ"; romaji="akasakamitsuke"; shozoku="銀座線"};
{kanji="青山一丁目"; kana="あおやまいっちょうめ"; romaji="aoyamaicchome"; shozoku="銀座線"};
{kanji="外苑前"; kana="がいえんまえ"; romaji="gaienmae"; shozoku="銀座線"};
{kanji="表参道"; kana="おもてさんどう"; romaji="omotesando"; shozoku="銀座線"};
{kanji="渋谷"; kana="しぶや"; romaji="shibuya"; shozoku="銀座線"};
{kanji="渋谷"; kana="しぶや"; romaji="shibuya"; shozoku="半蔵門線"};
{kanji="表参道"; kana="おもてさんどう"; romaji="omotesandou"; shozoku="半蔵門線"};
{kanji="青山一丁目"; kana="あおやまいっちょうめ"; romaji="aoyama-itchome"; shozoku="半蔵門線"};
{kanji="永田町"; kana="ながたちょう"; romaji="nagatacho"; shozoku="半蔵門線"};
{kanji="半蔵門"; kana="はんぞうもん"; romaji="hanzomon"; shozoku="半蔵門線"};
{kanji="九段下"; kana="くだんした"; romaji="kudanshita"; shozoku="半蔵門線"};
{kanji="神保町"; kana="じんぼうちょう"; romaji="jinbocho"; shozoku="半蔵門線"};
{kanji="大手町"; kana="おおてまち"; romaji="otemachi"; shozoku="半蔵門線"};
{kanji="三越前"; kana="みつこしまえ"; romaji="mitsukoshimae"; shozoku="半蔵門線"};
{kanji="水天宮前"; kana="すいてんぐうまえ"; romaji="suitengumae"; shozoku="半蔵門線"};
{kanji="清澄白河"; kana="きよすみしらかわ"; romaji="kiyosumi-shirakawa"; shozoku="半蔵門線"};
{kanji="住吉"; kana="すみよし"; romaji="sumiyoshi"; shozoku="半蔵門線"};
{kanji="錦糸町"; kana="きんしちょう"; romaji="kinshicho"; shozoku="半蔵門線"};
{kanji="押上"; kana="おしあげ"; romaji="oshiage"; shozoku="半蔵門線"};
{kanji="中目黒"; kana="なかめぐろ"; romaji="nakameguro"; shozoku="日比谷線"};
{kanji="恵比寿"; kana="えびす"; romaji="ebisu"; shozoku="日比谷線"};
{kanji="広尾"; kana="ひろお"; romaji="hiro"; shozoku="日比谷線"};
{kanji="六本木"; kana="ろっぽんぎ"; romaji="roppongi"; shozoku="日比谷線"};
{kanji="神谷町"; kana="かみやちょう"; romaji="kamiyacho"; shozoku="日比谷線"};
{kanji="霞ヶ関"; kana="かすみがせき"; romaji="kasumigaseki"; shozoku="日比谷線"};
{kanji="日比谷"; kana="ひびや"; romaji="hibiya"; shozoku="日比谷線"};
{kanji="銀座"; kana="ぎんざ"; romaji="ginza"; shozoku="日比谷線"};
{kanji="東銀座"; kana="ひがしぎんざ"; romaji="higashiginza"; shozoku="日比谷線"};
{kanji="築地"; kana="つきじ"; romaji="tsukiji"; shozoku="日比谷線"};
{kanji="八丁堀"; kana="はっちょうぼり"; romaji="hacchobori"; shozoku="日比谷線"};
{kanji="茅場町"; kana="かやばちょう"; romaji="kayabacho"; shozoku="日比谷線"};
{kanji="人形町"; kana="にんぎょうちょう"; romaji="ningyomachi"; shozoku="日比谷線"};
{kanji="小伝馬町"; kana="こでんまちょう"; romaji="kodemmacho"; shozoku="日比谷線"};
{kanji="秋葉原"; kana="あきはばら"; romaji="akihabara"; shozoku="日比谷線"};
{kanji="仲御徒町"; kana="なかおかちまち"; romaji="nakaokachimachi"; shozoku="日比谷線"};
{kanji="上野"; kana="うえの"; romaji="ueno"; shozoku="日比谷線"};
{kanji="入谷"; kana="いりや"; romaji="iriya"; shozoku="日比谷線"};
{kanji="三ノ輪"; kana="みのわ"; romaji="minowa"; shozoku="日比谷線"};
{kanji="南千住"; kana="みなみせんじゅ"; romaji="minamisenju"; shozoku="日比谷線"};
{kanji="北千住"; kana="きたせんじゅ"; romaji="kitasenju"; shozoku="日比谷線"};
{kanji="池袋"; kana="いけぶくろ"; romaji="ikebukuro"; shozoku="丸ノ内線"};
{kanji="新大塚"; kana="しんおおつか"; romaji="shinotsuka"; shozoku="丸ノ内線"};
{kanji="茗荷谷"; kana="みょうがだに"; romaji="myogadani"; shozoku="丸ノ内線"};
{kanji="後楽園"; kana="こうらくえん"; romaji="korakuen"; shozoku="丸ノ内線"};
{kanji="本郷三丁目"; kana="ほんごうさんちょうめ"; romaji="hongosanchome"; shozoku="丸ノ内線"};
{kanji="御茶ノ水"; kana="おちゃのみず"; romaji="ochanomizu"; shozoku="丸ノ内線"};
{kanji="淡路町"; kana="あわじちょう"; romaji="awajicho"; shozoku="丸ノ内線"};
{kanji="大手町"; kana="おおてまち"; romaji="otemachi"; shozoku="丸ノ内線"};
{kanji="東京"; kana="とうきょう"; romaji="tokyo"; shozoku="丸ノ内線"};
{kanji="銀座"; kana="ぎんざ"; romaji="ginza"; shozoku="丸ノ内線"};
{kanji="霞ヶ関"; kana="かすみがせき"; romaji="kasumigaseki"; shozoku="丸ノ内線"};
{kanji="国会議事堂前"; kana="こっかいぎじどうまえ"; romaji="kokkaigijidomae"; shozoku="丸ノ内線"};
{kanji="赤坂見附"; kana="あかさかみつけ"; romaji="akasakamitsuke"; shozoku="丸ノ内線"};
{kanji="四ツ谷"; kana="よつや"; romaji="yotsuya"; shozoku="丸ノ内線"};
{kanji="四谷三丁目"; kana="よつやさんちょうめ"; romaji="yotsuyasanchome"; shozoku="丸ノ内線"};
{kanji="新宿御苑前"; kana="しんじゅくぎょえんまえ"; romaji="shinjuku-gyoemmae"; shozoku="丸ノ内線"};
{kanji="新宿三丁目"; kana="しんじゅくさんちょうめ"; romaji="shinjuku-sanchome"; shozoku="丸ノ内線"};
{kanji="新宿"; kana="しんじゅく"; romaji="shinjuku"; shozoku="丸ノ内線"};
{kanji="西新宿"; kana="にししんじゅく"; romaji="nishi-shinjuku"; shozoku="丸ノ内線"};
{kanji="中野坂上"; kana="なかのさかうえ"; romaji="nakano-sakaue"; shozoku="丸ノ内線"};
{kanji="新中野"; kana="しんなかの"; romaji="shin-nakano"; shozoku="丸ノ内線"};
{kanji="東高円寺"; kana="ひがしこうえんじ"; romaji="higashi-koenji"; shozoku="丸ノ内線"};
{kanji="新高円寺"; kana="しんこうえんじ"; romaji="shin-koenji"; shozoku="丸ノ内線"};
{kanji="南阿佐ヶ谷"; kana="みなみあさがや"; romaji="minami-asagaya"; shozoku="丸ノ内線"};
{kanji="荻窪"; kana="おぎくぼ"; romaji="ogikubo"; shozoku="丸ノ内線"};
{kanji="中野新橋"; kana="なかのしんばし"; romaji="nakano-shimbashi"; shozoku="丸ノ内線"};
{kanji="中野富士見町"; kana="なかのふじみちょう"; romaji="nakano-fujimicho"; shozoku="丸ノ内線"};
{kanji="方南町"; kana="ほうなんちょう"; romaji="honancho"; shozoku="丸ノ内線"};
{kanji="四ツ谷"; kana="よつや"; romaji="yotsuya"; shozoku="南北線"};
{kanji="永田町"; kana="ながたちょう"; romaji="nagatacho"; shozoku="南北線"};
{kanji="溜池山王"; kana="ためいけさんのう"; romaji="tameikesanno"; shozoku="南北線"};
{kanji="六本木一丁目"; kana="ろっぽんぎいっちょうめ"; romaji="roppongiitchome"; shozoku="南北線"};
{kanji="麻布十番"; kana="あざぶじゅうばん"; romaji="azabujuban"; shozoku="南北線"};
{kanji="白金高輪"; kana="しろかねたかなわ"; romaji="shirokanetakanawa"; shozoku="南北線"};
{kanji="白金台"; kana="しろかねだい"; romaji="shirokanedai"; shozoku="南北線"};
{kanji="目黒"; kana="めぐろ"; romaji="meguro"; shozoku="南北線"};
{kanji="市ヶ谷"; kana="いちがや"; romaji="ichigaya"; shozoku="南北線"};
{kanji="飯田橋"; kana="いいだばし"; romaji="idabashi"; shozoku="南北線"};
{kanji="後楽園"; kana="こうらくえん"; romaji="korakuen"; shozoku="南北線"};
{kanji="東大前"; kana="とうだいまえ"; romaji="todaimae"; shozoku="南北線"};
{kanji="本駒込"; kana="ほんこまごめ"; romaji="honkomagome"; shozoku="南北線"};
{kanji="駒込"; kana="こまごめ"; romaji="komagome"; shozoku="南北線"};
{kanji="西ヶ原"; kana="にしがはら"; romaji="nishigahara"; shozoku="南北線"};
{kanji="王子"; kana="おうじ"; romaji="oji"; shozoku="南北線"};
{kanji="王子神谷"; kana="おうじかみや"; romaji="ojikamiya"; shozoku="南北線"};
{kanji="志茂"; kana="しも"; romaji="shimo"; shozoku="南北線"};
{kanji="赤羽岩淵"; kana="あかばねいわぶち"; romaji="akabaneiwabuchi"; shozoku="南北線"};
{kanji="西船橋"; kana="にしふなばし"; romaji="nishi-funabashi"; shozoku="東西線"};
{kanji="原木中山"; kana="ばらきなかやま"; romaji="baraki-nakayama"; shozoku="東西線"};
{kanji="妙典"; kana="みょうでん"; romaji="myoden"; shozoku="東西線"};
{kanji="行徳"; kana="ぎょうとく"; romaji="gyotoku"; shozoku="東西線"};
{kanji="南行徳"; kana="みなみぎょうとく"; romaji="minami-gyotoku"; shozoku="東西線"};
{kanji="浦安"; kana="うらやす"; romaji="urayasu"; shozoku="東西線"};
{kanji="葛西"; kana="かさい"; romaji="kasai"; shozoku="東西線"};
{kanji="西葛西"; kana="にしかさい"; romaji="nishi-kasai"; shozoku="東西線"};
{kanji="南砂町"; kana="みなみすなまち"; romaji="minami-sunamachi"; shozoku="東西線"};
{kanji="東陽町"; kana="とうようちょう"; romaji="touyoucho"; shozoku="東西線"};
{kanji="木場"; kana="きば"; romaji="kiba"; shozoku="東西線"};
{kanji="門前仲町"; kana="もんぜんなかちょう"; romaji="monzen-nakacho"; shozoku="東西線"};
{kanji="茅場町"; kana="かやばちょう"; romaji="kayabacho"; shozoku="東西線"};
{kanji="日本橋"; kana="にほんばし"; romaji="nihonbashi"; shozoku="東西線"};
{kanji="大手町"; kana="おおてまち"; romaji="otemachi"; shozoku="東西線"};
{kanji="竹橋"; kana="たけばし"; romaji="takebashi"; shozoku="東西線"};
{kanji="九段下"; kana="くだんした"; romaji="kudanshita"; shozoku="東西線"};
{kanji="飯田橋"; kana="いいだばし"; romaji="iidabashi"; shozoku="東西線"};
{kanji="神楽坂"; kana="かぐらざか"; romaji="kagurazaka"; shozoku="東西線"};
{kanji="早稲田"; kana="わせだ"; romaji="waseda"; shozoku="東西線"};
{kanji="高田馬場"; kana="たかだのばば"; romaji="takadanobaba"; shozoku="東西線"};
{kanji="落合"; kana="おちあい"; romaji="ochiai"; shozoku="東西線"};
{kanji="中野"; kana="なかの"; romaji="nakano"; shozoku="東西線"};
{romaji="shinkiba"; kana="しんきば"; kanji="新木場"; shozoku="有楽町線"};
{romaji="tatsumi"; kana="たつみ"; kanji="辰巳"; shozoku="有楽町線"};
{romaji="toyosu"; kana="とよす"; kanji="豊洲"; shozoku="有楽町線"};
{romaji="tsukishima"; kana="つきしま"; kanji="月島"; shozoku="有楽町線"};
{romaji="shintomityou"; kana="しんとみちょう"; kanji="新富町"; shozoku="有楽町線"};
{romaji="ginzaittyoume"; kana="ぎんざいっちょうめ"; kanji="銀座一丁目"; shozoku="有楽町線"};
{romaji="yuurakutyou"; kana="ゆうらくちょう"; kanji="有楽町"; shozoku="有楽町線"};
{romaji="sakuradamon"; kana="さくらだもん"; kanji="桜田門"; shozoku="有楽町線"};
{romaji="nagatacho"; kana="ながたちょう"; kanji="永田町"; shozoku="有楽町線"};
{romaji="koujimachi"; kana="こうじまち"; kanji="麹町"; shozoku="有楽町線"};
{romaji="ichigaya"; kana="いちがや"; kanji="市ヶ谷"; shozoku="有楽町線"};
{romaji="iidabashi"; kana="いいだばし"; kanji="飯田橋"; shozoku="有楽町線"};
{kanji="江戸川橋"; kana="えどがわばし"; romaji="edogawabasi"; shozoku="有楽町線"};
{kanji="護国寺"; kana="ごこくじ"; romaji="gokokuji"; shozoku="有楽町線"};
{kanji="東池袋"; kana="ひがしいけぶくろ"; romaji="higasiikebukuro"; shozoku="有楽町線"};
{kanji="池袋"; kana="いけぶくろ"; romaji="ikebukuro"; shozoku="有楽町線"};
{kanji="要町"; kana="かなめちょう"; romaji="kanametyou"; shozoku="有楽町線"};
{kanji="千川"; kana="せんかわ"; romaji="senkawa"; shozoku="有楽町線"};
{kanji="小竹向原"; kana="こたけむかいはら"; romaji="kotakemukaihara"; shozoku="有楽町線"};
{kanji="氷川台"; kana="ひかわだい"; romaji="hikawadai"; shozoku="有楽町線"};
{kanji="平和台"; kana="へいわだい"; romaji="heiwadai"; shozoku="有楽町線"};
{kanji="営団赤塚"; kana="えいだんあかつか"; romaji="eidanakakuka"; shozoku="有楽町線"};
{kanji="営団成増"; kana="えいだんなります"; romaji="eidannarimasu"; shozoku="有楽町線"};
{kanji="和光市"; kana="わこうし"; romaji="wakousi"; shozoku="有楽町線"};
]
let global_ekikan_list = [
{kiten="代々木上原"; shuten="代々木公園"; keiyu="千代田線"; kyori=1.0; jikan=2};
{kiten="代々木公園"; shuten="明治神宮前"; keiyu="千代田線"; kyori=1.2; jikan=2};
{kiten="明治神宮前"; shuten="表参道"; keiyu="千代田線"; kyori=0.9; jikan=2};
{kiten="表参道"; shuten="乃木坂"; keiyu="千代田線"; kyori=1.4; jikan=3};
{kiten="乃木坂"; shuten="赤坂"; keiyu="千代田線"; kyori=1.1; jikan=2};
{kiten="赤坂"; shuten="国会議事堂前"; keiyu="千代田線"; kyori=0.8; jikan=1};
{kiten="国会議事堂前"; shuten="霞ヶ関"; keiyu="千代田線"; kyori=0.7; jikan=1};
{kiten="霞ヶ関"; shuten="日比谷"; keiyu="千代田線"; kyori=1.2; jikan=2};
{kiten="日比谷"; shuten="二重橋前"; keiyu="千代田線"; kyori=0.7; jikan=1};
{kiten="二重橋前"; shuten="大手町"; keiyu="千代田線"; kyori=0.7; jikan=1};
{kiten="大手町"; shuten="新御茶ノ水"; keiyu="千代田線"; kyori=1.3; jikan=2};
{kiten="新御茶ノ水"; shuten="湯島"; keiyu="千代田線"; kyori=1.2; jikan=2};
{kiten="湯島"; shuten="根津"; keiyu="千代田線"; kyori=1.2; jikan=2};
{kiten="根津"; shuten="千駄木"; keiyu="千代田線"; kyori=1.0; jikan=2};
{kiten="千駄木"; shuten="西日暮里"; keiyu="千代田線"; kyori=0.9; jikan=1};
{kiten="西日暮里"; shuten="町屋"; keiyu="千代田線"; kyori=1.7; jikan=2};
{kiten="町屋"; shuten="北千住"; keiyu="千代田線"; kyori=2.6; jikan=3};
{kiten="北千住"; shuten="綾瀬"; keiyu="千代田線"; kyori=2.5; jikan=3};
{kiten="綾瀬"; shuten="北綾瀬"; keiyu="千代田線"; kyori=2.1; jikan=4};
{kiten="浅草"; shuten="田原町"; keiyu="銀座線"; kyori=0.8; jikan=2};
{kiten="田原町"; shuten="稲荷町"; keiyu="銀座線"; kyori=0.7; jikan=1};
{kiten="稲荷町"; shuten="上野"; keiyu="銀座線"; kyori=0.7; jikan=2};
{kiten="上野"; shuten="上野広小路"; keiyu="銀座線"; kyori=0.5; jikan=2};
{kiten="上野広小路"; shuten="末広町"; keiyu="銀座線"; kyori=0.6; jikan=1};
{kiten="末広町"; shuten="神田"; keiyu="銀座線"; kyori=1.1; jikan=2};
{kiten="神田"; shuten="三越前"; keiyu="銀座線"; kyori=0.7; jikan=1};
{kiten="三越前"; shuten="日本橋"; keiyu="銀座線"; kyori=0.6; jikan=2};
{kiten="日本橋"; shuten="京橋"; keiyu="銀座線"; kyori=0.7; jikan=2};
{kiten="京橋"; shuten="銀座"; keiyu="銀座線"; kyori=0.7; jikan=1};
{kiten="銀座"; shuten="新橋"; keiyu="銀座線"; kyori=0.9; jikan=2};
{kiten="新橋"; shuten="虎ノ門"; keiyu="銀座線"; kyori=0.8; jikan=2};
{kiten="虎ノ門"; shuten="溜池山王"; keiyu="銀座線"; kyori=0.6; jikan=2};
{kiten="溜池山王"; shuten="赤坂見附"; keiyu="銀座線"; kyori=0.9; jikan=2};
{kiten="赤坂見附"; shuten="青山一丁目"; keiyu="銀座線"; kyori=1.3; jikan=2};
{kiten="青山一丁目"; shuten="外苑前"; keiyu="銀座線"; kyori=0.7; jikan=2};
{kiten="外苑前"; shuten="表参道"; keiyu="銀座線"; kyori=0.7; jikan=1};
{kiten="表参道"; shuten="渋谷"; keiyu="銀座線"; kyori=1.3; jikan=1};
{kiten="渋谷"; shuten="表参道"; keiyu="半蔵門線"; kyori=1.3; jikan=2};
{kiten="表参道"; shuten="青山一丁目"; keiyu="半蔵門線"; kyori=1.4; jikan=2};
{kiten="青山一丁目"; shuten="永田町"; keiyu="半蔵門線"; kyori=1.3; jikan=2};
{kiten="永田町"; shuten="半蔵門"; keiyu="半蔵門線"; kyori=1.0; jikan=2};
{kiten="半蔵門"; shuten="九段下"; keiyu="半蔵門線"; kyori=1.6; jikan=2};
{kiten="九段下"; shuten="神保町"; keiyu="半蔵門線"; kyori=0.4; jikan=1};
{kiten="神保町"; shuten="大手町"; keiyu="半蔵門線"; kyori=1.7; jikan=3};
{kiten="大手町"; shuten="三越前"; keiyu="半蔵門線"; kyori=0.7; jikan=1};
{kiten="三越前"; shuten="水天宮前"; keiyu="半蔵門線"; kyori=1.3; jikan=2};
{kiten="水天宮前"; shuten="清澄白河"; keiyu="半蔵門線"; kyori=1.7; jikan=3};
{kiten="清澄白河"; shuten="住吉"; keiyu="半蔵門線"; kyori=1.9; jikan=3};
{kiten="住吉"; shuten="錦糸町"; keiyu="半蔵門線"; kyori=1.; jikan=2};
{kiten="錦糸町"; shuten="押上"; keiyu="半蔵門線"; kyori=1.4; jikan=2};
{kiten="中目黒"; shuten="恵比寿"; keiyu="日比谷線"; kyori=1.; jikan=2};
{kiten="恵比寿"; shuten="広尾"; keiyu="日比谷線"; kyori=1.5; jikan=3};
{kiten="広尾"; shuten="六本木"; keiyu="日比谷線"; kyori=1.7; jikan=3};
{kiten="六本木"; shuten="神谷町"; keiyu="日比谷線"; kyori=1.5; jikan=3};
{kiten="神谷町"; shuten="霞ヶ関"; keiyu="日比谷線"; kyori=1.3; jikan=2};
{kiten="霞ヶ関"; shuten="日比谷"; keiyu="日比谷線"; kyori=1.2; jikan=2};
{kiten="日比谷"; shuten="銀座"; keiyu="日比谷線"; kyori=0.4; jikan=1};
{kiten="銀座"; shuten="東銀座"; keiyu="日比谷線"; kyori=0.4; jikan=1};
{kiten="東銀座"; shuten="築地"; keiyu="日比谷線"; kyori=0.6; jikan=2};
{kiten="築地"; shuten="八丁堀"; keiyu="日比谷線"; kyori=1.; jikan=2};
{kiten="八丁堀"; shuten="茅場町"; keiyu="日比谷線"; kyori=0.5; jikan=1};
{kiten="茅場町"; shuten="人形町"; keiyu="日比谷線"; kyori=0.9; jikan=2};
{kiten="人形町"; shuten="小伝馬町"; keiyu="日比谷線"; kyori=0.6; jikan=1};
{kiten="小伝馬町"; shuten="秋葉原"; keiyu="日比谷線"; kyori=0.9; jikan=2};
{kiten="秋葉原"; shuten="仲御徒町"; keiyu="日比谷線"; kyori=1.; jikan=1};
{kiten="仲御徒町"; shuten="上野"; keiyu="日比谷線"; kyori=0.5; jikan=1};
{kiten="上野"; shuten="入谷"; keiyu="日比谷線"; kyori=1.2; jikan=2};
{kiten="入谷"; shuten="三ノ輪"; keiyu="日比谷線"; kyori=1.2; jikan=2};
{kiten="三ノ輪"; shuten="南千住"; keiyu="日比谷線"; kyori=0.8; jikan=2};
{kiten="南千住"; shuten="北千住"; keiyu="日比谷線"; kyori=1.8; jikan=3};
{kiten="池袋"; shuten="新大塚"; keiyu="丸ノ内線"; kyori=1.8; jikan=3};
{kiten="新大塚"; shuten="茗荷谷"; keiyu="丸ノ内線"; kyori=1.2; jikan=2};
{kiten="茗荷谷"; shuten="後楽園"; keiyu="丸ノ内線"; kyori=1.8; jikan=2};
{kiten="後楽園"; shuten="本郷三丁目"; keiyu="丸ノ内線"; kyori=0.8; jikan=1};
{kiten="本郷三丁目"; shuten="御茶ノ水"; keiyu="丸ノ内線"; kyori=0.8; jikan=1};
{kiten="御茶ノ水"; shuten="淡路町"; keiyu="丸ノ内線"; kyori=0.8; jikan=1};
{kiten="淡路町"; shuten="大手町"; keiyu="丸ノ内線"; kyori=0.9; jikan=2};
{kiten="大手町"; shuten="東京"; keiyu="丸ノ内線"; kyori=0.6; jikan=1};
{kiten="東京"; shuten="銀座"; keiyu="丸ノ内線"; kyori=1.1; jikan=2};
{kiten="銀座"; shuten="霞ヶ関"; keiyu="丸ノ内線"; kyori=1.0; jikan=2};
{kiten="霞ヶ関"; shuten="国会議事堂前"; keiyu="丸ノ内線"; kyori=0.7; jikan=1};
{kiten="国会議事堂前"; shuten="赤坂見附"; keiyu="丸ノ内線"; kyori=0.9; jikan=2};
{kiten="赤坂見附"; shuten="四ツ谷"; keiyu="丸ノ内線"; kyori=1.3; jikan=2};
{kiten="四ツ谷"; shuten="四谷三丁目"; keiyu="丸ノ内線"; kyori=1.0; jikan=2};
{kiten="四谷三丁目"; shuten="新宿御苑前"; keiyu="丸ノ内線"; kyori=0.9; jikan=1};
{kiten="新宿御苑前"; shuten="新宿三丁目"; keiyu="丸ノ内線"; kyori=0.7; jikan=1};
{kiten="新宿三丁目"; shuten="新宿"; keiyu="丸ノ内線"; kyori=0.3; jikan=1};
{kiten="新宿"; shuten="西新宿"; keiyu="丸ノ内線"; kyori=0.8; jikan=1};
{kiten="西新宿"; shuten="中野坂上"; keiyu="丸ノ内線"; kyori=1.1; jikan=2};
{kiten="中野坂上"; shuten="新中野"; keiyu="丸ノ内線"; kyori=1.1; jikan=2};
{kiten="新中野"; shuten="東高円寺"; keiyu="丸ノ内線"; kyori=1.0; jikan=1};
{kiten="東高円寺"; shuten="新高円寺"; keiyu="丸ノ内線"; kyori=0.9; jikan=1};
{kiten="新高円寺"; shuten="南阿佐ヶ谷"; keiyu="丸ノ内線"; kyori=1.2; jikan=2};
{kiten="南阿佐ヶ谷"; shuten="荻窪"; keiyu="丸ノ内線"; kyori=1.5; jikan=2};
{kiten="中野坂上"; shuten="中野新橋"; keiyu="丸ノ内線"; kyori=1.3; jikan=2};
{kiten="中野新橋"; shuten="中野富士見町"; keiyu="丸ノ内線"; kyori=0.6; jikan=1};
{kiten="中野富士見町"; shuten="方南町"; keiyu="丸ノ内線"; kyori=1.3; jikan=2};
{kiten="市ヶ谷"; shuten="四ツ谷"; keiyu="南北線"; kyori=1.0; jikan=2};
{kiten="四ツ谷"; shuten="永田町"; keiyu="南北線"; kyori=1.3; jikan=3};
{kiten="永田町"; shuten="溜池山王"; keiyu="南北線"; kyori=0.9; jikan=1};
{kiten="溜池山王"; shuten="六本木一丁目"; keiyu="南北線"; kyori=0.9; jikan=2};
{kiten="六本木一丁目"; shuten="麻布十番"; keiyu="南北線"; kyori=1.2; jikan=2};
{kiten="麻布十番"; shuten="白金高輪"; keiyu="南北線"; kyori=1.3; jikan=2};
{kiten="白金高輪"; shuten="白金台"; keiyu="南北線"; kyori=1.0; jikan=2};
{kiten="白金台"; shuten="目黒"; keiyu="南北線"; kyori=1.3; jikan=2};
{kiten="市ヶ谷"; shuten="飯田橋"; keiyu="南北線"; kyori=1.1 ; jikan=2};
{kiten="飯田橋"; shuten="後楽園"; keiyu="南北線"; kyori=1.4 ; jikan=2};
{kiten="後楽園"; shuten="東大前"; keiyu="南北線"; kyori=1.3 ; jikan=3};
{kiten="東大前"; shuten="本駒込"; keiyu="南北線"; kyori=0.9 ; jikan=2};
{kiten="本駒込"; shuten="駒込"; keiyu="南北線"; kyori=1.4; jikan=2};
{kiten="駒込"; shuten="西ヶ原"; keiyu="南北線"; kyori=1.4; jikan=2};
{kiten="西ヶ原"; shuten="王子"; keiyu="南北線"; kyori=1.0; jikan=2};
{kiten="王子"; shuten="王子神谷"; keiyu="南北線"; kyori=1.2; jikan=2};
{kiten="王子神谷"; shuten="志茂"; keiyu="南北線"; kyori=1.6; jikan=3};
{kiten="志茂"; shuten="赤羽岩淵"; keiyu="南北線"; kyori=1.1; jikan=2};
{kiten="西船橋" ; shuten="原木中山"; keiyu="東西線"; kyori=1.9; jikan=3};
{kiten="原木中山"; shuten="妙典"; keiyu="東西線"; kyori=2.1 ; jikan=2};
{kiten="妙典"; shuten="行徳"; keiyu="東西線"; kyori=1.3 ; jikan=2};
{kiten="行徳"; shuten="南行徳"; keiyu="東西線"; kyori=1.5 ; jikan=2};
{kiten="南行徳"; shuten="浦安" ; keiyu="東西線"; kyori=1.2 ; jikan=2};
{kiten="浦安" ; shuten="葛西"; keiyu="東西線"; kyori=1.9 ; jikan=2};
{kiten="葛西"; shuten="西葛西"; keiyu="東西線"; kyori=1.2 ; jikan=2};
{kiten="西葛西"; shuten="南砂町"; keiyu="東西線"; kyori=2.7 ; jikan=2};
{kiten="南砂町"; shuten="東陽町"; keiyu="東西線"; kyori=1.2 ; jikan=2};
{kiten="東陽町"; shuten="木場" ; keiyu="東西線"; kyori=0.9 ; jikan=1};
{kiten="木場"; shuten="門前仲町"; keiyu="東西線"; kyori=1.1 ; jikan=1};
{kiten="門前仲町"; shuten="茅場町"; keiyu="東西線"; kyori=1.8 ; jikan=2};
{kiten="茅場町"; shuten="日本橋"; keiyu="東西線"; kyori=0.5 ; jikan=1};
{kiten="日本橋"; shuten="大手町"; keiyu="東西線"; kyori=0.8 ; jikan=1};
{kiten="大手町"; shuten="竹橋"; keiyu="東西線"; kyori=1.0; jikan=2};
{kiten="竹橋"; shuten="九段下"; keiyu="東西線"; kyori=1.0; jikan=1};
{kiten="九段下"; shuten="飯田橋"; keiyu="東西線"; kyori=0.7; jikan=1};
{kiten="飯田橋"; shuten="神楽坂"; keiyu="東西線"; kyori=1.2; jikan=2};
{kiten="神楽坂"; shuten="早稲田"; keiyu="東西線"; kyori=1.2; jikan=2};
{kiten="早稲田"; shuten="高田馬場"; keiyu="東西線"; kyori=1.7; jikan=3};
{kiten="高田馬場"; shuten="落合"; keiyu="東西線"; kyori=1.9; jikan=3};
{kiten="落合"; shuten="中野"; keiyu="東西線"; kyori=2.0; jikan=3};
{kiten="新木場"; shuten="辰巳"; keiyu="有楽町線"; kyori=1.5; jikan=2};
{kiten="辰巳"; shuten="豊洲"; keiyu="有楽町線"; kyori=1.7; jikan=2};
{kiten="豊洲"; shuten="月島"; keiyu="有楽町線"; kyori=1.4; jikan=2};
{kiten="月島"; shuten="新富町"; keiyu="有楽町線"; kyori=1.3; jikan=2};
{kiten="新富町"; shuten="銀座一丁目"; keiyu="有楽町線"; kyori=0.7; jikan=1};
{kiten="銀座一丁目"; shuten="有楽町"; keiyu="有楽町線"; kyori=0.5; jikan=1};
{kiten="有楽町"; shuten="桜田門"; keiyu="有楽町線"; kyori=1.0; jikan=1};
{kiten="桜田門"; shuten="永田町"; keiyu="有楽町線"; kyori=0.9; jikan=2};
{kiten="永田町"; shuten="麹町"; keiyu="有楽町線"; kyori=0.9; jikan=1};
{kiten="麹町"; shuten="市ヶ谷"; keiyu="有楽町線"; kyori=0.9; jikan=1};
{kiten="市ヶ谷"; shuten="飯田橋"; keiyu="有楽町線"; kyori=1.1; jikan=2};
{kiten="飯田橋"; shuten="江戸川橋"; keiyu="有楽町線"; kyori=1.6; jikan=3};
{kiten="江戸川橋"; shuten="護国寺"; keiyu="有楽町線"; kyori=1.3; jikan=2};
{kiten="護国寺"; shuten="東池袋"; keiyu="有楽町線"; kyori=1.1; jikan=2};
{kiten="東池袋"; shuten="池袋"; keiyu="有楽町線"; kyori=2.0; jikan=2};
{kiten="池袋"; shuten="要町"; keiyu="有楽町線"; kyori=1.2; jikan=2};
{kiten="要町"; shuten="千川"; keiyu="有楽町線"; kyori=1.0; jikan=1};
{kiten="千川"; shuten="小竹向原"; keiyu="有楽町線"; kyori=1.0; jikan=2};
{kiten="小竹向原"; shuten="氷川台"; keiyu="有楽町線"; kyori=1.5; jikan=2};
{kiten="氷川台"; shuten="平和台"; keiyu="有楽町線"; kyori=1.4; jikan=2};
{kiten="平和台"; shuten="営団赤塚"; keiyu="有楽町線"; kyori=1.8; jikan=2};
{kiten="営団赤塚"; shuten="営団成増"; keiyu="有楽町線"; kyori=1.5; jikan=2};
{kiten="営団成増"; shuten="和光市"; keiyu="有楽町線"; kyori=2.1; jikan=3};
]
(* 10.10 romaji_to_kanji *)
(* use ekimei_t type and list *)
(* data type: ekimei_t
kanji of the terminal, kana of it, romaji of it, and shozoku of it. *)
(* ekimei_t list is
* - [] empty list.
* - hd::tl hd is ekimei_t element.
* tl is elimei_t list.
* tl is self-refarence of
* ekimei_t list. *)
(* purpose: to convert kanji from romaji *)
(* romaji_to_kanji: str -> ekimei_t list -> str *)
let rec romaji_to_kanji ekimei lst = match lst with
[] -> ""
| {kanji = j; kana = n; romaji = r; shozoku = s;} :: tl ->
if r = ekimei then j
else romaji_to_kanji ekimei tl
(* test *)
let rtk_tets1 = romaji_to_kanji "myogadani" global_ekimei_list = "茗荷谷"
(* 10.11 get_ekikan_kyori *)
(* use ekikan_t type, and list *)
(* ekikan_t has
* kiten... start point (str)
shuten... terminal point (str)
keiyu... the name of route (str)
kyori... distance of 2 station (float)
jikan... time required travel (int) *)
(* purpose: return the distance between two stations. *)
(* get_ekikan_kyori: str -> str -> ekikan_t list -> float *)
let rec get_ekikan_kyori station1 station2 st_list = match st_list with
[] -> infinity
| {kiten = kiten; shuten = shuten; keiyu = keiyu; kyori = kyori; jikan = jikan;} :: tl ->
if (kiten = station1 && shuten = station2) ||
(kiten = station2 && shuten = station1) then kyori
else get_ekikan_kyori station1 station2 tl
(* test *)
let gek = get_ekikan_kyori "茗荷谷" "新大塚" global_ekikan_list = 1.2
let gek2 = get_ekikan_kyori "新大塚" "茗荷谷" global_ekikan_list = 1.2
(* 10.12 kyori_wo_hyoji *)
(* purpose: to display the distance between two stations in text. *)
(* kyori_wo_hyoji: str -> str -> str *)
let kyori_wo_hyoji eki1 eki2 =
let kanji_eki1 = romaji_to_kanji eki1 global_ekimei_list in
let kanji_eki2 = romaji_to_kanji eki2 global_ekimei_list in
if kanji_eki1 = "" || kanji_eki2 = "" then "there is no such station."
else let kyori = get_ekikan_kyori kanji_eki1 kanji_eki2 global_ekikan_list in
if kyori = infinity then kanji_eki1 ^ " and " ^ kanji_eki2 ^ " are'nt connected."
else kanji_eki1 ^ "駅から" ^ kanji_eki2 ^
"駅までは" ^ string_of_float kyori ^ "kmです"
(* 12.1 type define: eki_t *)
(* eki_t has
* namae...kanji name (string)
* saitan_kyori...minimal distance (float)
* temae_list...kanji name list (string list) *)
type eki_t = {
namae: string;
saitan_kyori: float;
temae_list: string list;
}
(* 12.2 make_eki_list *)
(* use ekimei_t val and list *)
(* ekimei_t has
* kanji...string
* kana...string
* romaji...string
* shozoku...string *)
(* ekimei_t list is
* - [] empty list
* - hd::tl hd is head. tl is tail *)
(* purpose: to make station list which is eki_t type *)
(* make_eki_list: ekimei_t list -> eki_t list *)
let make_eki_list lst =
List.map (fun {kanji = j; kana = n; romaji = r; shozoku = s} ->
{namae = j; saitan_kyori = infinity; temae_list = []}) lst
(* 14.11 shokika *)
(* use ekimei_t val, eki_t list *)
(* purpose: to init list
* start station's kyori <= 0, temae_list <= namae *)
(* shokika: eki_t list -> str -> eki_t list *)
let shokika lst eki =
List.map (fun ({namae = n; saitan_kyori = d; temae_list = l} as station) ->
if eki = n then {namae = n; saitan_kyori = 0.; temae_list = n::l}
else station) lst
(* 14.12 *)
(* purpose: to make and init station list which is eki_t type *)
(* make_initial_eki_list: ekimei_t list -> string -> eki_t list *)
let make_initial_eki_list lst eki =
List.map (
fun {kanji = j; kana = n; romaji = r; shozoku = s;} ->
if eki = j then {namae = j; saitan_kyori = 0.; temae_list = j::[];}
else {namae = j; saitan_kyori = infinity; temae_list = [];}
)
lst
(* 12.4 seiretsu *)
(* sub function for "seiretsu"; ins_eki *)
(* purpose: to insert ekimei_t val in sorted list *)
(* ins_eki: ekimei_t -> ekimei_t list -> ekimei_t list *)
let rec ins_eki eki lst = match lst with
[] -> eki::[]
| ({kanji = hd_j; kana = hd_n; romaji = hd_r; shozoku = hd_s;} as hd)::tl -> (match eki with
{kanji = eki_j; kana = eki_n; romaji = eki_r; shozoku = eki_s;} ->
if eki_n > hd_n then hd::(ins_eki eki tl)
else eki::lst)
(* use ekimei_t val, ekimei_t list *)
(* purpose: to sort ekimei_t list ascending order *)
(* seiretsu: ekimei_t list -> ekimei_t list *)
let rec seiretsu lst = match lst with
[] -> []
| hd::tl -> ins_eki hd (seiretsu tl)
(* 14.13 kousin *)
(* use eki_t list, and val *)
(* purpose: to update V (eki_t list) by p as start point *)
(* kousin: eki_t -> eki_t list -> eki_t list -> eki_t list *)
let koushin p v network=
match p with {namae = p_n; saitan_kyori = p_s; temae_list = p_lst;} ->
List.map (
fun
({namae = q_n; saitan_kyori = q_s; temae_list = q_list;} as q) ->
let kyori_p_q = get_ekikan_kyori p_n q_n network in
if kyori_p_q = infinity then q
else if kyori_p_q +. p_s < q_s then {namae = q_n; saitan_kyori = kyori_p_q +. p_s; temae_list = q_n::p_lst;}
else q
)
v
(* test *)
let eki1 = {namae="池袋"; saitan_kyori = infinity; temae_list = []}
let eki2 = {namae="新大塚"; saitan_kyori = 1.2; temae_list = ["新大塚"; "茗荷谷"]}
let eki3 = {namae="茗荷谷"; saitan_kyori = 0.; temae_list = ["茗荷谷"]}
let eki4 = {namae="後楽園"; saitan_kyori = infinity; temae_list = []}
let eki5 = eki4
let eki6 = eki4
let eki7 = eki4
let lst = [eki1; eki2; eki3; eki4; eki5; eki6; eki7]
let t1 = koushin eki2 [] global_ekikan_list = []
(* 15.4 -> 15.5 *)
(* purpose: to separate V into minimal kyori eki and the others *)
(* saitan_wo_bunri: eki_t list -> eki_t * eki_t list *)
let saitan_wo_bunri lst =
List.fold_right (fun hd (p, v) ->
match (hd, p) with
({namae = hn; saitan_kyori = hs; temae_list = ht;},
{namae = pn; saitan_kyori = ps; temae_list = pt;}) ->
if pn = "" then (hd, v)
else if hs < ps then (hd, p::v)
else (p, hd::v))
lst
({namae = ""; saitan_kyori = infinity; temae_list = []}, [])
(* 16.4 dijkstra_main *)
(* purpose: to realize dijkstra algorithm *)
(* dijkstra_main: eki_t list -> ekikan_t list -> eki_t list *)
let dijkstra_main eki_list ekikan_list =
let rec dijkstra_sub p v u =
if v = [] then u
else
let (next_p, next_v) = saitan_wo_bunri (koushin p v ekikan_list)
in
dijkstra_sub next_p next_v (next_p::u)
in
let (start_p, start_v) = saitan_wo_bunri eki_list
in
dijkstra_sub start_p start_v (start_p::[])
(* let myougadani_min = dijkstra_main (make_initial_eki_list global_ekimei_list "茗荷谷") global_ekikan_list *)
(* 16.5 dijkstra *)
(* purpose: to calc minimal distance between two stations *)
(* dijkstra: string -> string -> eki_t *)
let dijkstra eki1 eki2 =
(* purpose: to delete overlapping vals from sorted list *)
(* clean: ekimei_t list -> ekimei_t list *)
let rec clean lst = match lst with
[] -> []
| hd1::tl1 -> match tl1 with
[] -> hd1::[]
| hd2::tl2 -> match (hd1, hd2) with
({kanji = j1; kana = n1; romaji = r1; shozoku = s1;},
{kanji = j2; kana = n2; romaji = r2; shozoku = s2;}) ->
if j1 = j2 then hd1::(clean tl2)
else hd1::(clean tl1)
in
let cleaned_ekimei_list = clean (seiretsu global_ekimei_list)
in
let (kanji1, kanji2) = ((romaji_to_kanji eki1 cleaned_ekimei_list), (romaji_to_kanji eki2 cleaned_ekimei_list))
in
let inited_eki_list = make_initial_eki_list cleaned_ekimei_list kanji1
in
let d_list = dijkstra_main inited_eki_list global_ekikan_list
in
(* purpose: to search finish terminal from list *)
(* search: eki_t list -> eki_t *)
let rec search_fin lst = match lst with
[] -> {namae = ""; saitan_kyori = infinity; temae_list = []}
| ({namae = hn; saitan_kyori = sn; temae_list = ht;} as hd) :: tl ->
if hn = kanji2 then hd
else search_fin tl
in
search_fin d_list
(* 17.10 eki_tree_t *)
type eki_tree_t = Empty
| Node of string * (string * float) list