// // A copy constructor for a graph (so that we can perform multiple searches) // since the graph may be modified from one iteration to the next. // public PathGraph(PathGraph another) { numVerts = another.numVerts; // // Create and copy all vertex-edge information // this.vertexList = new List<Edge>[numVerts]; for (int i = 0; i < vertexList.Length; i++) { if (another.vertexList[i] != null) { this.vertexList[i] = new List<Edge>(); foreach (Edge e in another.vertexList[i]) { this.vertexList[i].Add(new Edge(e)); } } } }
// // A copy constructor for a graph (so that we can perform multiple searches) // since the graph may be modified from one iteration to the next. // public PathGraph(PathGraph another) { numVerts = another.numVerts; // // Create and copy all vertex-edge information // this.vertexList = new List <Edge> [numVerts]; for (int i = 0; i < vertexList.Length; i++) { if (another.vertexList[i] != null) { this.vertexList[i] = new List <Edge>(); foreach (Edge e in another.vertexList[i]) { this.vertexList[i].Add(new Edge(e)); } } } }
// // Basic Path constructor // public Suurballe(PathGraph g) { graph = g; startNode = 0; // Default path starts at the first vertex: 0 goalNode = g.NumVertices() - 1; // Default goal is the last vertex }