// From the software distribution accompanying the textbook // "A Practical Introduction to Data Structures and Algorithm Analysis, // Third Edition (C++)" by Clifford A. Shaffer. // Source code Copyright (C) 2007-2011 by Clifford A. Shaffer. // Simple program to test graph construction: // Reads graph from a file and builds it. // Use any of the files in this directory with a .gph extension. // This version is for the Adjancency List representation #include "book.h" // Include the graph classes -- Adjacency List #include "grlist.h" // Simple program to test graph construction: // Version for Adjancency List representation int main(int argc, char** argv) { Graph* G; FILE *fid; if (argc != 2) { cout << "Usage: grtestl \n"; exit(-1); } if ((fid = fopen(argv[1], "rt")) == NULL) { cout << "Unable to open file |" << argv[1] << "|\n"; exit(-1); } G = createGraph(fid); if (G == NULL) { cout << "Unable to create graph\n"; exit(-1); } Gprint(G); return 0; }