资源简介
以前写的有BUG,此版本改正了BUG,以前版本的请不要下载了,现在资源分不能为0了啊
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class ShortestPathEngine
{
private static ShortestPathEngine _instance;
///
/// 获取最短路径解析引擎实例
///
///
public static ShortestPathEngine GetInstance()
{
if (_instance == null)
{
_instance = new ShortestPathEngine();
}
return _instance;
}
#region (共有方法)
///
/// 获取开始节点到其它节点的最短路径集合
///
/// 开始节点
/// 目的节点
/// 地址表
/// 提示消息
/// 最短路径集合
public List GetShortestPath(string fromPoint string toPoint DataTable dt out string msg)
{
msg = string.Empty;
try
{
List pointNameU = new List();//剩余顶点
List pointNameS = new List();//已求出最短路径的顶点的集合
List shortPathList = new List();//最短路径对象集合
List lastShortPathList = new List();//上一个最短路径对象集合
List notRemovePathList = new List();//未被移除的路径对象集合
pointNameU = GetAllPointName(dt);
bool isCheck = CheckPoint(pointNameU fromPoint toPoint out msg);
if (!isCheck)
{
return null;
}
//---start 计算第一个最短路径
string nextPoint = fromPoint;//下个最短节点
string startPoint = fromPoint;//开始节点
int distance = GetDistance(fromPoint nextPoint dt);
string path = string.Format(“{0}{1}“ fromPoint nextPoint);
pointNameS.Add(fromPoint);//添加已为最短路径的节点
pointNameU.Remove(fromPoint);//从剩余节点移除
new ShortPathList(shortPathList).AddShortPath(startPoint nextPoint path distance);//添加到最短路径集合
//---end
List centerPointList = new List();//中间节点
centerPointList.Add(nextPoint);
ResolveCenterPointShortPaths(centerPointList dt pointNameU pointNameS
notRemovePathList shortPathList lastShortPathList startPoint);
if (shortPathList == null || shortPathList.Count == 0)
{
msg = string.Format(“不存在{0}节点到其它节点的最短路径“ fromPoint);
return null;
}
else
{
return shortPathList;
}
}
catch
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 22016 2017-12-26 11:15 ShortestPathEngine\ShortestPath\BLL\bin\Debug\BLL.dll
文件 58880 2017-12-26 11:15 ShortestPathEngine\ShortestPath\BLL\bin\Debug\BLL.pdb
文件 2457 2016-06-19 14:17 ShortestPathEngine\ShortestPath\BLL\BLL.csproj
文件 710 2017-12-26 09:39 ShortestPathEngine\ShortestPath\BLL\obj\Debug\BLL.csproj.FileListAbsolute.txt
文件 1755 2017-12-26 09:39 ShortestPathEngine\ShortestPath\BLL\obj\Debug\BLL.csprojResolveAssemblyReference.cache
文件 22016 2017-12-26 11:15 ShortestPathEngine\ShortestPath\BLL\obj\Debug\BLL.dll
文件 58880 2017-12-26 11:15 ShortestPathEngine\ShortestPath\BLL\obj\Debug\BLL.pdb
文件 6555 2017-12-26 09:39 ShortestPathEngine\ShortestPath\BLL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2016-06-18 23:34 ShortestPathEngine\ShortestPath\BLL\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2016-06-18 23:34 ShortestPathEngine\ShortestPath\BLL\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2016-06-18 23:34 ShortestPathEngine\ShortestPath\BLL\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 1344 2016-06-18 23:34 ShortestPathEngine\ShortestPath\BLL\Properties\AssemblyInfo.cs
文件 15474 2017-12-26 11:15 ShortestPathEngine\ShortestPath\BLL\ShortestPathEngine.cs
文件 37811 2016-06-19 14:36 ShortestPathEngine\ShortestPath\BLL\ShortestPathEngineV1.cs
文件 187 2016-06-18 23:34 ShortestPathEngine\ShortestPath\ShortestPath\App.config
文件 22016 2017-12-26 11:15 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\BLL.dll
文件 58880 2017-12-26 11:15 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\BLL.pdb
文件 13824 2017-12-26 11:15 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\ShortestPath.exe
文件 187 2016-06-18 23:34 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\ShortestPath.exe.config
文件 34304 2017-12-26 11:15 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\ShortestPath.pdb
文件 24224 2017-12-26 11:15 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\ShortestPath.vshost.exe
文件 187 2016-06-18 23:34 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\ShortestPath.vshost.exe.config
文件 490 2017-03-19 05:00 ShortestPathEngine\ShortestPath\ShortestPath\bin\Debug\ShortestPath.vshost.exe.manifest
文件 5273 2017-12-26 10:30 ShortestPathEngine\ShortestPath\ShortestPath\Form1.cs
文件 11822 2016-06-19 14:50 ShortestPathEngine\ShortestPath\ShortestPath\Form1.Designer.cs
文件 8421 2016-06-19 14:50 ShortestPathEngine\ShortestPath\ShortestPath\Form1.resx
文件 865 2017-12-26 09:40 ShortestPathEngine\ShortestPath\ShortestPath\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7192 2017-12-26 09:39 ShortestPathEngine\ShortestPath\ShortestPath\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 2198 2017-12-26 11:15 ShortestPathEngine\ShortestPath\ShortestPath\obj\Debug\ShortestPath.csproj.FileListAbsolute.txt
文件 977 2017-12-26 09:41 ShortestPathEngine\ShortestPath\ShortestPath\obj\Debug\ShortestPath.csproj.GenerateResource.Cache
............此处省略38个文件信息
- 上一篇:WPF自定义鼠标形状 自定义鼠标
- 下一篇:C# 模拟 红绿灯程序
评论
共有 条评论