資源簡介
作為圖論的大作業,我選擇了2007年全國數學建模大賽的B題,里面有源代碼和可執行文件,歡迎分享,對于題目我略有改動~

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
namespace?Traffic
{
????public?class?Arc
????{
????????public?string?Name;//線路名稱
????????public?int?TChange;//換乘時間
????????public?int?TDrive;//行駛時間
????????public?int?Price;//費用
????????public?Arc?next;//連接相同兩個點的下一條邊
????????public?Arc()
????????{
????????????this.next?=?null;
????????}
????????public?Arc(string?m_name?int?m_TChange?int?m_TDrive?int?m_Price)
????????{
????????????this.Name?=?m_name;
????????????this.TChange?=?m_TChange;
????????????this.TDrive?=?m_TDrive;
????????????this.Price?=?m_Price;
????????????this.next?=?null;
????????}
????????public?Arc?CopyArc()
????????{
????????????Arc?anew?=?new?Arc(this.Name?this.TChange?this.TDrive?this.Price);
????????????return?anew;
????????}
????????//添加重邊
????????public?void?AddTail(Arc?mTemp)
????????{
????????????Arc?a?=?this;
????????????if?(mTemp.TChange?>=?a.TChange?&&?mTemp.TDrive?>=?a.TDrive?&&?mTemp.Price?>=?a.Price)
????????????????return;
????????????if?(mTemp.TChange?<=?a.TChange?&&?mTemp.TDrive?<=?a.TDrive?&&?mTemp.Price?<=?a.Price)
????????????{
????????????????a.TChange?=?mTemp.TChange;
????????????????a.TDrive?=?mTemp.TDrive;
????????????????a.Price?=?mTemp.Price;
????????????????return;
????????????}
????????????Arc?b?=?a.next;
????????????while?(b?!=?null)
????????????{
????????????????if?(mTemp.TChange?>=?b.TChange?&&?mTemp.TDrive?>=?b.TDrive?&&?mTemp.Price?>=?b.Price)
????????????????????return;
????????????????if?(mTemp.TChange?????????????????{
????????????????????b.TChange?=?mTemp.TChange;
????????????????????b.TDrive?=?mTemp.TDrive;
????????????????????b.Price?=?mTemp.Price;
????????????????????return;
????????????????}
????????????????a?=?b;
????????????????b?=?b.next;
????????????}
????????????a.next?=?mTemp;
????????}
????????//取該弧關聯的兩點之間的最小費用
????????public?void?LeastPrice(ref?int[][]?minPrice?ref?int[][]?minTime?ref?string[][]chooseName?int?start?int?end)
????????{
????????????minPrice[start][end]?=?this.Price;
????????????chooseName[start][end]?=?this.Name;
????????????minTime[start][end]?=?this.Price?>?0???this.TDrive?:?this.TChange;
????????????Arc?temp?=?this.next;
????????????while?(temp?!=?null)
????????????{
????????????????if?(minPrice[start][end]?>?temp.Price)
????????????????{
????????????????????minPrice[start][end]?=?temp.Price;
????????????????????chooseName[start][end]?=?temp.Name;
????????????????????minTime[start][end]?=?temp.Price?>?0???temp.TDrive?:?temp.TChange;
????????????????}
????????????????temp?=?temp.next;
????????????}
????????}
????????//取該弧關聯的兩點之間最短可達的時間
????????public?void?LeastTime(ref?int[][]?minPrice?ref?int[][]?minTime?ref?string[][]?chooseName?int?start?int?end)
????????{
????????????minTime[start][end]?=?this.Price?>?0???this.TDrive?:?this.TChange;
????????????chooseName[star
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3688??2010-07-06?18:34??源代碼\Arc.cs
?????文件??????33328??2010-07-06?22:46??源代碼\Form1.cs
?????文件?????177183??2010-07-03?12:44??可執行文件\11BusLineInfo.txt
?????文件????????182??2010-07-01?18:35??可執行文件\12RailLineInfo.txt
?????文件????????568??2010-07-01?18:35??可執行文件\21T1.txt
?????文件????????473??2010-07-01?18:36??可執行文件\22T2.txt
?????文件?????252416??2010-07-07?13:22??可執行文件\Traffic.exe
?????目錄??????????0??2010-07-11?00:20??源代碼
?????目錄??????????0??2010-07-11?00:20??可執行文件
-----------?---------??----------?-----??----
???????????????467838????????????????????9
評論
共有 條評論