implemented dag validation via networkx