Graph construction and traversal in search of Kevin Bacon