Modified printing to skip edges to nodes that weren't in the input