In your main function, first build the graph by reading edges and populating the adjacency list. Initialize the visited array to all false. Pick a starting vertex (usually vertex or vertex depending on the problem). Call dfs on that starting vertex. If the graph is disconnected, you might need to call dfs multiple times to visit all components.
The DFS will explore everything reachable from the starting point. For a fully connected graph, one call is enough. For disconnected graphs, loop through all vertices and start DFS from any unvisited vertex.