converted directed dfs to lib