graph: parse input