So I'm starting a project on directed graphs and topological sorting. I'm looking for the most efficient way to parse an input file of courses in the form:
COURSE_1 COURSE_2
where COURSE_1 is a prerequisite to COURSE_2
NONE COURSE_3
where COURSE_3 has no prerequisites.
All vertex labels will be strings, obviously. I have created a Graph class with data members to store vertices, edges, and vertex labels. Later, I will be adding methods to topologically sort and find the shortest path from one vertex to another. Given these future plans, my questions here are would it be better to use an adjacency list? or matrix? Also what would be the most efficient way to populate the graph from the input files? My initial thought was using an adjacency list. Since the size of the graph isn't known at compile time my idea