def find_sink_node(digr):
 node = digr.nodes()[0]
 while digr.neighbors(node):
  node = digr.neighbors(node)[0]
 return node

def find_sink_node ( digr ) : node = digr . nodes ( ) [ 0 ] while digr . neighbors ( node ) : node = digr . neighbors ( node ) [ 0 ] return node
finds a sink node in the directed graph .