data_CHAP06 - 55 55 55 6 à à à   999  5 55 55 5 5...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: / / / 55 55 55 6 à à à   999  / / / / / / 5 55 55 5 5 ú é        / / / / / 555 555 555 555 55 6 /  0 ú / / / / 5 5 5 k / / 5 5 5 5 5 6 / [ / /  6 / Data Structures / /   U By Hyun-Ju Park / Hanbat National University 7 9 / / / 555 555 55 / 6 / / / 55 55 66  6  7 / / / / / 55 5 55 5 66  ›  à 89 6  à 999 ê ú È  86 6 / Data Structures / / / / / / / / 555 555 555 55 66 / 66 ù   By Hyun-Ju Park / Hanbat National University 555 55 /   6.1.1 }       ,PFOJHTCFSH ª  C c d g c C g d A a B f Euler’s Graph b f e D A Kneiphof Kneiphof D e a B b / / Data Structures By Hyun-Ju Park / Hanbat National University /  1736 − Euler  ÷ Koenigsberg  ú(vertex)ó›   §  (edge)ó› ú ¿  ` ¿ úó› ú ú \$ ›(Eulerian walk) › , ` , , ·  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.1.2 , G = ( V , E) V: E:  ú È, G G ú(vertex) (edge) ú    ñ  V(G) : E(G) : (undirected graph) (u, v) = (v, u) (directed graph) <u, v> ≠ <v, u> ú − È <u, v> u:  (tail), v :  (head) / / Data Structures By Hyun-Ju Park / Hanbat National University / 6      } ª  0 0 0 1 2 1 2 1 3 G1 3 4 G2 5 6 2 G3 V(G1) = { 0, 1, 2, 3 } E(G1) = { (0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3) } V(G2) = { 0, 1, 2, 3, 4, 5, 6 } E(G2) = { (0, 1), (0, 2), (1, 3), (1, 4), (2, 5), (2, 6) } V(G3) = { 0, 1, 2 } E(G3) = { <0, 1>, <1, 0>, <1, 2> } / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  ú ø ó ø ó› (self edge)   \    (multigraph)     ] 1 a ª ]  0 0 1 1 2 2 3 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  (Complete graph) − n[ ú n(n – 1)/2[  −  n[  ú n(n – 1)[   }   ª ]  0 1 2 3 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  {  (u, v) − − <u, v> − − E(G) ú ÷| (adjacent) ú ué v ÷| ú ué v o (incident) o (incident) ué v\ (u, v)\ E(G) u adjacent to v and v adjacent from u <u, v>\ / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  G  V(G’) ⊆ V(G)   (Subgraph), G’ E(G’) ⊆ E(G)      ª  0 0 0 1 2 0 1 2 1 2 3 1 2 3 3 0 0 0 0 0 1 1 1 1 2 2 2 / / Data Structures By Hyun-Ju Park / Hanbat National University /   (degree) ú  − v : − v : − n[  v  v  ú, e[   / (in-degree) (in-degree) \ G úi § d i“ e = (1 / 2)∑ d i i =1 n (Path) (u, i1), (i1, i2), …, (ik, v) ik, v › − $ › › (simple path) − › (cycle) − ô  ú › ô  û  ú E(G) ÷ | G ú u› v ›\ ú  u, i1, i2, …, / / Data Structures By Hyun-Ju Park / Hanbat National University /  ú ué v − u› (connected graph), G  v › › ú u, v   È u v ›  | “ V(G)  −  −  (connected component)  \     } o  W ª ]  G4 0 4 1 2 5 6 3 7 / / Data Structures By Hyun-Ju Park / Hanbat National University /  V(G) › (strongly connected graph) ú u, v  È u v›, v u› ›    (strongly connected component)     vV o ª ]  b o  0 2 1 G3 / / Data Structures By Hyun-Ju Park / Hanbat National University /    _  structure Graph objects: functions:  graph     ª  ú  Vertices  ó› ó ú È Graph, v, v1, v2 Graph Create() Graph InsertVertex(graph, v) Graph InsertEdge(graph, v1, v2) Graph DeleteVertex(graph, v) Graph DeleteEdge(graph, v1, v2) Boolean IsEmpty(graph) List Adjacent(graph, v) ::= return `  v2  o  ô  ::= return v§ v\ ::= return v1 ::= return vé v ûo ::= return (v1, v2) L ó ûo  ›s ::= if (graph == empty graph) return TRUE else return FALSE ::= return v ú  ú  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.1.3 6.1.3.1   û  (adjacency matrices)    ª ]  0 0 1 2 1 2 3 0 0 1 1 1 123 1 1 1 0 1 1 1 0 1 1 1 0 3 0 1 0 0 0 1 1 2 0 12 1 0 0 1 0 0 2 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  = n2 ú −  ˜ó ã (symmetric) Nontrivial questions G − \ O(n2) O(n + e) ã !! \? / G   \? / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.1.3.2 û n ú   [ ns    % ª  #define MAX_VERTICES 50 /* ú typedef struct node *node_ptr; typdef struct node { int vertex; node_ptr link; }; node_ptr graph[MAX_VERTICES]; int n = 0; /*   ú */ */ / / Data Structures By Hyun-Ju Park / Hanbat National University / 6      ª  _  0 1 2 3 L 0 1 2 3 ú 1 0 0 0 2 2 1 1 3 3 3 2 null null null null / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  0 2 1 L 0 1 2 null ú 1 0 null 2 null / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  0 L 1 2 0 1 3 2 3 4 4 5 5 6 6 7 7 ú 1 0 0 0 5 4 5 6 null null 6 7 null null 2 3 3 2 null null null null / / Data Structures By Hyun-Ju Park / Hanbat National University /  = n[ = n[ L + 2e[ L + e[   L L Nontrivial questions O(n + e)  § ? / / Data Structures By Hyun-Ju Park / Hanbat National University /  % (inverse adjacency list) ú   `     , L ó ú ª ú ]   ú L › 0 2 1 L 0 1 2 ú 1 0 1 null null null / / Data Structures By Hyun-Ju Park / Hanbat National University /           à  G  ª ] ]     tail tail head 0 head d column link 1 0 1 0 tail d row link 2 T 0 1 2 0 1 0 0 0 1 2 0 0 / / Data Structures By Hyun-Ju Park / Hanbat National University /      à   § H ª ]  L 0 1 2 3 / / Data Structures     0 1 2 3 ú 3 2 3 2 1 0 0 1 2 3 1 0 null null null null By Hyun-Ju Park / Hanbat National University / 6  6.1.3.3 û     s   ª % ] ]          marked marked vertex1 vertex2 path1 path2 typedef struct edge *edge_ptr; typedef struct edge { short int marked; int vertex1; int vertex2; edge_ptr path1; edge_ptr path2; }; edge_ptr graph[MAX_VERTICES]; / / Data Structures By Hyun-Ju Park / Hanbat National University / 6       ª  L 0 1 0 2 3 1 2 N1 N2 N3 N4 N5 N6 3 0 0 0 1 1 2 1 2 3 2 3 3 N2 N3 N4 N4 (0, 1) (0, 2) (0, 3) (1, 2) (1, 3) (2, 3) null N5 N5 N6 null N6 null null  : ú0: ú1: ú2: ú3: N1 → N2 → N3 N1 → N4 → N5 N2 → N4 → N6 N3 → N5 → N6 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6   ú v 0    \  ú (depth first search; DFS) (breadth first search; BFS) / / Data Structures By Hyun-Ju Park / Hanbat National University / 6       ª   v0 v1 v2 v3 v4 v5 v6 L 0 1 2 3 4 5 6 7 ú 1 0 0 1 1 2 2 3 2 3 5 7 7 7 7 4 null null null null 5 6 null null 4 6 null null v7 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.2.1 ˜ ø v v  úv ú ú   ó úó›   ú ó ó ú úw  ó w§ øúó› 0   | ø,  ú ú  o ø úu û÷ `  ú úó› `  è“ ú w› ú w§ / / Data Structures By Hyun-Ju Park / Hanbat National University / 6      ˜ª  v0 v1 v3 v4 v5 v2 v6 v7 #define FALSE 0 #define TRUE 1 short int visited[MAX_VERTICES]; void dfs(int v) { /* ú v ø \0  node_pointer w; visited[v] = TRUE; printf("%5d", v); for (w = graph[v]; w; w = w->link) if (!visited[w->vertex]) dfs(w->vertex); } */  ú − ú ú˜ − v  ú ã ú ú n[ O(n) O(n2)  L 1 (2e[) O(e) / / Data Structures By Hyun-Ju Park / Hanbat National University /  6.2.2 ˜ ø v úv ú ú   ú  ó ú ú     c  ª ] typedef struct queue *queue_pointer; typedef struct queue { int vertex; queue_pointer link; }; void addq(queue_pointer *, queue_pointer *, int); int deleteq(queue_pointer *); / / Data Structures By Hyun-Ju Park / Hanbat National University /    _    ˜ª  v0 v1 v3 v4 v5 v2 v6 v7 void bfs(int v) /* ú v ø \  . À visited\ 0ó› { node_pointer w; queue_pointer front, rear; front = rear = NULL; /* */ printf("%5d", v); visited[v] = TRUE; addq(&front, &rear, v); while (front) { v = deleteq(&front); for (w = graph[v]; w; w = w->link) if (!visited[w->vertex]) { printf("%5d", w->vertex); addq(&front, &rear, w->vertex); visited[w->vertex] = TRUE; } } } */ / / Data Structures By Hyun-Ju Park / Hanbat National University /   while  \ n ú −  ú ú˜ − O(n2)  ú while   = O(n) while   = di  di = degree(vi) d0 + d1 + dn-1 = O(e) / / Data Structures By Hyun-Ju Park / Hanbat National University /  6.2.3 o   ! o  ú \ à  bfs(0)` dfs(0)§   ó (connected component)   bfs(v)` dfs(v)§    ú v§   _    o ª  v0 v1 v3 v4 v5 v2 v6 v7 void connected(void) { /*  */ int i; for (i = 0; i < n; i++) if (!visited[i]) { dfs(i); printf("\n"); } } / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.2.4 % G  (spanning trees) ›  G     ú o  ª ]  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  G 0 −  −   DFS  BFS        , DFS BFS (depth first spanning tree)  G  (breadth first spanning tree)      CGT ª ]     EGT 0 0 1 2 1 6 2 3 4 5 3 4 5 6 7 dfs dfs(0)   bfs(0) 7   / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  % 1  \  %    ¡ G  (minimal subgraph) G’› V(G’) = V(G) G’ó    o |E(G’)| = n – 1 where |V(G)| = n / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.2.5 o −   ú   ú û \  r[  § b \ ú ú (articulation point) (biconnected graph) = (biconnected component) =      o o  ª   0 8 9 0 8 9 1 7 1 1 7 7 7 2 3 5 2 3 3 5 5 4 6 4 6 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  % À − u (back edge), (u, v) v `` v u (cross edge) − −  À   0     ª  ]      0 4 3 2 2 4 1 8    0 1 0 3 5 5 3 6 6 4 0 9 1 7 8 8 9 9 8 7 7 2 2 6 7 9 8 1 4 5 6 3 5 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  dfn & low dfn(w) = 0  low(w) = min { dfn(w), min { low(x) | x is a child of w }, min { dfn(x) | (w, x) is a back edge } }      1   EGT EGO s MPX s ª ]  û dfn low 0 4 4 1 3 0 2 2 0 3 0 0 4 1 0 5 5 5 6 6 5 7 7 5 8 9 9 9 8 8 ,u r[ ø \    `` low(w) ≥ dfn(u)§  \ø w§  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6        c    EGO MPX    EGO MPX   o ª ]  _  o  _   _  #define MIN2(x, y) ((x) < (y) ? (x) : (y)) short int dfn[MAX_VERTICES]; short int low[MAX_VERTICES]; int num; void init(void) { int i; for(i = 0; i < n; i++) { visited[i] = FALSE; dfn[i] = low[i] = -1; } num = 0; } void dfnlow(int u, int v) { node_ptr ptr; int w; dfn[u] = low[u] = num++; for (ptr = graph[u]; ptr; ptr = ptr->link) { w = ptr->vertex; if(dfn[w] < 0) { dfnlow(w, u); low[u] = MIN2(low[u],low[w]); } else if (w != v) low[u] = MIN2(low[u], dfn[w]); } } / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  void bicon(int u, int v) { node_ptr ptr; int w, x, y; dfn[u] = low[u] = num++; for(ptr = graph[u];ptr; ptr = ptr->link) { w = ptr->vertex; if(v != w && dfn[w] < dfn[u]) add(&top, u, w); if(dfn[w] < 0) { bicon(w, u); low[u] = MIN2(low[u], low[w]); if(low[w] >= dfn[u]) { printf(“new biconnected component: “); do { delete(&top, &x, &y); printf(“ <%d,%d>“, x, y); } while(!((x == u) && (y == w))); printf(“\n”); } } else if (w != v) low[u] = MIN2(low[u], dfn[w]); } } / / Data Structures By Hyun-Ju Park / Hanbat National University / 6        − − − ã  \û  \      ã % \   b n – 1[ \ greedy method −  § › Kruskal à  Prim à  Sollin à  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6   ª  0 10 5 25 4 24 22 28 1 14 6 18 3 16 2 12 10 5 25 4 0 1 14 6 16 2 12 22 3 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.3.1 Kruskal  ó `  øó  ó› ó› T  ,    T§  \  ó T  T         ,SVTLBM     ,SVTLBM  b }ª ]  0 10 5 25 4 24 22 28 1 14 6 18 3 16 2 12 T = { }; while (T n – 1[   && E E  (v, w) ; E (v, w)§ û; if ((v, w) T  ô) (v, w)§ T ; else (v, w)§ ` ; } if (T n – 1[  ó ) printf("No spanning tree\n");  ô) { / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.3.2 Prim  à        1SJN     1SJN  b }ª ]  % 0 10 5 25 4 24 22 28 1 14 6 18 3 16 2 12 T = { }; TV = {0}; /* ú 0ó› ø. ó  ô.*/ while (T n – 1 ô) { u ∈TV v ∉ TV  (u, v)“ if (  ô) break; v§ TV ; (u, v)§ T ; } if (T n – 1  ô) printf("No spanning tree\n"); ; / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.3.3 Sollin   T  o øú o  \ [ ó n[   ` ú    §          1SJN     1SJN  b }ª ]  0 1 10 5 14 6 2 12 4 22 3 10 5 25 4 0 1 14 6 16 2 12 22 3 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66    × ä −  /  Dijkstra à  ÷ − BellmanFord à  / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.4.1 Dijkstra       9   ª  45 v0 10 20 v3 50 15 20 15 v4 3 v5 v1 35 30 10 v2 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  v0 S w : : : ¿ú › ú  ó w › › ú u› o \ “ v0 ø  u `° ›\ S \ ú  bo v0 ¿  S \ ú  ` w \ ›   ú  distance[w] = S ›\ $ ô − ( “ #39) v0 w S u w∈S − o ô ›\ › ›$ › › ú  distance[u]  úu ã úó S \  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  v0 − − u› \ ›§  \ › › ` ú u\ S  o | distance[u]\ v0 u§ ` w›  ó ú)  u§ `  ó › ó  u w› \ ›  ú( $ \ distance[u] + length(<u, w>) min{distance[w], distance[u] + cost[u][w]} − ( “ #40) S distance[w] v0 distance[u] u w cost[u][w] / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  n[ ú 0 n–1   À found − úi S  ó found[i] = FALSE § \  ú ˜› found[i] = TRUE cost[i][j]\ <i, j>        cª  #define MAX_VERTICES 6 int cost[MAX_VERTICES] = { { 0, 50, 10, 1000, 45, 1000}, {1000, 0, 15, 1000, 10, 1000}, { 20, 1000, 0, 15, 1000, 1000}, {1000, 20, 1000, 0, 35, 1000}, {1000, 1000, 30, 1000, 0, 1000}, {1000, 1000, 1000, 3, 1000, 0}}; int distance[MAX_VERTICES]; short int found[MAX_VERTICES]; int n = MAX_VERTICES; 45 v0 10 20 v3 50 15 20 15 v4 3 v5 v1 35 30 10 v2 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6         k w e  ýª ]    _      void shortestpath(int v, int cost[MAX_VERTICES], int distance, int n, short int found) { int i, u, w; for (i = 0; i < n; i++) { found[i] = FALSE; distance[i] = cost[v][i]; } found[v] = TRUE; distance[v] = 0; for (i = 0; i < n – 2; i++) { u = choose(distance, n, found); found[u] = TRUE; for (w = 0; w < n; w++) if (!found[w]) if (distance[u] + cost[u][w] < distance[w]) distance[w] = distance[u] + cost[u][w]; } } / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  int choose(int distance, int n, int found) {  ó ú  distance /*  int i, min, minpos; min = INT_MAX; minpos = -1; for (i = 0; i < n; i++) if (distance[i] < min && !found[i]) { min = distance[i]; minpos = i; } return minpos; } ô */  ú − ˜ G \  \ j O(n2) ù = O(n2) ›à  / / Data Structures By Hyun-Ju Park / Hanbat National University / 66    ª   ]  _    œ    œ  Chicago 3 1500 1000 Boston 4 250 5 New York 900 1700 7 New Orleans 1000 6 Miami  TIPSUFTUQBUI S San Francisco 1 300 0 Los Angeles 1200 800 1000 2 Denver 1400 0 1 2 3 4 5 6 7 0 0 300 1000 1 0 800 2 3 4 5 6 7 0 1200 0 1500 1000 0 250 0 1700 900 1400 0 1000 0 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  Distance S Vertex selected LA [0] -1 2 3 4 5 6 {4} {4,5} {4,5,6} {4,5,6,3} {4,5,6,3,7} {4,5,6,3,7,2} {4,5,6,3,7,2,1} ---5 6 3 7 2 1 +∞ +∞ +∞ +∞ 3350 3350 3350 SF [1] +∞ +∞ +∞ +∞ +∞ 3250 3250 DEN [2] +∞ +∞ +∞ 2450 2450 2450 2450 CHI [3] 1500 1250 1250 1250 1250 1250 1250 BOS T [4] 0 0 0 0 0 0 0 NY [5] 250 250 250 250 250 250 250 MIA [6] +∞ 1150 1150 1150 1150 1150 1150 NO [7] +∞ 1650 1650 1650 1650 1650 1650 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.4.2 BellmanFord  Dijkstra ô  $§ \      – w ª ]   5 7 -5 0 1 2 -2 1 1 0 1 2 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  BellmanFord − − − ô l[ $  \  \ u › $ distl[u] ¿ú v› distk[u] = min{ distk - 1[u], min{ distk-1[i] + length[i][u]}} distn-1[u]§  u  / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  #FMMNBO'PSE  ª  1 6 0 5 5 3 2 -2 -2 -1 4 3 6 -1 3 5 void BellmanFord(int n, int v) { int i, k; for (i = 0; i < n; i++) dist[i] = lengh[v][i]; for (k = 2; k <= n – 1; k++) { for (each u such that u != v and u has at least one incoming edge) for (each <i, u> in the graph) if (dist[u] > dist[i] + length[u][i]) dist[i] = dist[i] + length[i][u]; } } / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.4.3 i≠j °  vi vj n[  ÷ ¿ú/ n  ú û›  − shortestpath : O(n3) ‚\ O(n2logn + ne) n  − bellmanford : O(n4) ‚\ O(n2e) All-pairs à  / / Data Structures By Hyun-Ju Park / Hanbat National University / 6   ú ˜ (cost adjacency matrix) − − − − cost[i][j] = 0, where i = j cost[i][j] =∞, where <i, j> ∉ E(G), i ≠ j k i j› j§ \ ó j j› \ ›\ i k–1  i : k›, k Ak › › k›, k j§ j› j j j› \ › k ú \ ú ››  ú \ °   \  \ › ú    i j› \ ›  Ak [i][j] An-1 [i][j] A-1 [i][j] = cost[i][j] Ak-1 § − − i : i : Ak [i][j] = Ak-1 [i][j] k Ak [i][j] = Ak – 1 [i][k] + Ak – 1 [k][j] Ak [i][j] = min { Ak-1 [i][j], Ak – 1 [i][k] + Ak – 1 [k][j]}, k ≥ 0 A-1 [i][j] = cost[i][j] / / Data Structures By Hyun-Ju Park / Hanbat National University / 6         l    L    BMMDPTUTa ™ ª  6 0 11 2 3 2 4 A−1 0 1 1 0 2 2 0 0 1 2 0 6 4 11 3∞ A0 0 1 2 0 0 6 3 12 4 11 02 70 A1 0 00 16 23 12 4 11 02 70 A2 0 1 2 0 0 5 3 1 4 0 7 2 6 2 0 / / Data Structures By Hyun-Ju Park / Hanbat National University / 6       °    ª  void allcosts(int cost[MAX_VERTICES], int distance[MAX_VERTICES], int n) { int i, j, k; for (i = 0; i < n; i++) for (j = 0; j < n; j++) distance[i][j] = cost[i][j]; for (k = 0; k < n; k++) for (i = 0; i < n; i++) for (j = 0; j < n; j++) if (distance[i][k]+distance[k][j] < distance[i][j]) distance[i][j] = distance[i][k] + distance[k][j]; } / / Data Structures By Hyun-Ju Park / Hanbat National University / 6  6.4.4  A+ A+[i][j] = 1, i A+[i][j] = 0, j›  ó › $ 0 |  A*[i][j] = 1, i A*[i][j] = 0, j›  ó A* › $ 0 `` 0 | / / Data Structures By Hyun-Ju Park / Hanbat National University / 66           ª   0 1 2 3 4 0 1 2 3 4 0 0 0 0 0 0 1 1 0 0 0 0 2 1 1 1 1 1 A+ 0 0 0 0 0 0 1234 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1234 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 A* 0 1 2 3 4 3 1 1 1 1 1 4 1 1 1 1 1 0 1 2 3 4 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66   AOV ú  % ø # ` ø  §` \ activity on vertex network AOE ú % # : : ›û  ã ø / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  6.5.1 AOV  (precedence relation) AOV   G G ø“ ã i j i\ j ›  ú i\ új ø(predecessor) − ã <i, j> j j  ø(immediate predecessor) ã i j\ i ø j\ i ! ø(successor) ! ø(immediate successor) − ª i ] i immediate predecessor j immediate successor / / Data Structures By Hyun-Ju Park / Hanbat National University / 66       "07 ª    C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15   I    C1, C2  C4 C5 C3, C6 C3 C7, C8 C7 C10 C7 C7 C13 C5 ù N I II d    æ   œ   œ   / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  C9 C10 C1 C1 C11 C8 C12 C2 C3 C7 C13 C14 C4 C5 C6 C15 / / Data Structures By Hyun-Ju Park / Hanbat National University / 66  (transitive)  È i, j, k i·j j·k→i·k  ·\ (transitive)  (irreflexive)  S    S x  x×x   |   (partial order)  (topological order)   úi új ø÷ | i j á \ (linear order) $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ / / Data Structures By Hyun-Ju Park / Hanbat National University / 6            "07   ­dE  ª ]   for (i = 0; i < n; i++) { if (every vertex has a predecessor) { fprintf(stderr,”network has a cycle.\n”); exit(1); } pick a vertex v that has no predecessors; output v; delete v and all edges leading out of v from the network; } 1 ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern