modified refined.py to suit digraph