Added control for directed graph and update with the 'undir' function