十一 图 (ying) 幻灯片.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
十一 图 (ying) 幻灯片

GRAPHS INTRODUCTION A graph is another important non-linear data structure, there is a hierarchical relationship between parent and children.i.e.,one parent and many children. A tree is a special kind of a graph. In a graph, the relationship is less restricted, i.e., the relationship is from many parents to many children. A graph G consists of a set V, whose members are called the vertices of G, together with a set E of pairs of distinct vertices from V. these pairs are called the edges of the graph G. if e=(v,w) is an edge with vertices v and w, then v and w are said to lie on e and e is said to be incident with v and w. If the pairs of vertices are ordered then G is called a directed graph, If the pairs of vertices are unordered then G is called a undirected graph. 7.1 图的基本概念 2.图的相关概念 (degree of a vertex)顶点的度:顶点的度(degree)是指和该顶点相关联的边的数目,通常记为D (v)。 在有向图中,将从该顶点出发的弧的数目称为该顶点的出度(out degree),用OD(v)表示;对应的,将以该顶点结束的弧的数目称为该顶点的入度(in degree),用ID(v)表示;有向图顶点的度为出度和入度之和: D (v)=ID (v)+OD(v)。 网络:若图的每条边(弧)都被赋予了具体含义,这种与图的边(弧) 相关的数据称为权,称这样的图为加权图或网络。 (path)路径:在无向图中,若存在一个顶点序列vi,vi1,vi2,…,vim,vj,使得(vi,vi1),(vi1,vi2),…,(vim,vj)均属于E(G),则称顶点vi到vj 存在一条路径。对于有向图,路径由弧组成, 即vi,vi1,vi1,vi2,…,vim,vj 均属于E(G)。 (cycle)回路:假设从vi到vj存在一条路径,且vi=vj,则称该路径为回路。顶点不重复出现的路径称为简单路径。 (sub-graph)子图:设G(V,E),G’(V’,E’)是两个图,假设V’?V且E’?E,称G’为G的子图。当满足V’=V且E’?E,称G’为G的生成子图。 连通、强连通 若从顶点vi到顶点vj(i≠j)之间有路径存在,则称该两个顶点是连通的。 对于无向图,其中任意两顶点都是连通的,则称该无向图是连通图(connected graph)。无向图中的极大连通子图称为连通分量。 在有向图中,若任意两个顶点vi和vj都连通,则称该有向图为强连通图(strongly connected graph)。有向图的极大强连通子图称为强连通分量。 7.2 图的存储表示—邻接矩阵(matrix representation)、 邻接表(linked representation)等 邻接矩阵的说明: ① 无向图的邻接矩阵是一个对称矩阵。 ② 无向图邻接矩阵第i行(或第i列)中非零元素的个数表示第i个顶点的度。 ③ 有向图邻接矩阵第i行(或第i列)中非零元素的个数表示第i个顶点的出度(或入度)。 ④ 用邻接矩阵方法存储图,很容易确定图中任意两个顶点之间的邻接关系。 typedef char Vextype; typedef struct { Vextype vexs[VEX_NUM]; int adj[MAXSIZE][MAXSIZE]; /*邻接矩阵*/ int n,e; /*顶点数和边数*/ }M

文档评论(0)

skvdnd51 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档