123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- /*=========================================================================
- Library: qCTK
- Copyright (c) Kitware Inc.
- All rights reserved.
- Distributed under a BSD License. See LICENSE.txt file.
- This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the above copyright notice for more information.
- =========================================================================*/
- // CTK includes
- #include "ctkDependencyGraph.h"
- // STL includes
- #include <stdlib.h>
- #include <iostream>
- int ctkDependencyGraphTest1(int argc, char * argv [] )
- {
- Q_UNUSED(argc);
- Q_UNUSED(argv);
- const int numberOfVertices = 4;
- const int numberOfEdges = 3;
- ctkDependencyGraph graph(numberOfVertices,numberOfEdges);
- graph.setVerbose(true);
- graph.setVerbose(false);
- graph.setVerbose(true);
- graph.insertEdge(1,2);
- graph.insertEdge(2,3);
- graph.insertEdge(3,4);
- graph.printAdditionalInfo();
- graph.printGraph();
-
- int nov = graph.numberOfVertices();
- if( nov != numberOfVertices )
- {
- return EXIT_FAILURE;
- }
- int noe = graph.numberOfEdges();
- if( noe != numberOfEdges + 3 )
- {
- return EXIT_FAILURE;
- }
- bool cfc = graph.checkForCycle();
-
- if( cfc == true )
- {
- return EXIT_FAILURE;
- }
- bool cdtd = graph.cycleDetected();
- if( cdtd == true )
- {
- return EXIT_FAILURE;
- }
- int corigin = graph.cycleOrigin();
- int cend = graph.cycleEnd();
- QList<int> path;
- graph.findPath( 1, 4, path );
- QList<int> list;
- graph.setEdgeListToExclude( list );
- graph.shouldExcludeEdge(2);
- QList<int> sortedlist;
- graph.topologicalSort( sortedlist );
- return EXIT_SUCCESS;
- }
|