/// <summary> /// 添加一条必经路径,从任意一端走均算经过. /// </summary> /// <param name="pointA">点A</param> /// <param name="pointB">点B</param> /// public void AddMustPassEitherWayPath(int pointA, int pointB) { try { MustPassEitherWayPaths.Add(Matrix[pointA, pointB].Paths[0]); MustPassEitherWayPaths.Add(Matrix[pointB, pointA].Paths[0]); } catch { throw new Exception("未找到该路径."); } }
public void RemoveMustNotPassAnyWayPath(int pointA, int pointB) { try { var path1 = MustNotPassAnyWayPaths.Where(p => p.From == pointA && p.To == pointB).FirstOrDefault(); MustPassEitherWayPaths.Remove(path1); var path2 = MustNotPassAnyWayPaths.Where(p => p.From == pointB && p.To == pointA).FirstOrDefault(); MustPassEitherWayPaths.Remove(path2); } catch { throw new Exception("未找到该路径."); } }