graph_input function

A function to process input as input for graph manipulation