algorithm corrected: get_node_edge method