- 그래프는 아이템들과 이들 사이의 연결관계를 표현함
- 그래프는 정점들의 집합과 이들을 연결하는 간선들의 집합으로 구성된 자료 구조
선형 자료구조나 트리 자료구조로 표현하기 어려운 N : N관계를 가지는 원소들을 표현하기에 용이함
인접(Adjacency)
경로
사이클 (Cycle)
시작한 정점에서 끝나는 경로를 사이클이라고 함
1 - 3 - 5 - 1
Undirected Graph
Directed Graph
Weighted Graph
Complete Graph
Subgraph
DAG, Directed Acyclic Graph
https://steemit.com/dag/@cryptodreamers/dag-dag-directed-acyclic-graph
'''
7 8
1 2 1 4 2 4 2 5 4 6 5 6 6 7 3 7
'''
V , E = map(int,input().split())
arr = list(map(int,input().split()))
adjM = [[]*(V+1) for _ in range(V+1)]
for i in range(E):
n1, n2 = arr[i*2], arr[i*2 + 1]
adjM[n1][n2] = 1
adjM[n2][n1] = 1 #방향이 없는 경우
'''
7 8
1 2 1 4 2 4 2 5 4 6 5 6 6 7 3 7
'''
V , E = map(int,input().split())
arr = list(map(int,input().split()))
adjL = [[] for _ in range(V+1)]
for i in range(E):
n1, n2 = arr[i*2], arr[i*2 + 1]
adjL[n1].append(n2)
adjL[n2].append(n1) # 뱡향이 없는 경우