1 Chapter 15 Graphs, Trees, and Networks. 2 Chap.15 15.1 Undirected Graphs 15.2 Directed Graphs 15.3 Trees 15.4 Networks 15.5 Graph Algorithms 15.5.1.

Slides:



Advertisements
Similar presentations
EXAMPLE: X Y Z T 5 VERTICES 6 EDGES S Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet.
Advertisements

第二章 研究主題(研究題 目)與研究問題.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Chapter 10 馬可夫鏈 緒言 如果讀者仔細觀察日常生活中所發生的 諸多事件,必然會發現有些事件的未來 發展或演變與該事件現階段的狀況全然 無關,這種事件稱為獨立試行過程 (process of independent trials) ;而另一些 事件則會受到該事件現階段的狀況影響。
1 Chemical and Engineering Thermodynamics Chapter 2 Conservation of mass and energy Sandler.
: A-Sequence 星級 : ★★☆☆☆ 題組: Online-judge.uva.es PROBLEM SET Volume CIX 題號: Problem D : A-Sequence 解題者:薛祖淵 解題日期: 2006 年 2 月 21 日 題意:一開始先輸入一個.
第九章 如何寫結果 HOW to Write the Results CONTENT OF THE RESULTS 結果的內容 – 1. 將實驗大致的描述 並不需要重複實驗細節 2. 呈現數據 並以過去時態重現 3. 在文稿裡應呈現 ” 代表數據 ” 而不是一再的重 複資料.
第二章 太陽能電池的基本原理 及其結構 2-1 太陽能電池的基本原理 2-2 太陽能電池的基本結構 2-3 太陽能電池的製作.
Advanced Chemical Engineering Thermodynamics
校園線上技術服務之使用意圖與 建置成功因素的研究 2011/04/22 淡江大學 資管所碩二 李依倫 鄭佳容.
教育部主辦 九十八學年度大學校院 積體電路電腦輔助設計軟體製作競賽 指導老師:劉一宇 老師 專題學生:葉俊逸.
: Factstone Benchmark ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: : Factstone Benchmark 解題者:鐘緯駿 解題日期: 2006 年 06 月 06 日 題意: 假設 1960.
Chapter 0 Computer Science (CS) 計算機概論 教學目標 瞭解現代電腦系統之發展歷程 瞭解電腦之元件、功能及組織架構 瞭解電腦如何表示資料及其處理方式 學習運用電腦來解決問題 認知成為一位電子資訊人才所需之基本條 件 認知進階電子資訊之相關領域.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
全球化環境下的組織管理 本章內容 全球化的趨勢 國際化的階段 國際企業母公司對分支機構的管理取向 國際企業組織的結構設計 Chapter 6
©Ming-chi Chen 社會統計 Page.1 社會統計 第十講 相關與共變. ©Ming-chi Chen 社會統計 Page.2 Covariance, 共變量 當 X, Y 兩隨機變數不互為獨立時,表示 兩者間有關連。其關連的形式有很多種, 最常見的關連為線性的共變關係。 隨機變數 X,Y.
Graph V(G 1 )={0, 1, 2, 3, 4, 5, 6, 7, 8, 9} E(G 1 )={(0, 2), (0, 3), (1, 4), (2, 3), (2, 5), (2, 6), (3, 6), (3, 7), (4, 7), (5, 6), (5,
: OPENING DOORS ? 題組: Problem Set Archive with Online Judge 題號: 10606: OPENING DOORS 解題者:侯沛彣 解題日期: 2006 年 6 月 11 日 題意: - 某間學校有 N 個學生,每個學生都有自己的衣物櫃.
Chapter 2 聯立線性方程式與矩陣 緒言 線性方程式組 (systems of linear equations) 出現 在多數線性模式 (linear model) 中。根據以往解 題的經驗,讀者們也許已發現方程式的解僅與 該方程式的係數有關,求解的過程也僅與係數 的運算有關,只要係數間的相關位置不改變,
資料庫名稱 中國期刊全文資料庫 (China Journal Full-text Database)
Variables & Hypotheses
JAVA 程式設計與資料結構 第十四章 Linked List. Introduction Linked List 的結構就是將物件排成一列, 有點像是 Array ,但是我們卻無法直接經 由 index 得到其中的物件 在 Linked List 中,每一個點我們稱之為 node ,第一個 node.
STAT0_corr1 二變數的相關性  變數之間的關係是統計研究上的一大目標  討論二分類變數的相關性,以列聯表來表示  討論二連續隨機變數時,可以作 x-y 散佈圖觀察它 們的關係強度  以相關係數來代表二者關係的強度.
MATLAB 程式設計 第 11 章 多維陣列 多維陣列的定義 在 MATLAB 的資料型態中,向量可視為 一維陣列,矩陣可視二維陣列,對於維 度 (Dimensions) 超過 1 的陣列則均可視 為「多維陣列」 (Multidimesional Arrays , 簡稱 N-D Arrays)
Graph Theory Graph theory is the study of the properties of graph structures. It provides us with a language with which to talk about graphs.
JAVA 程式設計與資料結構 第十章 GUI Introdution III. File Chooser  File Chooser 是一個選擇檔案的圖形介面, 無論我們是要存檔還是要開啟檔案,使 用這個物件都會讓我們覺得容易且舒適。
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
:Problem D: Bit-wise Sequence ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10232: Problem D: Bit-wise Sequence 解題者:李濟宇 解題日期: 2006 年 4 月 16.
FGU LDT. FGU EIS 96 ‧ 8 ‧ 25 FGU LDT 佛光大學學習與數位科技學系.
Chapter 1 序論 Introduction. 2/15 Contents 1.1. 工程分析 Engineering Analysis 1.2. 教學目標與方法 Objectives and Approaches.
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
第三部分:研究設計 ( 二): 研究工具的信效度 與研究效度 (第九章之第 306 頁 -308 頁;第四章)
CS1103 電機資訊工程實習 Department of Computer Science National Tsing Hua University.
Chapter 20 塑模動態觀點:狀態圖 Statechart Diagram. 學習目標  說明狀態圖的目的  定義狀態圖的基本記號  展示狀態圖的建構  定義活動、內部事件及遞延事件的狀態 圖記號.
行政院國家科學委員會工程技術發展處自動化學門 * 試以國立成功大學製造工程研究所 鄭芳田教授 產學合作計畫 : 智慧預測保養系統之設計與實作 成果報告盤點為範例 國科會工程處專題計畫成果典藏 自動化學門成果報告盤點範例.
Johnson’s algorithm Johnson’s演算法可用於計算All pairs shortest path問題。
自動機 (Automata) Time: 1:10~2:00 Monday: practice exercise, quiz 2:10~4:00 Wednesday: lecture Textbook: (new!) An Introduction to Formal Languages and Automata,
: Ahoy, Pirates! ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11402: Ahoy, Pirates! 解題者:李重儀 解題日期: 2008 年 8 月 26 日 題意:有一個海盜島有 N 個海盜,他們的編號 (id)
1 第六章 Blog 網誌 網誌已是 Web2.0 的最新指標. 2 教學目標  了解 Blog 的意義  了解 Blog 的功用  了解 RSS  能註冊 Blog 並加以使用.
鄭瑞興的個人簡介 中山資工所 鄭瑞興.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
Chapter 3 Entropy : An Additional Balance Equation
A Search Procedure for Hamilton Paths and Circuits Frank Rubin JACM, Vol. 21, No. 4, pp , Oct
Optimization And Differential Equations 最佳化與微分方程 Peng-Jen Lai ( 賴鵬仁 ) Department of Mathematics National Kaohsiung Normal University ( 高雄師範大學數學系 ) ( 高雄師範大學數學系.
概念性產品企劃書 呂學儒 李政翰.
技術與流程 本章內容 組織的技術 製造業的核心技術 服務業的核心技術 非核心技術與組織管理 工作流程的相依性 Chapter 8
ArcINFO &Geodatabase 由 ESRI 產生 1970 ArcINFO 一開始被設計在迷你電 腦上, 後來逐漸發展, 在 UNIX 系統上也能 執行, 直到今天, 已經可以在不同的平台上 運作.
連續隨機變數 連續變數:時間、分數、重量、……
:Commandos ★★★☆☆ 題組: Contest Archive with Online Judge 題號: 11463: Commandos 解題者:李重儀 解題日期: 2008 年 8 月 11 日 題意: 題目會給你一個敵營區內總共的建築物數,以及建築物 之間可以互通的路有哪些,並給你起點的建築物和終點.
結束 第三章 認識電腦軟體 本章重點 3-1 系統軟體 系統軟體 3-2 應用軟體 應用軟體 3-3 程式語言簡介 程式語言簡介.
電機工程系 選課輔導說明會. 選課輔導說明會宗旨 電機系自 95 年開始,同步進行『工程教育 認證』以及『系科本位課程』兩大與學生 課程相關的認證計畫。 電機系自 95 年開始,同步進行『工程教育 認證』以及『系科本位課程』兩大與學生 課程相關的認證計畫。 本系每年至少一次的系教育諮詢委員會, 廣邀產業界、學界、家長、畢業生、在校.
Microsoft Excel.
:Rings and Glue ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10301: Rings and Glue 解題者:施博修 解題日期: 2011 年 5 月 18 日 題意:小約翰有了個大麻煩,他不小心將 rings.
Mapping - 1 Mapping From ER Model to Relational DB.
1 Chemical and Engineering Thermodynamics Chapter 1 Introduction Sandler.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Graph Theory Chapter 7 Eulerian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Graph Theory Chapter 6 Matchings and Factorizations 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Introduction to DNA Computing Introducer: 黃宏偉 Adviser: 楊昌彪 教授.
Chapter 12 Abstract Data Type. Understand the concept of an abstract data type (ADT). Understand the concept of a linear list as well as its operations.
6.1.3 Graph representation.
Spanning Trees Alyce Brady CS 510: Computer Algorithms.
Minimum Spanning Tree Chapter 13.6.
Chapter 10 Independence, Dominance, and Matchings
6.1.3 Graph representation.
Presentation transcript:

1 Chapter 15 Graphs, Trees, and Networks

2 Chap Undirected Graphs 15.2 Directed Graphs 15.3 Trees 15.4 Networks 15.5 Graph Algorithms Iterators Generating a Minimum Spanning Tree Finding the Shortest Path

3 Chap.15 (Cont.) 15.6 Network Class ( 軟體開發三道工序 ): Method Specifications Data Structure Design Method Definitions

4 Graph theory 圖論 [Wiki] In mathematics and computer science, graph theory is the study of graphs, mathematical structures used to model pair-wise relations between objects from a certain collection. ( 研究 某 collection 內 objects 的兩兩關係 )

5 Applications of Graphs 許多實際問題可用 graph 來表示 例如:網址連結的結構,可用有向圖 (directed graph) 頂點 (vertex) 是網頁網址,如果有一個 B 網址的網頁連 結到 A 網址的網頁 ,便有個連結 (edge) 在網址 A,B 之間 類似的 在 travel 問題,生物學,電腦晶片設計,以及 其他許多領域。 Graph 可增加 weight ( 權重 ) 延伸為 weighted graph ( 加權圖 ) 例如 weight 能代表連結 (edge) 的長度

Undirected Graphs

7 Example: X Y Z T ANS: 5 vertices 6 edges S

8 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet

9

10

11

12 X Y Z T X, Y, T, Z, S has length 4. Shortest path from X to S = ? Ans: 2 S In general, how can the smallest path between 2 vertices be determined? We will cover that.

13

14 X Y Z T X, Y, T, Z, X is a cycle. Y, T, S, Z, T, Y is not a cycle. (repeated edges: YT and TY) S Is Y, Z, T, S, Z, X, Y a cycle? Yes!

15 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet This undirected graph is acyclic.

16

17

Directed Graphs

19

20

21

22

23

Trees

25 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet

Networks

27

28

29

30

31

32 Semantic Network A vertex is related to another by some semantics, but not vise versa. For example, Taipei is a city of Taiwan. And, both Taiwan and Japan are countries of Asia. Taipei Taiwan cityOf AsiaJapan countryOf

Graph Algorithms

Iterators

35

36 x v Y Z T S Assume the vertices are entered in alphabetical order. Perform a breadth-first iteration from S. Ans: S, T, Z, Y, V, X

37

38

39

40

41 X V Y Z T S

42 Assume the edges are inserted into the graph as follows: S, T (Same as T, S) S, Z T, Y T, Z V, X V, Z X, Y X, Z Perform a breadth-first iteration from S.

43 queueVertex returned by next( ) S T, ZS Z, YT Y, V, XZ V, XY XV X enqueue dequeue

44

45

46

47 For a breadth-first iteration of a directed graph, the algorithm is the same, but “neighbor” takes into account the direction of the arrow. A B C D Starting at A, the neighbors of A are B and C, but not D. D NEVER gets enqueued, and never gets returned by next( ).

48

49 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet

50

51 A Stack!

52 X V Y Z T S

53 Assume the edges are inserted into the graph as follows: S, T // Same as T, S S, Z T, Y T, Z V, X V, Z X, Y X, Z Perform a depth-first iteration from S.

54 StackVertex returned by next( ) S Z, T S X, V, TZ Y, V, TX V, TY T V T Top Bottom

55

56

57

Generating a Minimum Spanning Tree

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

Finding the Shortest Path

78 Shortest Path from A to B C 7 2 A 10 B 1. start with A. check A’s neighbors. save in priority queue (pq): ; 2. remove. check C’s neighbors. we found is shorter than 1. replace B’s weight sum with 9 2. insert to pq 3. make C the predecessor of B now, pq: 3. remove we got B. DONE!

79

80

81

82

83

84

85

86

87

88

89

90

91

A Network Class

93

94

Method Specifications of the Network Class

96

97

98

99

100

101

102

103

104

105

106

A TreeMap This is called “neighborMap”.

keyvalue keyvalue

116 For example, in the outer treeMap key “karen” has the neighborMap below as its value: (mark, 10.0) (w1, weight1) (don, 7.4) (w2, weight2) (courtney, 14.2) (w3, weight3) This neighborMap is by itself another inner treeMap as below: key value Don (7.4) Courtney (14.2) Mark (10.0)