Graph/C/Prim.c
void DFS(Graph* G, int* visited, int index) {
    printf("%c\t", G -> vexs[index]);
    visited[index] = 1;
    for (int i = 0; i < G ->vexNum; i++) {
        if (G -> arcs[index][i] > 0 && G -> arcs[index][i] != MAX && !visited[i]) {
            DFS(G, visited, i);
        }
    }
}
/**
 * dfs graph
 * @param G the pointer of graph
 * @param visited the visited array
 * @param index the index you visited
 */
dfs graph
@param G the pointer of graph
@param visited the visited array
@param index the index you visited
dfs graph @param G the pointer of graph @param visited the visited array @param index the index you visited
void DFS(Graph* G, int* visited, int index) {
    printf("%c\t", G -> vexs[index]);
    visited[index] = 1;
    for (int i = 0; i < G ->vexNum; i++) {
        if (G -> arcs[index][i] > 0 && G -> arcs[index][i] != MAX && !visited[i]) {
            DFS(G, visited, i);
        }
    }
}
void DFS ( Graph * G , int * visited , int index ) { printf ( " \t " , G -> vexs [ index ] ) ; visited [ index ] = 1 ; for ( int i = 0 ; i < G -> vexNum ; i ++ ) { if ( G -> arcs [ index ] [ i ] > 0 && G -> arcs [ index ] [ i ] != MAX && ! visited [ i ] ) { DFS ( G , visited , i ) ; } } }
dfs graph
 @param G the pointer of graph
 @param visited the visited array
 @param index the index you visited
dfs graph @param G the pointer of graph @param visited the visited array @param index the index you visited