Added check graph valid.