#include <stdio.
h>
#include <stdbool.h>
#include <limits.h>
#define MAX 100
int graph[MAX][MAX];
int visited[MAX];
int discovery[MAX];
int low[MAX];
int parent[MAX];
bool articulation_point[MAX];
int time_counter = 0;
void DFS(int u, int n) {
visited[u] = 1;
discovery[u] = low[u] = ++time_counter;
int children = 0;
for (int v = 0; v < n; v++) {
if (graph[u][v]) {
if (!visited[v]) {
children++;
parent[v] = u;
DFS(v, n);
low[u] = (low[u] < low[v]) ? low[u] : low[v];
if (parent[u] == -1 && children > 1) {
articulation_point[u] = true;
if (parent[u] != -1 && low[v] >= discovery[u]) {
articulation_point[u] = true;
} else if (v != parent[u]) {
low[u] = (low[u] < discovery[v]) ? low[u] : discovery[v];
void findArticulationPoints(int n) {
for (int i = 0; i < n; i++) {
parent[i] = -1;
visited[i] = 0;
articulation_point[i] = false;
for (int i = 0; i < n; i++) {
if (!visited[i]) {
DFS(i, n);
}
printf("Articulation Points: ");
for (int i = 0; i < n; i++) {
if (articulation_point[i]) {
printf("%d ", i);
printf("\n");
int main() {
int n, e;
printf("Enter the number of vertices and edges: ");
scanf("%d %d", &n, &e);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
graph[i][j] = 0;
printf("Enter the edges (u, v): \n");
for (int i = 0; i < e; i++) {
int u, v;
scanf("%d %d", &u, &v);
graph[u][v] = 1;
graph[v][u] = 1;
findArticulationPoints(n);
return 0;