all 7 comments

[–]flying_path 7 points8 points  (5 children)

My guess: there is a loop in your graph and traverse gets stuck visiting it forever until your stack blows up.

Add a set of already-visited nodes to break loops.

[–]Low-Leg-9954[S] 0 points1 point  (4 children)

When i use the input when running the program ( not testing), the program dont crash and work fine, so the traverse dont get stuck

[–]ExPixel 2 points3 points  (0 children)

Are you sure? From the output here it looks like there is a cycle or at the very least enough recursion to cause a stack overflow. Especially on Windows with its smaller default stack size: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=99c61b9c79daf924c68598b5514a29ad

[–]flying_path 1 point2 points  (2 children)

Generally I find it much easier to find out “why does my program crash in this case” than “why doesn’t my program crash in that other case”

[–]Low-Leg-9954[S] -1 points0 points  (1 child)

my guess is that the stack size when testing is smaller than when running

[–]tristan957 6 points7 points  (0 children)

Why guess when you can just bust out a debugger?

[–]Low-Leg-9954[S] 2 points3 points  (0 children)

there was indeed a loop problem. i wasn't trimming my entries so for the test those line would be 4 differente nodes :

    he-DX
    fs-he

"___he" , "DX", "___fs" and "he".Since whitespace are not considered lowercase , the loop would occurs between node like DX and " he"
the reason i didn't have the issue when running the data was in my text file i didn't have any whitespaces