public virtual void ChangeEdgeType(int direction, StatEdge edge, int newtype) { int oldtype = edge.GetType(); if (oldtype == newtype) { return; } if (oldtype == StatEdge.Type_Exception || newtype == StatEdge.Type_Exception) { throw new Exception("Invalid edge type!"); } RemoveEdgeDirectInternal(direction, edge, oldtype); AddEdgeDirectInternal(direction, edge, newtype); if (direction == Direction_Forward) { edge.GetDestination().ChangeEdgeType(Direction_Backward, edge, newtype); } edge.SetType(newtype); }