Find inverse edge using matrix