table adjacency matrix for small directed graph each edge is represented by single the row labels show where the edge startsand the column labels show where it ends thusthe edge from to is represented by single at row column if the directed edge were reversed so that it went from to athere would be at row column instead for non-directed graphas we noted earlierhalf of the adjacency matrix mirrors the other halfso half the cells are redundant howeverfor weighted graphevery cell in the adjacency matrix conveys unique information the halves are not mirror images for directed graphthe method that adds an edge thus needs only single statementpublic void addedge(int startint endadjmat[start][end /directed graph instead of the two statements required in non-directed graph if you use the adjacency-list approach to represent your graphthen has in its list but--unlike non-directed graph-- does not have in its list topological sorting imagine that you make list of all the courses necessary for your degreeusing figure as your input data you then arrange the courses in the order you need to take them obtaining your degree is the last item on the listwhich might look like thisbaedgcfh arranged this waythe graph is said to be topologically sorted any course you must take before some other course occurs before it in the list actuallymany possible orderings would satisfy the course prerequisites you could take the english courses and firstfor examplecfbaedgh