def dfs(adj, V, vis, i, curr):
vis[curr] = 1
for x in adj[curr]:
if x != i and not vis[x]:
dfs(adj, V, vis, i, x)
def AP(adj, V):
for i in range(1, V + 1):
components = 0
vis = [0] * (V + 1)
for j in range(1, V + 1):
if j != i:
if not vis[j]:
components += 1
dfs(adj, V, vis, i, j)
if components > 1:
print(i)
def addEdge(adj, u, v):
adj[u].append(v)
adj[v].append(u)
V = int(input("Enter the number of vertices: "))
E = int(input("Enter the number of edges: "))
adj = [[] for _ in range(V + 1)]
for _ in range(E):
u, v = map(int, input("Enter edge (u v): ").split())
addEdge(adj, u, v)
print("Articulation points in the graph:")
AP(adj, V)
Comments