ダイクストラ法を用いて最短経路問題を解くプログラムが完成したのですが。。。
問題が発生しました。
Segmentation fault とCygwinで表示され
gdbで調べてみたんですが。。
#0 0x00401649 in daijkstra (a=14) at C_2~extra.c:135 #1 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #2 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #3 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #4 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #5 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #6 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #7 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #8 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #9 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #10 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #11 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #12 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #13 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #14 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #15 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #16 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #17 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #18 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #19 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #20 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #21 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 #22 0x00401651 in daijkstra (a=14) at C_2~extra.c:135 #23 0x00401651 in daijkstra (a=57) at C_2~extra.c:135 ---Type <return> to continue, or q <return> to quit--となり135行目はちょうど矢印の部分です。
いったい何が起こっているのでしょうか??
再帰の無限ループになっているのでしょうか??
でも、同じ点はten * hen 以上アクセスできないようにして、そのうちその点はアクセスできないようになり再帰は起こらない(count[/url]の要素にならないから)はずなんですが。。hen * ten の部分を 1 に変えてみるとうまくいきごくたまにSegmentation faultと表示されます。この場合はある点aは2回以上アクセスできないということになるので、2回目でアクセスしたときに2回目の方が1回目より短い場合変更できなくなります。ten * hen は全ての点にネットワーク(無向グラフです)の辺が付いたと考えた場合です(これ以上の数はないという条件です・たぶん間違ってます;;)
どなたかSegmentation faultを表示しなくなる方法を教えて下さい.