Build an Adjacency List Graph from Node Labels in a File

//build the graph
void buildGraph(FILE* in, Graph G) {
	int j, k, numEdges, weight;
	char name[MaxWordSize], nodeID[MaxWordSize], adjID[MaxWordSize];

	// read the names of the vertices 
	// and store them in the graph array
	for (j = 1; j <= G->numV; j++) {
		fscanf(in, "%s", name);
		G->vertex[j] = newGVertex(name);
		strcpy(G->vertex[j].id, name);
		
	}

	// process edge data for each vertex
	for (j = 1; j <= G->numV; j++) { 

		// information about the parent vertex
		fscanf(in, "%s %d", nodeID, &numEdges); 

		// information about each edge from the parent vertex
		for (k = 1; k <= numEdges; k++) { 
			fscanf(in, "%s %d", adjID, &weight);
			addEdge(nodeID, adjID, weight, G);
		}
	}
}