SlideShare a Scribd company logo
1 of 11
다익스트라 알고리즘(Dijkstra algorithm)
W1 자료구조와 알고리즘
• 특정한 하나의 정점에서 다른 모든 정점으로 가는 최단 경로
내비게이션, 지하철 노선 검색 등에 사용
• 하나의 최단 거리를 구할 때 이전까지 구했던 정보를 그대로 사용
• 음의 간선을 포함하지 않는다
현실 세계에서 사용하기에 적합
구하는 방법
1. 출발 노드 설정
2. 출발 노드를 기준으로 최소 비용을 저장
3. 방문하지 않은 노드 중에서 가장 비용
이 적은 노드를 선택
4. 해당 노드를 거쳐서 특정한 노드로 가
는 경우를 고려하여 최소 비용을 갱신
5. 3번 ~ 4번 반복한다.
A
B
C
D
3
2 25
2 E1
A
B
C
D
3
2 25
2 E1
0 2 3 5 무한
A
B
C
D
3
2 25
2 E1
0 2 3 4 무한
A
B
C
D
3
2 25
2 E1
0 2 3 4 무한
A
B
C
D
3
2 25
2 E1
0 2 3 4 5
A
B
C
D
3
2 25
2 E1
0 2 3 4 5
코드로 살펴보기
최소 거리를 가지는 정점 반환
다익스트라 수행 코드

More Related Content

What's hot

10_무한 평면과 놀기
10_무한 평면과 놀기10_무한 평면과 놀기
10_무한 평면과 놀기noerror
 
DNN-Based Prediction Model for Spatial-Temporal Data
DNN-Based Prediction Model for Spatial-Temporal DataDNN-Based Prediction Model for Spatial-Temporal Data
DNN-Based Prediction Model for Spatial-Temporal DataHWANGTAEYONG
 
구조체와 포인터
구조체와 포인터구조체와 포인터
구조체와 포인터Kim YoSep
 
[Acm] 황혼에서 새벽까지
[Acm] 황혼에서 새벽까지[Acm] 황혼에서 새벽까지
[Acm] 황혼에서 새벽까지guest89526f
 
Efficient linear skyline algorithm in two dimensional space
Efficient linear skyline algorithm in two dimensional spaceEfficient linear skyline algorithm in two dimensional space
Efficient linear skyline algorithm in two dimensional space희수 박
 

What's hot (6)

10_무한 평면과 놀기
10_무한 평면과 놀기10_무한 평면과 놀기
10_무한 평면과 놀기
 
DNN-Based Prediction Model for Spatial-Temporal Data
DNN-Based Prediction Model for Spatial-Temporal DataDNN-Based Prediction Model for Spatial-Temporal Data
DNN-Based Prediction Model for Spatial-Temporal Data
 
구조체와 포인터
구조체와 포인터구조체와 포인터
구조체와 포인터
 
[Acm] 황혼에서 새벽까지
[Acm] 황혼에서 새벽까지[Acm] 황혼에서 새벽까지
[Acm] 황혼에서 새벽까지
 
Efficient linear skyline algorithm in two dimensional space
Efficient linear skyline algorithm in two dimensional spaceEfficient linear skyline algorithm in two dimensional space
Efficient linear skyline algorithm in two dimensional space
 
Dp 1
Dp 1Dp 1
Dp 1
 

More from minhee An

입출력시스템
입출력시스템입출력시스템
입출력시스템minhee An
 
언어론-프로그래밍 언어 설계
언어론-프로그래밍 언어 설계언어론-프로그래밍 언어 설계
언어론-프로그래밍 언어 설계minhee An
 
The course of operation of a computer
The course of operation of a computerThe course of operation of a computer
The course of operation of a computerminhee An
 

More from minhee An (6)

입출력시스템
입출력시스템입출력시스템
입출력시스템
 
W6 dag
W6 dagW6 dag
W6 dag
 
언어론-프로그래밍 언어 설계
언어론-프로그래밍 언어 설계언어론-프로그래밍 언어 설계
언어론-프로그래밍 언어 설계
 
VPN
VPNVPN
VPN
 
Risc cisc
Risc ciscRisc cisc
Risc cisc
 
The course of operation of a computer
The course of operation of a computerThe course of operation of a computer
The course of operation of a computer
 

Dijkstra algorithm