Implement AddEdge and RemoveEdge.