Example #1
0
int main(int argc, const char * argv[]) {
    if(argc != 2)
    {
        cout << "Arguments invalides" << endl;
    }
    else
    {
        SymbolGraph<DiGraph> graph = SymbolGraph<DiGraph>(argv[1]);
        TopologicalSort<DiGraph> tps = TopologicalSort<DiGraph>(graph.G());
        DirectedCycle<DiGraph> directedCycle = DirectedCycle<DiGraph>(graph.G());
        // Si on a pas de cycle on peut trier !
        if(directedCycle.HasCycle() == false)
        {
            auto order = tps.Order();
            cout << "est un Directed Cycle " << endl;
            
            if(checkOrder(tps.Order(), graph, argv[1], ','))
            {
                for(auto index: order)
                {
                    cout << graph.name(index) << endl;
                }
                cout << "Verification reussie" << endl;
            }
            else
            {
                cout << argv[1] << "nest pas un DAG" << endl << endl;
                cout << "Cycle trouve:" << endl;
                for(auto index: directedCycle.Cycle())
                {
                    cout << graph.name(index);
                }
                cout << "Verification echouee" << endl;
            }
        }
    }
    /* A IMPLEMENTER */
    
    return EXIT_SUCCESS;
}