Menu
Coddy logo textTech

Final Challenge #2

Lesson 9 of 9 in Coddy's Prim's Algorithm - Graph Algorithms course.

challenge icon

Challenge

Medium

Prim can only span a graph that is actually connected.

Write a function named isConnected that takes n and the flat edges array (triples, undirected) and returns 1 if the graph is connected (Prim starting at vertex 0 reaches all n vertices), or 0 otherwise.

Try it yourself

#include <stdlib.h>

int isConnected(int n, int* edges, int edges_size) {
    // Write code here
    return 0;
}

All lessons in Prim's Algorithm - Graph Algorithms