TAILIEUCHUNG - ALGORITHMS phần 8

Tất nhiên, chúng tôi không thực sự quét qua tất cả các góc độ có thể, chúng ta chỉ cần làm một tính toán tìm-the-tối thiểu tiêu chuẩn để tìm thấy những điểm đó sẽ là hit tiếp theo. Phương pháp này có thể dễ dàng thực hiện bằng cách sử dụng chức năng theta (pl, p2: điểm) được phát triển trong chương trước | ELEMENTARY GRAPH ALGORITHMS 379 program adjlist input output const maxỹ 1000 type link ĩnode node record v integer next link end var j x y V E integer link adj array of link begin readln V E new z z .next z for j . l to V do adj j z for j l to E do begin readln vl v2 x index vl y index v2 - new t t .v x adj y adj y t new t t .v. y adj x adj x t end end. As usual each linked list ends with a link to an artificial node z which links to itself. For this representation the order in which the edges appear in the input is quite relevant it along with the list insertion method used determines the order in which the vertices appear on the adjacency lists. Thus the same graph can be represented in many different ways in an adjacency list structure. Indeed it is difficult to predict what the adjacency lists will look like by examining just the sequence of edges because each edge involves insertions into two adjacency lists. The order in which edges appear on the adjacency list affects in turn the order in which edges are processed by algorithms. That is the adjacency list structure determines the way that various algorithms that we ll be examining see the graph. While an algorithm should produce a correct answer no matter what the order of the edges on the adjacency lists it might get to that answer by quite different sequences of computations for different orders. And if there is more than one correct answer different input orders might lead to different output results. If the edges appear in the order listed after the first drawing of our sample graph at the beginning of the chapter the program above builds the following adjacency list structure 380 CHAPTER 29 A F C B G B A C A D F E E G F D F A E D G E A H I I H J K L M K J L J M M J L Note that again each edge is represented twice an edge connecting x and y is represented as a node containing x on y s adjacency list and as a node containing y on x s adjacency list. It is important to include both .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.