if __name__ == '__main__':
    
    print('Undirected Graph:')
    undirected = AdjList(False)
    for vertex in ['r','s','t','u','v','w','x','y']:
        undirected.addVertex(vertex)
    for source,dest in [('r','s'),('r','v'),('s','w'),('w','t'),('w','x'),('t','x'),('t','u'),('x','u'),('x','y'),('u','y')]:
        undirected.addEdge(source,dest)
    
    print(undirected)
    print('BFS:\n%s'%undirected.traverseBFS('s'))
    print('DFS:%s\n'%undirected.traverseDFS())
    
    print('\nTesting Copy Undirected:')
    copy = undirected.copyGraph()
    print(copy)
    print('BFS:\n%s'%copy.traverseBFS('s'))
    print('\nDFS:%s\n'%copy.traverseDFS())
    
    print('\nAfter Delete Vertex r:')
    undirected.removeVertex('r')
    print(undirected)
    print('BFS:\n%s'%undirected.traverseBFS('s'))
    print('\nDFS:%s\n'%undirected.traverseDFS())    
    
    print('\nAfter Delete Edge x->u:')
    undirected.removeEdge('x','u')
    print(undirected)
    print('BFS:\n%s'%undirected.traverseBFS('s'))
    print('\nDFS:%s\n'%undirected.traverseDFS())
 for vertex in ['r','s','t','u','v','w','x','y']:
     dag.addVertex(vertex)
 for source,dest in [('r','s'),('r','v'),('s','w'),('w','t'),('w','x'),('t','x'),('t','u'),('x','u'),('x','y'),('u','y')]:
     dag.addEdge(source,dest)
 
 print(dag)
 print('BFS:\n%s'%dag.traverseBFS('s'))
 print('\nDFS: %s'%dag.traverseDFS())
 
 print('Topological Sort: %s'%dag.topologicalSort())
 transpose = dag.computeTranspose()
 print('\nTranspose of dag:\n%s'%transpose)
 print('Strongly Connected Components: %s\n'%dag.stronglyConnectedComponents())
 
 print('\nTesting Copy:\n')
 copy = dag.copyGraph()
 print(copy)
 print('BFS:\n%s'%copy.traverseBFS('s'))
 print('\nDFS:%s\n'%copy.traverseDFS())
 print('Graph is a DAG: %s\n'%copy.isDAG())
 
 print('Copy Graph after removing vertex "v"')
 copy.removeVertex('v')
 print(copy)
 print('DFS:%s\n'%copy.traverseDFS())
 
 print('Compared to original graph:')
 print(dag)
 
 print('After Delete Vertex r:')
 dag.removeVertex('r')