@@ -0,0 +1,3533 @@
+/**%0A ********************************************************************%0A * File: Node.java%0A * Author: Ahmed Ghannam (0910337) %0A * %0A * Represents a node in a network or graph. Together with links, nodes make up %0A * the basic building blocks of a network. In actuality, these nodes may be routers, %0A * switches, or even complete networks. While we do not refer to them %0A * with any particular name in this project, it is easier to think of them as router %0A * devices that send and receive packets of data to other routers within the same network.%0A */%0Apackage Content;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A *%0A * @author Ahmed%0A */%0Apublic class Node implements Comparable%3CNode%3E %7B%0A    %0A    public final String name; //The display name of this node%0A    %0A    /* The ID of this node. In multilayer networks, this value MUST start with a 'u' %0A     * to indicate upper-layer nodes, and an 'l' to indicate lower layer nodes. */ %0A    public final String id;  %0A    %0A    public List%3CLink%3E adjacencies; //The adjacent edges connecting this node%0A    %0A    /* The shortest path to this node this value is initialized to Infinity by default, %0A     * as part of Dijkstra's algorithm. A node whose distance from another is marked as %0A     * Infinity is unreachable from the current node. This is a common sight in the case %0A     * of directed graphs. */%0A    public double minDistance = Double.POSITIVE_INFINITY; %0A    %0A    public Node previous; //The node preceding this node. %0A%0A    /**%0A     * Constructs a Node object with its ID and name. %0A     * %0A     * @param argId The ID of this node.%0A     * @param argName The name of this node. %0A     */%0A    public Node(String argId, String argName) %7B%0A        id = argId; %0A        name = argName;%0A        adjacencies = new ArrayList%3CLink%3E();%0A    %7D%0A    %0A    /**%0A     * Sets the distance to this node. This value is dynamically changed and calculated %0A     * as part of Dijkstra's algorithm. %0A     * %0A     * @param minDistance The value of the shortest path to a node. %0A     */%0A    public void setMinDistance(double minDistance) %7B%0A        this.minDistance = minDistance;%0A    %7D%0A    %0A    /**%0A     * Sets the node preceding this node. This is needed, for example,  %0A     * to display the actual shortest path taken rather than its cost. %0A     * %0A     * @param previous The previous node. %0A     */%0A    public void setPrevious(Node previous) %7B%0A        this.previous = previous;%0A    %7D%0A    %0A    /**%0A     * Adds a new adjacent link to connect to a node. %0A     * %0A     * @param link The link to connect to the current node. %0A     */%0A    public void addEdge(Link link) %7B%0A        adjacencies.add(link);%0A    %7D%0A    %0A    /** %0A     * Returns the name of this node. This value can be anything as long as it fits %0A     * the current scenario. For readability reasons, in multilayer networks, the name%0A     * should end with a numerical value representing the layer to which it belongs. %0A     * As a general rule, nodes in the upper layer are referred to as A0, B0, etc.%0A     * whereas nodes in the lower layer are referred to as A1, B1, and so on.%0A     * %0A     * @return The name of this node. %0A     */ %0A    public String toString() %7B%0A        return name; %0A    %7D%0A    %0A    /**%0A     * Helper function to compare the distances of two nodes. %0A     * %0A     * @param other The node whose distance is to be compared with. %0A     * @return Returns a numerical value indicating which is smaller/larger. %0A     */%0A    public int compareTo(Node other) %7B%0A        return Double.compare(minDistance, other.minDistance);%0A    %7D%0A%7D%0A

Create Node.java