rewrote callstack generation for graphs. fixes #21

the new logic is a lot slower than the old but cannot be stuck in an
endless loop.