[工学]数据结构Chapter7 Graph.ppt

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

Chap7 Graph Overview Graph Implementation of Graph Graph’s Traversal Graph’s Connectivity Minimum Spanning Tree Shortest Path DAG (Directed Acyclic Graph and its Application) Graph A tree is a hierarchical structure that consists of nodes emanating from a root. The nodes are connected by pointers that link a parent to its children. In this section, we introduce a graph, which is a generalized hierarchical structure. A graph is composed of a set of data items called vertices and a set of edges that connect pairs of vertices. Graph A graph G=(V, E) consists of a set of vertices, V, and a set of edges, E. Each edge is a pair (v, w), where v,w∈V. Edges are sometimes referred to as arcs. If the pair is ordered, then the graph is directed. Directed graphs are sometimes referred to as digraphs. Figure7.1 Directed Graph Vertices V={A, B, C, D, E} Edges E={(A,C), (A,D), (B,A), (B,D), (D,E),(E,B)} Figure7.2 Undirected Graph Vertices V={A, B, C, D, E} Edges E={(A,B), (A,C), (A,D), (B,A), (B,D),(B,E), (C,A), (D,A),(D,B),(D,E),(E,B),(E,D)} Graph Vertex w is adjacent to v if and only if (v,w) ∈E. In an undirected graph with edge(v,w), and hence (w,v), w is adjacent to v and v is adjacent to w. Sometimes an edge has a third component, known as either a weight or a cost. Graph In an undirected graph, if every pair of vertices are connected by an edge, then the graph is called undirected complete graph. The number of edges is N×(N-1)/2. In a directed graph, if every pair of vertices are connected by two opposite edges, then the graph is called directed complete graph. The number of edges is N×(N-1). Figure7.3 Undirected Complete Graph Figure7.4 Directed Complete Graph Graph A path in a graph is a sequence of vertices w1, w2, w3, …, wN such that (wi, wi+1) ∈E for 1≤i<N. The length of such a path is the number of edges on the path, which is equal to N-1. We allow a path from a vertex to itself; If this path contains no edges, then the path length is 0. Gra

文档评论(0)

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

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

1亿VIP精品文档

相关文档