Graph Vertex(Node)와 Edge(Arc)로 구성 인접(adjacent): 두 점이 연결되어 있음을 뜻함
Subgraph : 점 선택후 그 사이의 선들 아무거나 선택 Induced subgraph : 점 선택 후 그 안의 모든 선들 선택
Implementation
Adjacency Matrix(인접 행렬)

Adjacency List Array-Based: list Linked chain Single Array Multi Array

DFS Stack, Recursive, Preorder
Using DFS
BFS Queue, Iterative
Topological Sort

Shortest Path In weighted digraph find minimum cost path
Greedy(Dijkstra’s Algorithm) Dynamic programming
Complexity
→nlogn in sparse graph, n^2logn in dense graph

S is final answer; shortest path

All pairs - Greedy n time for sparse O(n^2logn) for dense O(n^3logn) →not efficient
All pairs - Floyd’s Algorithm Djikstra for all pairs O(n^3) works even with negative cost, non-negative cycle
Prim’s Algorithm
use Priority Queue, D[k]: shortest distance from Tree to node k Adj-Matrix→O(n^2); better with dense graph Adj-List&MinHeap→O(elogn); better with sparse(e=n) graph
*Why Prim’s Algorithm Works? MST property: it satisfies Greedy-Choice property


Kruskal’s Algorithm
→O(eloge); Sparse
*Union-Find problem By adding edges, they form several different components, and we should prevent making cycle →if edge connects two different component, insert →if edge’s two nodes are in same component, skip→Acyclic
Applications of MST clustering →routing networks, web search, sky objects configuration Single Link clustering: Maximize distance between closest clusters : Equal to Kruskal’s Algorithm; stop at N components Sollin’s Algorithm
complexity: O(ElogV)