본문 바로가기

[C++] Data Structure & Algorithm/Graph5

[Graph] Chapter 05. 다익스트라(Dijkstra) 알고리즘 GitHub : https://github.com/developeSHG/Data_Structure-Algorithm/commit/ed3f5772f67f98efb67841c1795909f85c76211f 다익스트라(Dijkstra) 알고리즘 구현 · developeSHG/Data_Structure-Algorithm@ed3f577 developeSHG committed Aug 8, 2023 github.com 시작점에서 목적지까지 가는 정점의 간선에 비용이 있다고 가정해보면 적용할 수 있는게 다익스트라 알고리즘이다. 내가 먼저 발견한 순서대로 방문을 하는게 BFS라면, 다익스트라는 인접한 정점을 인지한 후, 방문할 수 있도록 등록은 한다. 근데 각 정점으로 갈 때, 비용은 얼마나 드는지 가중치를 같이 포함해.. 2023. 8. 8.
[Graph] Chapter 04. BFS를 이용한 길찾기 구현 GitHub : https://github.com/developeSHG/Data_Structure-Algorithm/commit/ce84719bc1e67974dda74fb833ac50e526c8fe19 BFS를 이용한 길찾기 구현 · developeSHG/Data_Structure-Algorithm@ce84719 developeSHG committed Aug 8, 2023 github.com 이전 글에서 구현한 BFS를 토대로 Maze(미로) 글에 길찾기를 적용했던 우수법을 BFS로 교체해보자. 이전에 BFS를 구현할 때, Vertex라는 점을 만든 다음 인접리스트 혹은 인접행렬을 토대로 관리했었다. 대부분의 경우에는 실제 정점정보와 인접정보를 구분해서 만드는 것이 조금 더 활용하기 편하다고 했다. 하지.. 2023. 8. 8.
[Graph] Chapter 03. BFS (너비 우선 탐색) GitHub : https://github.com/developeSHG/Data_Structure-Algorithm/commit/b415c0586aecf03641d3eb30fb58d34f1ccdab96 BFS (너비 우선 탐색) 구현 · developeSHG/Data_Structure-Algorithm@b415c05 developeSHG committed Aug 8, 2023 github.com 길찾기를 할 때, 한 경로로 깊이 탐색하는 DFS 보다 가까운 것을 먼저 탐색하는 BFS를 더 우선 사용. #include #include #include #include #include using namespace std; // [ ][ ][ ][ ][ ][ ][ ][ ] // DFS (Depth First S.. 2023. 8. 8.
[Graph] Chapter 02. DFS (깊이 우선 탐색) GitHub : https://github.com/developeSHG/Data_Structure-Algorithm/commit/ee1c8ba520c4c868b8bf032b18231b882f72723e DFS (깊이 우선 탐색) 구현 · developeSHG/Data_Structure-Algorithm@ee1c8ba developeSHG committed Aug 8, 2023 github.com #include #include #include #include #include using namespace std; // [ ][ ][ ][ ][ ][ ][ ][ ] // DFS (Depth First Search) 깊이 우선 탐색 // BFS (Breadth First Search) 너비 우선 탐색 struc.. 2023. 8. 8.
[Graph] Chapter 01. 그래프 GitHub : https://github.com/developeSHG/Data_Structure-Algorithm/commit/a371f42dd4ae7aea9e445bcca06d4ebff3d9e1de 그래프 구현 · developeSHG/Data_Structure-Algorithm@a371f42 developeSHG committed Aug 8, 2023 github.com 그래프의 개념 [현실 세계의 사물이나 추상적인 개념 간]의 [연결 관계]를 표현 정점(Vertex) : 데이터로르 표현 (사물, 개념 등) 간선(Edge) : 정점들을 연결하는데 사용 위 사진의 그래프를 3가지 방법으로 만들어보자. #include #include #include #include #include using names.. 2023. 8. 8.