I am creating an algorithm that identifies if a graph contains cycles deleted the fonts recursively, returning the graph for later verification of the amount of edge, for this create the following code for adjacency matrices:
Graph GRAPHisCycle( Graph F, vertex v) {
while( v < F->V) {
vertex w = 0;
while (w < F->V) {
if( F->adj[v][w] == 1 && GRAPHoutdeg( F, v) > 0 && GRAPHindeg( F, v) == 0) {
GRAPHremoveA( F, v, w);
GRAPHisCycle( F, v);
}
++w;
}
++v;
}
return F;
}
GRAPHoutdeg and GRAPHindeg represent the degree of output and input. I found this code to be time consuming. I do not want to check it by topological numbering, applying a DFS, wanted to run it using DFS in another way, without that check, how?