Migrate https://github.com/clue/graph/pull/79 (refs https://github.com/clue/graph/issues/119)
Migrate graphp/graph#79 (refs graphp/graph#119)