isValidGraph function

Check for a DAG, CPDAG or a maximally oriented PDAG