资源简介
用VC6.0开发的Dijkstra算法的三个应用实例,方法1中包含了图的生成和邻接表存储,方法2和三需要用户手动输入,用邻接矩阵存储
Dijkstra's algorithm with VC6.0 developed three application examples, the method includes a graph adjacency table generation and storage, two and three methods require the user to manually enter, with adjacency matrix storage
代码片段和文件信息
//Dijkstra算法的完整实现版本,算法的源代码
/* Dijkstra.c
Copyright (c) 2002 2006 by ctu_85
All Rights Reserved.
*/
#include “stdio.h“
#include “malloc.h“
#define maxium 32767
#define maxver 9 /*defines the max number of vertexs which the programm can handle*/
#define OK 1
struct Point
{
char vertex[3];
struct link *work;
struct Point *next;
};
struct link
{
char vertex[3];
int value;
struct link *next;
};
struct Table /*the workbannch of the algorithm*/
{
int cost;
int Known;
char vertex[3];
char path[3];
struct Table *next;
};
int Dijkstra(struct Point *struct Table *);
int PrintTable(intstruct Table *);
int PrintPath(intstruct Table *struct Table *);
struct Table * CreateTable(intint);
struct Point * FindSmallest(struct Table *struct Point *);/*Find the vertex which has the smallest value reside in the table*/
int main()
{
int ijnumtempval;
char c;
struct Point *poinpre*poinhead*poin;
struct link *linpre*linhead*lin;
struct Table *tabhead;
poinpre=poinhead=poin=(struct Point *)malloc(sizeof(struct Point));
poin->next=NULL;
poin->work=NULL;
restart:
printf(“Notice:if you wanna to input a vertexyou must use the format of number!\n“);
printf(“Please input the number of points:\n“);
scanf(“%d“&num);
if(num>maxver||num<1||num%1!=0)
{
printf(“\nNumber of points exception!“);
goto restart;
}
for(i=0;i {
printf(“Please input the points next to point %dend with 0:\n“i+1);
poin=(struct Point *)malloc(sizeof(struct Point));
poinpre->next=poin;
poin->vertex[0]=‘v‘;
poin->vertex[1]=‘0‘+i+1;
poin->vertex[2]=‘\0‘;
linpre=lin=poin->work;
linpre->next=NULL;
for(j=0;j {
printf(“The number of the %d th vertex linked to vertex %d:“j+1i+1);
scanf(“%d“&temp);
if(temp==0)
{
lin->next=NULL;
break;
}
else
{
lin=(struct link *)malloc(sizeof(struct link));
linpre->next=lin;
lin->vertex[0]=‘v‘;
lin->vertex[1]=‘0‘+temp;
lin->vertex[2]=‘\0‘;
printf(“Please input the value betwixt %d th point towards %d th point:“i+1temp);
scanf(“%d“&val);
lin->value=val;
linpre=linpre->next;
lin->next=NULL;
}
}
poinpre=poinpre->next;
poin->next=NULL;
}
printf(“Please
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-07-06 18:41 Dijkstra example\
目录 0 2013-07-06 18:38 Dijkstra example\Dijkstra1\
文件 7503 2013-07-06 16:40 Dijkstra example\Dijkstra1\aa.cpp
文件 4280 2013-07-06 18:30 Dijkstra example\Dijkstra1\addasf.dsp
文件 535 2013-07-06 16:39 Dijkstra example\Dijkstra1\addasf.dsw
文件 33792 2013-07-06 18:30 Dijkstra example\Dijkstra1\addasf.ncb
文件 48640 2013-07-06 18:30 Dijkstra example\Dijkstra1\addasf.opt
文件 1478 2013-07-06 16:40 Dijkstra example\Dijkstra1\addasf.plg
目录 0 2013-07-06 18:38 Dijkstra example\Dijkstra1\Debug\
文件 9550 2013-07-06 16:40 Dijkstra example\Dijkstra1\Debug\aa.obj
文件 167979 2013-07-06 16:40 Dijkstra example\Dijkstra1\Debug\addasf.exe
文件 172548 2013-07-06 16:40 Dijkstra example\Dijkstra1\Debug\addasf.ilk
文件 214100 2013-07-06 16:40 Dijkstra example\Dijkstra1\Debug\addasf.pch
文件 336896 2013-07-06 16:40 Dijkstra example\Dijkstra1\Debug\addasf.pdb
文件 33792 2013-07-06 16:42 Dijkstra example\Dijkstra1\Debug\vc60.idb
文件 45056 2013-07-06 16:40 Dijkstra example\Dijkstra1\Debug\vc60.pdb
目录 0 2013-07-06 18:40 Dijkstra example\Dijkstra2\
目录 0 2013-07-06 18:40 Dijkstra example\Dijkstra2\源代码\
目录 0 2013-07-06 18:40 Dijkstra example\Dijkstra2\源代码\Debug\
文件 66560 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.bsc
文件 192591 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.exe
文件 254264 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.ilk
文件 10996 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.obj
文件 242232 2013-07-06 18:12 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.pch
文件 517120 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.pdb
文件 0 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\ShortPath.sbr
文件 41984 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\vc60.idb
文件 61440 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\Debug\vc60.pdb
文件 2689 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\ShortPath.cpp
文件 3441 2013-07-06 18:37 Dijkstra example\Dijkstra2\源代码\ShortPath.dsp
文件 541 2005-06-09 17:16 Dijkstra example\Dijkstra2\源代码\ShortPath.dsw
............此处省略22个文件信息
- 上一篇:自动推箱子 C++源代码
- 下一篇:C++《网上书店管理系统》
相关资源
- 铰链四杆机构运动仿真编程(vc6.0)
- 计算机网络编程vc++学生管理系统
- 命名管道 vc
- Dijkstra最短路径算法C语言实现
- DLT645-97/07报文解释器VC源码
- dijkstra算法C++实现
- 声卡数据采集播放演示源程序vc.zip
- 向量类的设计与实现 VC++6.0
- RSA加解密源码VC++实现
- pop3协议的摆渡木马演示程序
- mfc实现画图板源码+实验报告
- php_xdebug-2.1.0-5.3-vc6.dll
- 酒店管理系统源码完整版C++
- DAA算法 VC++实现 画线
- 行李寄存管理软件绿色版.
- 优秀开源项目基于VC++和MFC基于VC++和
- 基于vc++的波形显示源码
- VC++软键盘源码和QQ软键盘差不多哦
- QML_MVC_Demo
- VC++制作程序安装向导完整源码实现
- 简易的VC++点对点文件传输
- MFC实现计算器 vC++
- VC使用GDI+将BMP图像转换为JPG格式
- VC++工资管理系统
- VC++点阵字生成器(MFC)
- VC6 实现FFT 显示频谱
- 40G郁金香VC++游戏辅助制作视频教程如
- 图像处理连通域算法 c++ vc 6.0
- 防火墙C++源码,测试可以运行
- vc++简易图形编辑器MFC
评论
共有 条评论