// Path: Source/src/de/tum/in/www1/jReto/routing/algorithm/LinkStateRoutingTable.java
// public static class NowReachableInformation<T> {
// 	/** The node that became reachable */
// 	public final T node;
// 	/** The node that is the next hop for reaching this node. */
// 	public final T nextHop;
// 	/** The total cost for reaching this node. */
// 	public final double cost;
// 			
// 	/** Constructs a new NowReachableInformation object. */
// 	public NowReachableInformation(T node, T nextHop, double cost) {
// 		this.node = node;
// 		this.nextHop = nextHop;
// 		this.cost = cost;
// 	}
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/routing/algorithm/LinkStateRoutingTable.java
// public static class RouteChangedInformation<T> {
// 	/** The node that became reachable */
// 	public final T node;
// 	/** The node that is the next hop for reaching this node. */
// 	public final T nextHop;
// 	/** The previous total cost for reaching this node. */
// 	public final double oldCost;
// 	/** The total cost for reaching this node. */
// 	public final double cost;
// 			
// 	/** Constructs a new RouteChangedInformation object. */
// 	public RouteChangedInformation(T node, T nextHop, double oldCost, double cost) {
// 		this.node = node;
// 		this.nextHop = nextHop;
// 		this.oldCost = oldCost;
// 		this.cost = cost;
// 	}
// }


import org.jgrapht.alg.DijkstraShortestPath;
import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.graph.DirectedWeightedPseudograph;
import de.tum.in.www1.jReto.routing.algorithm.LinkStateRoutingTable.Change.NowReachableInformation;
import de.tum.in.www1.jReto.routing.algorithm.LinkStateRoutingTable.Change.RouteChangedInformation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Map;
package de.tum.in.www1.jReto.routing.algorithm;




/**
 * A LinkStateRoutingTable manages a graph of nodes in the network with type T.
 * 
 * Link state routing works by gathering information about the full network topology; i.e. for each node in the network, 
 * all of its neighbors are known eventually. Based on this information, the next hop to a node can be computed using a shortest path algorithm.
 * 
 * Advantages of link state routing (as opposed to distance vector routing) include that link state routing converges rather quickly and 
 * is not subject to the count-to-infinity problem; hence, no measures to combat this problem need to be taken. As the full network topology
 * is known to every node, rather advanced routing techniques can be implemented.
 * 
 * Disadvantages include that the link state information needs to be flooded through the network, causing higher overhead than link state protocols.
 * The memory and computational requirements are also higher. 
 * 
 * The LinkStateRoutingTable class is not responsible for distributing link state information across the network; 
 * however, it processes received link state information and can provide link state information for the local peer.
 * 
 * This routing table is designed to compute all next hops and path costs for all known nodes every time when new 
 * network topology information becomes available (e.g. neighbors added, updated or lost, and link state information received from 
 * any peer). 
 * 
 * These changes in the routing table are returned as a LinkStateRoutingTable.Change object. This object includes information about
 * nodes that became reachable or unreachable, or information about route changes to nodes that were reachable before.
 * */
public class LinkStateRoutingTable<T> {
	/**
	 * A Change object contains changes that occurred in the routing table caused by some operation.
	 * */
	public static class Change<T> {
		/**
		 * Contains information about nodes that became reachable.
		 * */
// Path: Source/src/de/tum/in/www1/jReto/routing/algorithm/LinkStateRoutingTable.java
// public static class NowReachableInformation<T> {
// 	/** The node that became reachable */
// 	public final T node;
// 	/** The node that is the next hop for reaching this node. */
// 	public final T nextHop;
// 	/** The total cost for reaching this node. */
// 	public final double cost;
// 			
// 	/** Constructs a new NowReachableInformation object. */
// 	public NowReachableInformation(T node, T nextHop, double cost) {
// 		this.node = node;
// 		this.nextHop = nextHop;
// 		this.cost = cost;
// 	}
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/routing/algorithm/LinkStateRoutingTable.java
// public static class RouteChangedInformation<T> {
// 	/** The node that became reachable */
// 	public final T node;
// 	/** The node that is the next hop for reaching this node. */
// 	public final T nextHop;
// 	/** The previous total cost for reaching this node. */
// 	public final double oldCost;
// 	/** The total cost for reaching this node. */
// 	public final double cost;
// 			
// 	/** Constructs a new RouteChangedInformation object. */
// 	public RouteChangedInformation(T node, T nextHop, double oldCost, double cost) {
// 		this.node = node;
// 		this.nextHop = nextHop;
// 		this.oldCost = oldCost;
// 		this.cost = cost;
// 	}
// }


// Path: Source/src/de/tum/in/www1/jReto/routing/algorithm/LinkStateRoutingTable.java
import org.jgrapht.alg.DijkstraShortestPath;
import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.graph.DirectedWeightedPseudograph;
import de.tum.in.www1.jReto.routing.algorithm.LinkStateRoutingTable.Change.NowReachableInformation;
import de.tum.in.www1.jReto.routing.algorithm.LinkStateRoutingTable.Change.RouteChangedInformation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Map;

package de.tum.in.www1.jReto.routing.algorithm;




/**
 * A LinkStateRoutingTable manages a graph of nodes in the network with type T.
 * 
 * Link state routing works by gathering information about the full network topology; i.e. for each node in the network, 
 * all of its neighbors are known eventually. Based on this information, the next hop to a node can be computed using a shortest path algorithm.
 * 
 * Advantages of link state routing (as opposed to distance vector routing) include that link state routing converges rather quickly and 
 * is not subject to the count-to-infinity problem; hence, no measures to combat this problem need to be taken. As the full network topology
 * is known to every node, rather advanced routing techniques can be implemented.
 * 
 * Disadvantages include that the link state information needs to be flooded through the network, causing higher overhead than link state protocols.
 * The memory and computational requirements are also higher. 
 * 
 * The LinkStateRoutingTable class is not responsible for distributing link state information across the network; 
 * however, it processes received link state information and can provide link state information for the local peer.
 * 
 * This routing table is designed to compute all next hops and path costs for all known nodes every time when new 
 * network topology information becomes available (e.g. neighbors added, updated or lost, and link state information received from 
 * any peer). 
 * 
 * These changes in the routing table are returned as a LinkStateRoutingTable.Change object. This object includes information about
 * nodes that became reachable or unreachable, or information about route changes to nodes that were reachable before.
 * */
public class LinkStateRoutingTable<T> {
	/**
	 * A Change object contains changes that occurred in the routing table caused by some operation.
	 * */
	public static class Change<T> {
		/**
		 * Contains information about nodes that became reachable.
		 * */
		public static class NowReachableInformation<T> {