graph, input: abstract more

The things I had to route to make this happen. I feel sorry for pipe-laying people around the world now.