dag2essgraph function

Convert a DAG to an Essential Graph