nxt=nxt>next;
This typo basically makes you assign 0/1 to nxt
, and later you treat it like a pointer.
(PS I am almost certain compiler provided warning for it that could save your valuable time).
One more issue is with nxt=e;
instead of g->nodes[source].edges = e
.
In the first - you merely change the local variable, but don't actually change the data.