Added bounds checking to addDirectedEdge().