diff --git a/src/main/java/it/unibz/inf/isochrone/network/Link.java b/src/main/java/it/unibz/inf/isochrone/network/Link.java
index c08c583eab4ae9e828048401b7fdfb7ff9bf6a00..c72a43dcf7f2011f695764bb8b39f8d602972f15 100644
--- a/src/main/java/it/unibz/inf/isochrone/network/Link.java
+++ b/src/main/java/it/unibz/inf/isochrone/network/Link.java
@@ -5,9 +5,8 @@ package it.unibz.inf.isochrone.network;
  * and either a linkCost or a routeId depending on whether the link is
  * continuous or discrete.
  */
-public class Link {
+public class Link extends NetworkEntity {
 	private static final double LENGTH_RESOLUTION = 0.01d;
-	private final int id;
 	private final int startNode;
 	private final int endNode;
 	private final boolean continuous;
@@ -25,7 +24,7 @@ public class Link {
 	 * @param length the costs of the link (also called length)
 	 */
 	public Link(final int id, final int startNodeId, final int endNodeId, final double length) {
-		this.id = id;
+		super(id);
 		this.startNode = startNodeId;
 		this.endNode = endNodeId;
 		this.length = length;
@@ -42,7 +41,7 @@ public class Link {
 	 * @param routeId the id of the route this link belongs to
 	 */
 	public Link(final int id, final int startNodeId, final int endNodeId, final int routeId) {
-		this.id = id;
+		super(id);
 		this.startNode = startNodeId;
 		this.endNode = endNodeId;
 		this.route = routeId;
@@ -60,10 +59,6 @@ public class Link {
 		return endOffset;
 	}
 
-	public int getId() {
-		return id;
-	}
-
 	public double getLength() {
 		return length;
 	}
@@ -146,7 +141,7 @@ public class Link {
 		result = prime * result + endNode;
 		temp = Double.doubleToLongBits(endOffset);
 		result = prime * result + (int) (temp ^ (temp >>> 32));
-		result = prime * result + id;
+		result = prime * result + getId();
 		temp = Double.doubleToLongBits(length);
 		result = prime * result + (int) (temp ^ (temp >>> 32));
 		result = prime * result + route;
@@ -160,7 +155,7 @@ public class Link {
 
 	@Override
 	public String toString() {
-		return "Link [id=" + id + ", continuous=" + continuous + ", length=" + length + "]";
+		return "Link [id=" + getId() + ", continuous=" + continuous + ", length=" + length + "]";
 	}
 
 }
diff --git a/src/main/java/it/unibz/inf/isochrone/network/NetworkEntity.java b/src/main/java/it/unibz/inf/isochrone/network/NetworkEntity.java
new file mode 100644
index 0000000000000000000000000000000000000000..c62b39e2cb5a4033ef6e16b47fe98ddc4b36d7f6
--- /dev/null
+++ b/src/main/java/it/unibz/inf/isochrone/network/NetworkEntity.java
@@ -0,0 +1,58 @@
+package it.unibz.inf.isochrone.network;
+
+public class NetworkEntity implements Comparable<NetworkEntity> {
+	private final int id;
+
+	public NetworkEntity(final int id) {
+		this.id = id;
+	}
+
+	// Getter
+
+	public int getId() {
+		return id;
+	}
+
+	// Public method
+
+	@Override
+	public int compareTo(final NetworkEntity other) {
+		if (other == null) {
+			return -1;
+		}
+
+		return id - other.id;
+	}
+
+	@Override
+	public boolean equals(final Object obj) {
+		if (this == obj) {
+			return true;
+		}
+		if (obj == null) {
+			return false;
+		}
+		if (getClass() != obj.getClass()) {
+			return false;
+		}
+
+		final NetworkEntity other = (NetworkEntity) obj;
+		if (id != other.id) {
+			return false;
+		}
+
+		return true;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		return prime + id;
+	}
+
+	@Override
+	public String toString() {
+		return "NetworkEntity [id=" + id + "]";
+	}
+
+}
diff --git a/src/main/java/it/unibz/inf/isochrone/network/Node.java b/src/main/java/it/unibz/inf/isochrone/network/Node.java
index 5e593c26005c2d500d94eca2ef2d89ae229c7c04..1eb4637df094f288e4c7270bb87d805c6fd7f8ff 100644
--- a/src/main/java/it/unibz/inf/isochrone/network/Node.java
+++ b/src/main/java/it/unibz/inf/isochrone/network/Node.java
@@ -11,8 +11,7 @@ import java.util.Map;
  * Represent a node in a network.  The number of adjacent links is
  * used to track how many adjacent links have already been explored.
  */
-public class Node implements Comparable<Node> {
-	private final int id;
+public class Node extends NetworkEntity {
 	private final Map<Integer, Schedule> routes;
 
 	private double distance;
@@ -34,7 +33,7 @@ public class Node implements Comparable<Node> {
 	}
 
 	public Node(final int nodeId, final short nrAdjacentLinks) {
-		id = nodeId;
+		super(nodeId);
 		distance = Double.POSITIVE_INFINITY;
 		this.nrAdjacentLinks = nrAdjacentLinks;
 		closed = false;
@@ -59,10 +58,6 @@ public class Node implements Comparable<Node> {
 		return distance;
 	}
 
-	public int getId() {
-		return id;
-	}
-
 	public short getNrAdjacentLinks() {
 		return nrAdjacentLinks;
 	}
@@ -152,18 +147,23 @@ public class Node implements Comparable<Node> {
 	}
 
 	@Override
-	public int compareTo(final Node other) {
+	public int compareTo(final NetworkEntity other) {
 		if (other == null) {
 			return -1;
 		}
-		if (distance < other.distance) {
+		if (!(other instanceof Node)) {
+			return super.compareTo(other);
+		}
+
+		final Node n = (Node) other;
+		if (distance < n.distance) {
 			return -1;
 		}
-		if (distance > other.distance) {
+		if (distance > n.distance) {
 			return 1;
 		}
 
-		return id - other.id;
+		return getId() - n.getId();
 	}
 
 	public boolean containsRoutes() {
@@ -180,7 +180,7 @@ public class Node implements Comparable<Node> {
 		}
 
 		final Node other = (Node) obj;
-		if (id != other.id || Double.doubleToLongBits(distance) != Double.doubleToLongBits(other.distance)) {
+		if (getId() != other.getId() || Double.doubleToLongBits(distance) != Double.doubleToLongBits(other.distance)) {
 			return false;
 		}
 
@@ -195,7 +195,7 @@ public class Node implements Comparable<Node> {
 		final long temp = Double.doubleToLongBits(distance);
 		// CHECKSTYLE:OFF MagicNumber
 		result = prime * result + (int) (temp ^ temp >>> 32);
-		result = prime * result + id;
+		result = prime * result + getId();
 		// CHECKSTYLE:ON MagicNumber
 
 		return result;
@@ -203,7 +203,7 @@ public class Node implements Comparable<Node> {
 
 	@Override
 	public String toString() {
-		return "Node [id=" + id + ", distance=" + distance + "]";
+		return "Node [id=" + getId() + ", distance=" + distance + "]";
 	}
 
 	public void visitNrAdjacentLinks(final int links) {