It contains the D source code, a description of the error and the output produced.
text/plain
3222
Comments
Comment #0 by john.h.nixon1 — 2018-08-29T21:01:44Z
Created attachment 1711
It contains the D source code, a description of the error and the output produced.
The recursive function strongConnect is modifying elements of the dynamic array G. It starts with
vertex "a" then moves to vertex "b". While working with "a" everything seems fine, but with "b",
b.index is updated in vertex v but this last change (b.index = 1) is not reflected in a change to G. Instead
a change to G is delayed until the second call of strongConnect for vertex "b". I was using dmd 2.081.2. Full details are in the attachment.
Comment #1 by dhasenan — 2018-08-29T21:49:34Z
You have an error in your code. Structs are value types; assignment is copying. You assign vertex B to a temporary variable w, then call strongConnect to update that temporary variable, then throw that variable away.
When reporting bugs, it's helpful to make your example as minimal as possible, to use the standard D format instead of a maximally compact format (https://github.com/dlang-community/dfmt with default options, for instance), and to include assertions when data is not in the state you expect.
You can also ask on https://forum.dlang.org/group/learn for people to look at code that's not behaving as you expect.
Best of luck!