added valid data checking for graph

makes it so sets only add when valid