• Tidak ada hasil yang ditemukan

TREES & GRAPHS

N/A
N/A
Protected

Academic year: 2024

Membagikan "TREES & GRAPHS"

Copied!
12
0
0

Teks penuh

(1)

TREES & GRAPHS

(2)

Trees

Free tree

b c

d f g

a

e

a

e b

d

g c

f c

f e

d

b a g

Rooted trees

c

d

(ที่หนึ่ง) e

(ที่สอง) a

(ที่สาม)

c

e

(ที่หนึ่ง) a

(ที่สอง) d

(ที่สาม)

Ordered trees

(3)

Trees

1 3 9

8 2 4

8 4 9

2 7

13 12 10

8 4 9

2 7

13 12

10

1 9

3 8

2

4

1 9

3 8

2

4

9 4 15

2 6 8 13 19 7

1 3 9

8 2 4

(4)

NULL Links

ถาตนไมหนึ่งมี n nodes โดยที่แตละ node มีลูกไดอยางมากที่สุด k 1. มีเสนเชื่อม (link) ในตนไมไดมากที่สุด n × k เสน

2. ทุกๆ node ในตนไมยกเวนราก จะถูกชี้โดยเสนเชื่อม node ละหนึ่งเสน

3. มีเสนเชื่อมอยู n-1 เสนที่มีคาไมเปน NULL สรุปไดวาสัดสวนของจํ านวนของเสนเชื่อม คาเปน NULL เทากับ

ตัวอยาง ถา k = 10 สรุปไดวา มากกวา 90% ของ link มีคาเปน NULL

( n k ) ( n )

n k k

× − −

× 1 ≈ − 1 1

data

เปลือง

(5)

Left-Child Right-Sibling

a

f

o d

h

i c

b e

j k l m

n p

g

a b

e

j k l m

f

d c

g

h

i

o n

p

data

left-child

right-sibling

(6)

Lexicographic Search Trees : Tries

{ 000, 1, 12, 122, 230, 3 }

0 1 2 3

3

000

1

12

122 230

(7)

Graphs

vertex edge

Shortest path problem

(8)

Graphs

Graph coloring problem

(9)

Graphs

ผสมปูน โบกปูน กออิฐ ทาสี ขับรถ สมบัติ X X

กรุง X X X X ลือชัย X X นาท X X ยอตชาย X

สมบัติ

กรุง ลือชัย นาท ยอตชาย

ผสมปูน โบกปูน กออิฐ ทาสี

ขับรถ

Matching problem

(10)

Graphs : Definitions

Undirected graph Directed graph

(11)

Graphs : Adjacency Matrices

b

a

c

e

f

g d

a b c d e f g a 0 0 0 0 0 1 0 b 1 0 1 0 0 0 0 c 0 0 0 0 1 0 0 d 0 1 0 0 1 0 1 e 0 0 1 0 0 0 0 f 0 0 0 0 0 0 1 g 0 0 0 1 0 0 0

b

a

c

e

f

g d

a b c d e f g a 0 2 0 1 0 3 0 b 2 0 1 0 0 0 0 c 0 1 0 3 3 0 0 d 1 0 3 0 0 0 4 e 0 0 3 0 0 0 0 f 3 0 0 0 0 0 3 g 0 0 0 4 0 3 0

2 3

1 3

3 4

3

1

(12)

Graphs : Adjacency Lists

1

0

2

4

5

6 3

0 1 2 3 4 5 6

1 2 1 3 1 1 1

5 0 2 4 1 2 6 3

4 6

0 1 2 3 4 5 6

5 0 4 1 2 6 3

2

4 6

Referensi

Dokumen terkait

In addition, we extend the no- tion of vertex magic graphs by providing measures describing how close a non-vertex magic graph is to being vertex magic. The general viewpoint is

Dalam sistem informasi geografis dengan shortest path ini menggunakan file berformat XML sebagai database sistem untuk menyimpan data vertex dan bobot edge serta menyimpan

Karena langkah 3 melibatkan semua edge yang ada dalam menghitung kondisi optimal yang dituliskan pada rumus (2.1), maka semua vertex dalam set p merupakan shortest path tree dimana s

To determine the weight vertex irregularity of the complete graph , it can be seen the labeling of the edge irregularity of the complete graph as shown in Figure 1.. A

We have found the lower bound of local distance irregular labeling and also determine the exact values of local distance irregular labeling of some classes graphs path, cycle,

This section discusses the Graph Coloring Problem Optimization Model Formulation, Optimization Uncertainty Model Formulation Graph Coloring Problem, Robust Counterpart Formulation

[3] about the determination of the locating chromatic number of certain barbell graphs, in this paper we determine the locating chromatic number of shadow path graphs and barbell

Representing Graphs by Adjacency Lists An other way to represent a graph without multiple edges is to use adjacency lists, which specify the vertices that are adjacent to each vertex