2023 SPRING CS 445 Project #10
GRAPH CLASS via LINKED LISTS

Background:

Development Strategy

  1. Start with your solution to the Graph.java you wrote for Lab#9.
  2. Reuse the exact same tester and input file from Lab#9.
  3. Copy your Edge.java definition code into your Graph.java file - just like you put Node inside your LinkedList classes.
  4. By doing so you don't need setters and getters in your Edge class.
  5. You don't need to write a LinkedList class per se. You can write the insertAtFront(), remove(), contains() etc. inside the Graph class and just treat the G[i] element as the head of that LinkedList.
  6. In your Graph.java file replace the int G[][] from the 2D array version with a single dimension Edge G[]. That G[] array is an array of Edge pointers (linkedList heads/fronts).
  7. In your loadGraphFile, after you read in the dimension value from the file, use it to dimension your G[] array of Edge pointers.
  8. Now you only need to to modify the following methods: 1 AT A TIME!
  9. toString() must be re-written by you to produce same info but this format:

  10. The other public methods do not need to change. DO YOU UNDERSTAND WHY?