updated add_edge to return nil