public void AddLineToGraph(List<Station> line, string line_name)
        {
            for (int i = 0; i < line.Count; i++) // for each station on the line
            {
                bool node_exists = false;
                Station prev = null, next = null;
                if (i > 0) // if it's not the first node, a previous station exists
                {
                    prev = line[i - 1]; // prev = the previous station in the list
                }
                if (i < (line.Count - 1)) // if it's not the last node, a next station exists
                {
                    next = line[i + 1]; // next = the next station in the list
                }

                // if the node already exists in the graph, we want to add this line/route
                // and these next/prev references to it's adjacency_list rather than
                // add a duplicate node

                foreach (GraphNode n in graph)
                {
                    if (n.name == line[i].Name) // if a node exists with this name
                    {
                        Dictionary<string, Station> adj = new Dictionary<string, Station>(); // new sub-Dict
                        adj.Add("next", next); // set next reference
                        adj.Add("prev", prev); // set prev reference
                        n.adjacency_list.Add(line_name, adj); // add sub-Dict to main-Dict
                        n.lines.Add(line_name); // this list is handy if you just want to see what lines exist for this GraphNode, but isn't used yet
                        node_exists = true; // set a flag
                    }
                }

                // if we didn't find a matching node, ADD A NEW NODE
                if (node_exists == false)
                {
                    GraphNode node = new GraphNode(line[i], line_name, next, prev); // create a new node
                    graph.Add(node); // add it to the graph
                }
            }
        }
 public PathNode(string station, string line, GraphNode node)
 {
     this.station = station;
     this.line = line;
     this.node = node;
 }