Access over 20 million homework & study documents

Graph02.c

Content type
User Generated
Subject
C Programming
Type
Homework
Rating
Showing Page:
1/3

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/3

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/3

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
#include #include #include "graphadt.h" #include "loadgraph.h" #include void usageMessage(); int main(int argc, char **argv) { struct Graph *g, *tg, *ttg; int **m; if(argc < 2 || argc > 3) // If the program name is the only argument, or if we have more than two arguments { usageMessage(); } if(argc > 2) { if(!strcmp("-U", argv[1])) // For simplicity, we just read -U as the first argument in the list. g = loadGraph(argv[2], 1); // Create unidrected graph else g = loadGraph(argv[2], 0); // Create directed graph } else { g = loadGraph(argv[1], 0); // If only filename, we create a directed graph } printf("\nInitial graph:\n"); printAdjVerts(g); // In situations where n > 20, it is best to use > in the execution statement of the program to output to a file printf("\n\nAdjacency matrix:\n"); m = makeAdjMatrix(g); printAdjMatrix(m, g->count); freeAdjacencyMatrix( ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Great content here. Definitely a returning customer.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4