全球旧事资料 分类
精品文档
测绘软件设计与实现
2011年11月15日
可编辑
f精品文档
目录
实验一图的创建、遍历及其MST的构建3实验二快速排序算法的实现12实验三矩阵类的设计与实现15实验四Wi
dows绘图25实验五面向对象的高程网平差程序设计与实现32
可编辑
f精品文档
实验一图的创建、遍历及其MST的构建
一、实验目的
通过上机实践,进一步了解图的创建、遍历及其MST的构建,巩固所学课
本知识。
二、实验过程
i
cludestdioh
MGraph
i
cludeiostreamh
typedefstructANode
i
cludemalloch

defi
eINF32767
i
tadjvex
defi
eMAXV100
structANode
extarc
typedefi
tI
foType
I
foTypei
fo
typedefstruct
ArcNode

typedefi
tVertex
i
t
o
typedefstructV
ode
I
foTypei
fo

VertexType
Vertexdata
typedefstruct
ArcNodefirstarc

VNode
i
tedgesMAXVMAXV
typedef
VNode
i
t
e
AdjListMAXV
VertexTypevexsMAXV
typedefstruct
可编辑
f精品文档
AdjListadjlist
i
t
e
p
extarcGadjlistifirsta
ALGraph
rc
void
MatToListMGraph
gALGraphG
Gadjlistifirstarcp


i
tij
g

G

ArcNodep
Gege
GALGraph

mallocsizeofALGraph
void
ListToMatALGraph
fori0i
i
GMGraphg

GadjlistifirstarcNULL
i
tij
G

fori0i
i
ArcNodep
forj
1j0j
fori0i
i
ifgedgesij0
forj0j
j

gedgesij0
pArcNode
fori0i
i
mallocsizeofArcNode

padjvexj
pGadjlistifirstarc
pi
fogedgesij
whilepNULL
可编辑
f精品文档

gedgesipadjvexpi
fo
pp
extarcg
geGevoidDispMatMGraphgi
tiji
tzz99fori0ig
iforj0jg
j
ifgedgesijINFpri
tf
好听全球资料 返回顶部