import distanceMatrix[routerId][routerId] = 0; for( Integer router :

import java.util.HashMap;

public class Router {

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

private int routerId;
private Integer distanceMatrix;
private HashMap neighbours;
private Integer outgoingDistanceVector;
private int totalRouters;

public Router(int routerId, int totalRouters, HashMap neighbours) {
this.routerId = routerId;
this.totalRouters = totalRouters;
this.neighbours = neighbours;

// Updates a weight on an edge to a neighbour
public void updateWeightToNeighbours(Integer neighbour, Integer newWeight) {
neighbours.put(neighbour, newWeight);
distanceMatrixneighbourrouterId = newWeight;

// Setting up initial distance matrix
private void initializeDistanceMatrix() {
distanceMatrix = new IntegertotalRouterstotalRouters;
distanceMatrixrouterIdrouterId = 0;
for( Integer router : neighbours.keySet()) {
distanceMatrixrouterrouterId = neighbours.get(router);

// Extracts the distance vector from the distance matrix
private void createOutgoingVector() {
outgoingDistanceVector = new IntegertotalRouters;
for( int i = 0; i


I'm Rick!

Would you like to get a custom essay? How about receiving a customized one?

Check it out