So I am currently attempting to create an application (TUI) that will do 2 things: 1) When given a station's name, it will provide information about it and whether it is a terminus of a line (start/end of a line) 2) Find a route between two given stations (the duration/distance between stations does not matter) but I have to provide information regarding how many journeys it takes (you see there are paid and unpaid connections between certain stations and if an unpaid connection is used it adds a journey in the route).
Another hurdle is that the data about the stations, and the line to which it belongs, is given in a CSV file where the first element in the line of the CSV file is the name of the network line, which is followed by the stations within that line... The paid/unpaid connections are also listed in this same manner within the file.
So I have attempted multiple ways to get the logic of it in my head working but have been failing so far. My latest attempt was to use a breadth first search algorithm in java that I found online and try to implement the route finder through there. However, after creating the node I realised that the station can belong to multiple lines so therefore can have multiple left and right stations.
Initially, I was thinking I could use a graph to implement this but I was not sure how I would search through the graph to find the stations. Perhaps a graph where the node is a linked list of a line and the graph itself is the whole network. So the node contains the linked list (line) and that linked list contains the stations. But then also comes the issue, how would I create the graph and add its data from the CSV file? I'm currently using the "Files.readAllLines()" which is storing each line of the file in an ArrayList. I then iterate over that ArrayList to get specific elements of that file such as name of the line, stations within it etc.
However, my question really for this is if anyone has done anything similar or know how I can implement this to achieve my goal it would be greatly appreciated. Is it best to use a graph of stations or a graph of lines that contain stations etc? I understand this whole forum post might be a bit confusing and lengthy but anyone with java experience (if unable to assist through textual replies) that could perhaps have a short voice call to just clear some things up as I think I may be over complicating it?