protected void Page_Load(object sender, EventArgs e) { ArrayList nodeList = new ArrayList(); //Node aNode = new Node("北京"); //nodeList.Add(aNode); //aNode.EdgeList.Add(new Edge("北京", "上海", 20)); //aNode.EdgeList.Add(new Edge("北京", "武汉", 40)); Node bNode = new Node("上海"); nodeList.Add(bNode); bNode.EdgeList.Add(new Edge("上海", "北京", 20)); bNode.EdgeList.Add(new Edge("上海", "武汉", 70)); Node cNode = new Node("武汉"); nodeList.Add(cNode); cNode.EdgeList.Add(new Edge("武汉", "北京", 40)); cNode.EdgeList.Add(new Edge("武汉", "上海", 70)); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; result = planner.Paln(nodeList, "武汉", "上海"); Response.Write("距离为" + result.getWeight()); printRouteResult(result); Response.Write("上海"); Response.Write("<br />"); planner = null; }
protected void Page_Load(object sender, EventArgs e) { ArrayList nodeList = new ArrayList();//结点的序列 //***************** A Node 北京 ******************* Node aNode = new Node("北京"); nodeList.Add(aNode); aNode.EdgeList.Add(new Edge("北京", "上海", 20)); aNode.EdgeList.Add(new Edge("北京", "武汉", 40)); //***************** B Node 上海******************* Node bNode = new Node("上海"); nodeList.Add(bNode); bNode.EdgeList.Add(new Edge("上海", "武汉", 70)); bNode.EdgeList.Add(new Edge("上海", "北京", 20)); //***************** D Node ******************* Node dNode = new Node("武汉"); nodeList.Add(dNode); dNode.EdgeList.Add(new Edge("武汉", "上海", 70)); dNode.EdgeList.Add(new Edge("武汉", "北京", 40)); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; //Paln函数是核心函数,首先将所有节点喂给模型,然后输入起点和终点,返回最优路径 result = planner.Paln(nodeList, "武汉", "上海"); Response.Write("距离为" + result.getWeight()); printRouteResult(result); Response.Write("上海"); Response.Write("<br>"); planner = null; }
protected void Page_Load(object sender, EventArgs e) { string pointA = "北京"; string pointB = "上海"; ArrayList nodeList = new ArrayList(); Node aNode = new Node("北京"); nodeList.Add(aNode); aNode.EdgeList.Add(new Edge("北京", "上海", 20)); aNode.EdgeList.Add(new Edge("北京", "武汉", 60)); Node dNode = new Node("武汉"); nodeList.Add(dNode); dNode.EdgeList.Add(new Edge("武汉", "北京", 40)); //string output = JsonConvert.SerializeObject(nodeList); //File.WriteAllText(@Server.MapPath("~/data/ExampleSQL.json"), output); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; result = planner.Paln(nodeList, pointA, pointB); Response.Write("距离为" + result.getWeight()); printRouteResult(result); Response.Write(pointB); Response.Write("</br>"); planner = null; }
protected void BtnDijkstra_Click(object sender, EventArgs e) { string strPointAID, strPointBID; strPointAID = DdlPointA.SelectedValue; strPointBID = DdlPointB.SelectedValue; if (strPointAID.Equals(strPointBID)) { Response.Write("距离为: 0<br />路径: " + strPointAID); return; } try { // 调包, 运行Dijkstra算法 RoutePlanner planner = new RoutePlanner(); RoutePlanResult planResult = planner.Paln(arrayNodes, strPointAID, strPointBID); if (planResult.getWeight() < 100000) { Response.Write("距离为: " + planResult.getWeight().ToString()); PrintRouteResult(planResult); Response.Write(strPointBID + "<br />"); } else { Response.Write("无路径<br />"); } planner = null; } catch (Exception Ex) { Response.Write(Ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { ArrayList nodeList = new ArrayList(); Node a = new Node("A"); nodeList.Add(a); a = new Node("A"); nodeList.Add(a); a.EdgeList.Add(new Edge("A", "B", 1)); a = new Node("B"); nodeList.Add(a); a.EdgeList.Add(new Edge("B", "C", 1)); a = new Node("A"); nodeList.Add(a); a.EdgeList.Add(new Edge("A", "B", 1)); a = new Node("C"); nodeList.Add(a); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; //Paln 函数是核心函数,首先将所有节点喂给模型,然后输入起点和终点,返回最优路径 result = planner.Paln(nodeList, "A", "C"); Response.Write("距离为" + result.getWeight()); printRouteResult(result); Response.Write("C"); //Response.Write("上海"); //Response.Write("<br>"); planner = null; //***************** A Node 北京 ******************* //Node aNode = new Node("北京"); //nodeList.Add(aNode); //aNode.EdgeList.Add(new Edge("北京", "上海", 20)); //aNode.EdgeList.Add(new Edge("北京", "武汉", 40)); }
public void SetGoPiont(string GoPoint) { string BeginP = ""; string EndP = ""; string ReBack = ""; BeginP = GetValue(LocalPoint).Replace("_", ""); if (LocalPoint.Trim() == "") { MessageBox.Show("无当前坐标!"); return; } if (BeginP != GoPoint) { BeginP = "A" + BeginP; EndP = "A" + GoPoint; } RoutePlanResult Tresult = planner.Paln(_ComData.nodeList, BeginP, EndP); foreach (string strln in Tresult.getPassedNodeIDs()) { ReBack += "_" + strln; } string PassStr = ReBack + "_" + EndP; SetTask(PassStr.Replace("A", "")); }
protected void btnStart_Click(object sender, EventArgs e) { if (ddlStart.SelectedValue == "0" || ddlEnd.SelectedValue == "0") { Response.Write("<script>alert('Didn't Choose!');</script>"); return; } if (ddlStart.SelectedValue == ddlEnd.SelectedValue) { lblResult.Text = "There is no need to walk!"; return; } SQLHelper sh = new SQLHelper(); DataSet dsNodeList = new DataSet(); string sqlNodeList = ("SELECT [Location1] AS [Location] FROM [dbo].[TblLocation] UNION SELECT [Location2] FROM [dbo].[TblLocation]"); sh.RunSQL(sqlNodeList, ref dsNodeList); int nodeNumber = dsNodeList.Tables[0].Rows.Count; Node[] node = new Node[nodeNumber]; ArrayList nodeList = new ArrayList(); for (int i = 0; i < nodeNumber; i++) { node[i] = new Node(dsNodeList.Tables[0].Rows[i][0].ToString()); nodeList.Add(node[i]); } DataSet dsPath = new DataSet(); for (int i = 0; i < nodeNumber; i++) { string sqlNodePath = string.Format("SELECT [Location2] AS Location,[distance] FROM [dbo].[TblLocation] WHERE [Location1] = '{0}' UNION SELECT [Location1] AS Location,[distance] FROM [dbo].[TblLocation] WHERE [Location2] = '{0}' ", node[i].ID.ToString()); sh.RunSQL(sqlNodePath, ref dsPath); for (int j = 0; j < dsPath.Tables[0].Rows.Count; j++) { node[i].EdgeList.Add(new Edge(node[i].ID.ToString(), dsPath.Tables[0].Rows[j][0].ToString(), double.Parse(dsPath.Tables[0].Rows[j][1].ToString()))); } dsPath = null; } sh.Close(); sh = null; RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = planner.Paln(nodeList, ddlStart.SelectedValue, ddlEnd.SelectedValue); lblResult.Text = "Distance:" + result.getWeight().ToString() + " Route:" + DetailedRoute(result); planner = null; }
private void button2_Click(object sender, EventArgs e) { if (comboBox2.Text == comboBox4.Text) { MessageBox.Show("不能同在一个地标上!"); return; } LocalPoint = this.comboBox4.Text; string Fction = ""; string BeginP = "A14"; string EndP = "A11"; string ReBack = ""; if (LocalPoint.Trim() == "") { MessageBox.Show("无当前坐标!"); return; } if (LocalPoint != comboBox2.Text) { BeginP = "A" + LocalPoint; EndP = "A" + comboBox2.Text; } RoutePlanResult Tresult = planner.Paln(_ComData.nodeList, BeginP, EndP); foreach (string strln in Tresult.getPassedNodeIDs()) { Fction += ">" + strln; ReBack += "_" + strln; } Fction = Fction + "->" + EndP; PassStr = ReBack + "_" + EndP; if (_hts.ContainsKey(comboBox5.Text)) { if (MessageBox.Show("已经设置过AGV#" + comboBox5.Text + ",是否要覆盖之前设置", "提示!", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { _hts[comboBox5.Text] = PassStr; return; } else { return; } } _hts.Add(comboBox5.Text, PassStr); this.richTextBox1.Text += "\nAGV#编号: " + comboBox5.Text + " 已设置,"; richTextBox1.Text += " 路径:" + Fction.Replace("A", ""); DevID = comboBox5.Text; }
public void SetCall() { string Fction = ""; string BeginP = "A14"; string EndP = "A11"; RoutePlanResult Tresult = planner.Paln(_ComData.nodeList, BeginP, EndP); foreach (string strln in Tresult.getPassedNodeIDs()) { Fction += strln; } CreateNode(Fction + EndP); }
static void Main(string[] args) { // 构造一个 图. Graph graph = new Graph(); graph.Init(); // 最短路径计算. RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = planner.Paln(graph.NodeList, "A", "D"); // 输出结果. Console.WriteLine(result.ToString()); Console.ReadLine(); }
/// <summary> /// 从源星球到目标星球的最短路径(待优化:保存源星球的最短路径表,下次寻找不必再次运算算法) /// </summary> /// <param name="StartStar">源星球</param> /// <param name="EndStar">目标星球</param> /// <returns>所有经过的星球(包括目标星球)</returns> public static RoutePlanResult Plan(UnitStar StartStar, UnitStar EndStar) { RoutePlanResult result = new RoutePlanResult(); //在调用最短路径算法前, Node.CheckNodeCanReach先判断目标节点是否在源节点移动半径内,是的话直接返回源节点(两点之间,直线最短) if (StartStar.CheckStarReachByDistance(EndStar) == true) { result.PassedStars.Add(StartStar); result.PassedStars.Add(EndStar); result.Weight = StartStar.GetTargetStarDistance(EndStar); } else { RoutePlanner planner = new RoutePlanner(); result = planner.Paln(MogoWorld.m_dataMapManager.GetStarList(), StartStar.UnitId, EndStar.UnitId); result.PassedStars.Add(EndStar); planner = null; } return(result); }
private void button3_Click(object sender, EventArgs e) { if (comboBox5.Text == comboBox4.Text) { MessageBox.Show("不能同在一个地标上!"); return; } LocalPoint = this.comboBox4.Text; this.richTextBox1.Text += "\n AGV#" + comboBox2.Text + ">> 起始地标: " + LocalPoint + " 开往目的地标:" + comboBox5.Text + " 已设定。"; string Fction = ""; string BeginP = "A14"; string EndP = "A11"; string ReBack = ""; if (LocalPoint.Trim() == "") { MessageBox.Show("无当前坐标!"); return; } if (LocalPoint != comboBox5.Text) { BeginP = "A" + LocalPoint; EndP = "A" + comboBox5.Text; } RoutePlanResult Tresult = planner.Paln(_ComData.nodeList, BeginP, EndP); foreach (string strln in Tresult.getPassedNodeIDs()) { Fction += "->" + strln; ReBack += "_" + strln; } Fction = Fction + "->>" + EndP; PassStr = ReBack + "_" + EndP; richTextBox1.Text += " 路径:" + Fction.Replace("A", ""); DevID = comboBox2.Text; }
protected void Button1_Click(object sender, EventArgs e) { RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; result = planner.Paln(nodeList, ddlStart.SelectedValue, ddlEnd.SelectedValue); //当路径的权值返回是double的最大值,就认为,两点间的距离是正无穷,也就是不通的 double aim = Math.Abs(result.getWeight() - double.MaxValue); string finalpath = string.Format("{0}到{1}的路径是:", ddlStart.SelectedValue, ddlEnd.SelectedValue); Response.Write(finalpath); if (aim <= 0) { Response.Write("距离为正无穷"); } else { Response.Write("距离为" + result.getWeight()); //输出路径 printRouteResult(result); } planner = null; }
protected void Button1_Click(object sender, EventArgs e) { string pointA = ddlPointA.SelectedItem.Text; string pointB = ddlPointB.SelectedItem.Text; if (pointA == pointB) { Response.Write("不能起始地为同一处!"); } else { //生成图 ArrayList nodeList = new ArrayList(); string sql = "select PointA from tblDistance2020 group by PointA"; SQLHelper sh1 = new SQLHelper(); DataTable dt = new DataTable(); DataSet ds = new DataSet(); try { sh1.RunSQL(sql, ref ds); if (ds.Tables[0] != null) { dt = ds.Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { Node node = new Node(dr[0].ToString()); nodeList.Add(node); string sql2 = string.Format("select * from tblDistance2020 where PointA='{0}'", dr[0].ToString()); SQLHelper sh2 = new SQLHelper(); DataTable dt2 = new DataTable(); DataSet ds2 = new DataSet(); sh2.RunSQL(sql2, ref ds2); if (ds2.Tables[0] != null) { dt2 = ds2.Tables[0]; if (dt2.Rows.Count > 0) { foreach (DataRow dr2 in dt2.Rows) { node.EdgeList.Add(new Edge(dr2[1].ToString(), dr2[2].ToString(), double.Parse(dr2[3].ToString()))); } } } sh2.Close(); } } } } catch (Exception ex) { Response.Write(ex.Message); } finally { sh1.Close(); } RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; try { result = planner.Paln(nodeList, pointA, pointB); Response.Write("距离为" + result.getWeight()); printRouteResult(result); Response.Write(pointB); Response.Write("</br>"); planner = null; } catch { Response.Write("两地不能到达!"); } } }
protected void Button1_Click(object sender, EventArgs e) { //需要四个sql,sh,ds,dt,row string sqla1, sqla2, sqlb1, sqlb2; string ca = ""; string cb = ""; string start = ddl1.SelectedValue; string end = ddl2.SelectedValue; SQLHelper sha1 = new SQLHelper(); SQLHelper sha2 = new SQLHelper(); SQLHelper shb1 = new SQLHelper(); SQLHelper shb2 = new SQLHelper(); DataSet dsa1 = new DataSet(); DataSet dsb1 = new DataSet(); DataTable dta1, dta2, dtb1, dtb2; DataRow[] ra1, ra2, rb1, rb2; ArrayList nodeList = new ArrayList(); //思路:遍历A,对A的每一个城市,遍历所有路径;然后遍历B中不在A中的城市,同样遍历路径 //介于debug次数过多,把快捷的debug方法写在这里提醒自己:通过response.write监视nodelist的录入 sqla1 = "select PointA from students.dbo.tblDistance group by PointA"; sha1.RunSQL(sqla1, ref dsa1); dta1 = dsa1.Tables[0]; ra1 = dta1.Select("PointA is not null"); sha1.Close(); for (int i = 0; i <= dta1.Rows.Count - 1; i++) { ca = ra1[i]["PointA"].ToString(); Node a = new Node(ca); nodeList.Add(a); DataSet dsa2 = new DataSet(); //dsa2、dsb2一定要在for循环内反复声明,以清空set内存;否则,新ref到的数据会加入到Tables[0]中而非替换之 sqla2 = string.Format("select PointA,PointB,Distance from students.dbo.tblDistance where PointA='{0}' group by PointA,PointB,Distance", ca); sha2.RunSQL(sqla2, ref dsa2); dta2 = dsa2.Tables[0]; ra2 = dta2.Select("PointA is not null"); sha2.Close(); for (int j = 0; j <= dta2.Rows.Count - 1; j++) { cb = ra2[j]["PointB"].ToString(); a.EdgeList.Add(new Edge(ca, cb, double.Parse(ra2[j]["Distance"].ToString()))); } } sqlb1 = "select PointB from (select PointB from students.dbo.tblDistance group by PointB)B left join (select PointA from students.dbo.tblDistance group by PointA)A on A.PointA=B.PointB where PointA is null"; shb1.RunSQL(sqlb1, ref dsb1); dtb1 = dsb1.Tables[0]; rb1 = dtb1.Select("PointB is not null"); shb1.Close(); for (int i = 0; i <= dtb1.Rows.Count - 1; i++) { cb = rb1[i]["PointB"].ToString(); DataSet dsb2 = new DataSet(); sqlb2 = string.Format("select PointA,PointB,Distance from students.dbo.tblDistance where PointB='{0}' group by PointA,PointB,Distance", cb); shb2.RunSQL(sqlb2, ref dsb2); dtb2 = dsb2.Tables[0]; rb2 = dtb2.Select("PointB is not null"); shb2.Close(); Node b = new Node(cb); nodeList.Add(b); for (int j = 0; j <= dtb2.Rows.Count - 1; j++) { ca = rb2[j]["PointA"].ToString(); b.EdgeList.Add(new Edge(cb, ca, double.Parse(rb2[j]["Distance"].ToString()))); } } RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = null; if (start == end) { Response.Write("距离为0"); } else { result = planner.Paln(nodeList, start, end); if (result.getWeight() > 100000000) { Response.Write("两地无通路!"); } else { Response.Write("距离为" + result.getWeight()); printRouteResult(result); Response.Write(end + "</br>"); planner = null; } } }
private void GetPic() { Bitmap bitmap; Image img = global::CJia.Navigate.App.Properties.Resources.停车场2; _size = new Size(img.Size.Width, img.Size.Height); _backImage = new Bitmap(img, _size); bitmap = new Bitmap(img, _size); pictureBox1.Height = _size.Height; pictureBox1.Width = _size.Width; pictureBox1.Image = global::CJia.Navigate.App.Properties.Resources.停车场2; //string StartNo = CJia.Parking.Tools.ConfigHelper.GetAppStrings("StartNo"); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = planner.Paln(Graph.Nodelist, Start, ParkNo); planner = null; List <Point> pointList = result.PointList; DataTable dtPoint = CJia.DefaultPostgre.Query(CJia.Parking.Models.SqlTools.SqlQueryPointByPointNo, new object[] { ParkNo }); Point point = new Point(Convert.ToInt32(dtPoint.Rows[0]["point_X"]), Convert.ToInt32(dtPoint.Rows[0]["point_Y"])); pointList.Add(point); for (int i = 0; i < pointList.Count - 1; i++) { //DataTable dtPoint = CJia.DefaultPostgre.Query(CJia.Parking.Models.SqlTools.SqlQueryPointByPointNo, new object[] { nodeList[i].ToString() }); //Point point = new Point(Convert.ToInt32(dtPoint.Rows[0]["point_X"]), Convert.ToInt32(dtPoint.Rows[0]["point_Y"])); //listPoint.Add(point); if (result.PointList.Count > 1) { Bitmap bitmap1 = DrawLineInPicture(_backImage, pointList[i], pointList[i + 1], Color.Red, 5, DashStyle.Solid); Image myimage = Image.FromHbitmap(bitmap1.GetHbitmap()); pictureBox1.Image = myimage; } PictureBox picstart = new PictureBox(); //Image.FromFile("Images/起点.png"); picstart.Image = global::CJia.Navigate.App.Properties.Resources.起点; picstart.Width = 25; picstart.Height = 24; picstart.BackColor = System.Drawing.Color.Transparent; pictureBox1.Controls.Add(picstart); picstart.Location = new Point(pointList[0].X - 12, pointList[0].Y - 12); PictureBox picend = new PictureBox(); //Image.FromFile("Images/起点.png"); picend.Image = global::CJia.Navigate.App.Properties.Resources.终点; picend.Width = 25; picend.Height = 24; picend.BackColor = System.Drawing.Color.Transparent; pictureBox1.Controls.Add(picend); picend.Location = new Point(pointList[pointList.Count - 1].X - 12, pointList[pointList.Count - 1].Y - 12); } //for (int j = 0; j < listPoint.Count - 1; j++) //{ // Bitmap bitmap1 = DrawLineInPicture(_backImage, listPoint[j], listPoint[j + 1], Color.Red, 2, DashStyle.Solid); // Image myimage = Image.FromHbitmap(bitmap1.GetHbitmap()); // pictureBox1.Image = myimage; //} listPoint.Clear(); }
private void btnRW_Click(object sender, EventArgs e) { Node aNode = new Node("A"); nodeList.Add(aNode); Edge aEdge1 = new Edge(); aEdge1.StartNodeID = aNode.ID; aEdge1.EndNodeID = "B"; aEdge1.Weight = 10; aNode.EdgeList.Add(aEdge1); Node bNode = new Node("B"); nodeList.Add(bNode); Edge bEdge1 = new Edge(); bEdge1.StartNodeID = bNode.ID; bEdge1.EndNodeID = "C"; bEdge1.Weight = 5; bNode.EdgeList.Add(bEdge1); Edge bEdge2 = new Edge(); bEdge2.StartNodeID = bNode.ID; bEdge2.EndNodeID = "D"; bEdge2.Weight = 5; bNode.EdgeList.Add(bEdge2); Node cNode = new Node("C"); nodeList.Add(cNode); Edge cEdge1 = new Edge(); cEdge1.StartNodeID = cNode.ID; cEdge1.EndNodeID = "D"; cEdge1.Weight = 5; cNode.EdgeList.Add(cEdge1); Edge cEdge2 = new Edge(); cEdge2.StartNodeID = cNode.ID; cEdge2.EndNodeID = "B"; cEdge2.Weight = 5; cNode.EdgeList.Add(cEdge2); Edge cEdge3 = new Edge(); cEdge3.StartNodeID = cNode.ID; cEdge3.EndNodeID = "F"; cEdge3.Weight = 10; cNode.EdgeList.Add(cEdge3); Node dNode = new Node("D"); nodeList.Add(dNode); Edge dEdge1 = new Edge(); dEdge1.StartNodeID = dNode.ID; dEdge1.EndNodeID = "B"; dEdge1.Weight = 5; dNode.EdgeList.Add(dEdge1); Edge dEdge2 = new Edge(); dEdge2.StartNodeID = dNode.ID; dEdge2.EndNodeID = "C"; dEdge2.Weight = 5; dNode.EdgeList.Add(dEdge2); Edge dEdge3 = new Edge(); dEdge3.StartNodeID = dNode.ID; dEdge3.EndNodeID = "E"; dEdge3.Weight = 10; dNode.EdgeList.Add(dEdge3); Node eNode = new Node("E"); nodeList.Add(eNode); Edge eEdge1 = new Edge(); eEdge1.StartNodeID = eNode.ID; eEdge1.EndNodeID = "D"; eEdge1.Weight = 10; eNode.EdgeList.Add(eEdge1); Node fNode = new Node("F"); nodeList.Add(fNode); Edge fEdge1 = new Edge(); fEdge1.StartNodeID = fNode.ID; fEdge1.EndNodeID = "C"; fEdge1.Weight = 10; fNode.EdgeList.Add(fEdge1); Edge fEdge2 = new Edge(); fEdge2.StartNodeID = fNode.ID; fEdge2.EndNodeID = "H"; fEdge2.Weight = 5; fNode.EdgeList.Add(fEdge2); Edge fEdge3 = new Edge(); fEdge3.StartNodeID = fNode.ID; fEdge3.EndNodeID = "G"; fEdge3.Weight = 5; fNode.EdgeList.Add(fEdge3); Node gNode = new Node("G"); nodeList.Add(gNode); Edge gEdge1 = new Edge(); gEdge1.StartNodeID = gNode.ID; gEdge1.EndNodeID = "F"; gEdge1.Weight = 5; gNode.EdgeList.Add(gEdge1); Edge gEdge2 = new Edge(); gEdge2.StartNodeID = gNode.ID; gEdge2.EndNodeID = "I"; gEdge2.Weight = 6; gNode.EdgeList.Add(gEdge2); Node hNode = new Node("H"); nodeList.Add(hNode); Edge hEdge1 = new Edge(); hEdge1.StartNodeID = hNode.ID; hEdge1.EndNodeID = "F"; hEdge1.Weight = 5; hNode.EdgeList.Add(hEdge1); Edge hEdge2 = new Edge(); hEdge2.StartNodeID = hNode.ID; hEdge2.EndNodeID = "I"; hEdge2.Weight = 5; hNode.EdgeList.Add(hEdge2); Node iNode = new Node("I"); nodeList.Add(iNode); Edge iEdge1 = new Edge(); iEdge1.StartNodeID = iNode.ID; iEdge1.EndNodeID = "H"; iEdge1.Weight = 5; iNode.EdgeList.Add(iEdge1); Edge iEdge2 = new Edge(); iEdge2.StartNodeID = iNode.ID; iEdge2.EndNodeID = "G"; iEdge2.Weight = 6; iNode.EdgeList.Add(iEdge2); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = planner.Paln(nodeList, "E", "C"); }