Fix bugs with strong versus weak reference paths.

This fixes a few issues with strong versus weak reference paths:
* It was possible to have a path from gc root with a root in the
  middle of the path.
* It was possible to have a path from gc root with a cycle, which
  would cause ahat to go into an infinite loop.
* It was still possible to have a path from gc root through weak
  references when there existed other paths from gc root only through
  strong references.

Bug: 64592321

Test: m ahat-test, with new tests added.
Change-Id: I2d3cc8c5a398aad24d70c3a428bdc3a470ddb3aa
4 files changed