#include "HKUAL_graph.h"
#include <iostream>
using namespace std;
using namespace HKUAL;
int main(){
Graph<string> g;
g.addVertex("A");
g.addVertex("B");
g.addVertex("C");
g.addEdge("A","B");
g.addEdge("A","C");
g.addEdge("B","C");
if (g.isContainCycle())
cout <<"Yes" << endl;
else
cout <<"No" << endl;
Graph<string> g2;
g2.addVertex("A");
g2.addVertex("B");
g2.addVertex("C");
g2.addEdge("A","B");
g2.addEdge("A","C");
if (g2.isContainCycle())
cout <<"Yes" << endl;
else
cout <<"No" << endl;
return 0;
} |