|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mates.sim.network.Topology
Class for storing the network topology.
Nested Class Summary | |
class |
Topology.AllPairsShortestPathData
Class containing both the distances and route table for the shortest path between all pairs of hosts. |
class |
Topology.SingleSourceShortestPathData
Class containing both the distances and routes for the shortest path between one host and all other hosts. |
protected class |
Topology.TopologyBundle
Specialized threading bundle for parallelized updating of the topology. |
Constructor Summary | |
Topology()
Default constructor for a network of no hosts. |
|
Topology(Topology t)
Copy constructor; makes sure everything is cloned properly. |
|
Topology(java.util.Vector hosts,
LinkModel link_model)
Creates a new topology from a given set of hosts, determining their connectivity from the provided link model. |
Method Summary | |
Topology.AllPairsShortestPathData |
allPairsShortestPath()
Returns the all pairs shortest path matrix for this topology, calculated using Floyd and Warshall's algorithm. |
int |
calculateDiameter()
Calculates the diameter of this topology. |
static int |
calculateDiameter(double[][] graph)
Calculates the diameter of a graph. |
double |
calculateEccentricity(Host host)
Returns the eccentricity of a host. |
static int |
calculateRadius(double[][] graph,
int vertex)
Calculates the radius of the provided graph (represented by an adjacency matrix) from a specific vertex's perspective. |
int |
calculateRadius(Host host)
Calculates the radius of a specific host in this topology. |
double[] |
calculateStationaryDistribution()
Calculates the stationary distribution for this topology using the PageRank iterative improvement approximation algorithm. |
static double[] |
calculateStationaryDistribution(double[][] adjacency)
Calculates the stationary distribution of a graph (represented as an adjacency matrix) using the PageRank iterative improvement approximation algorithm. |
static double[] |
calculateStationaryDistribution(double[][] adjacency,
int iterations,
double damping_factor)
Calculates the stationary distribution of a graph (represented as an adjacency matrix) using the PageRank iterative improvement approximation algorithm. |
double[][] |
getAdjacency()
Returns a weighted adjacency matrix representation of the topology. |
java.util.Vector |
getCommunicableHosts(Host host)
Returns a vector of all of the hosts that the provided host can communicate with. |
int[] |
getDegreeDistribution()
Returns the current degree distribution of the topology. |
Host |
getHostByIndex(int index)
Accessor function for a host in the topology, based on its index. |
int |
getHostIndex(Host host)
Returns the index of the provided host. |
java.lang.String[] |
getHostNames()
Returns an array of the names of the hosts in this topology. |
double |
getLinkQuality(Host host1,
Host host2)
Returns the link quality between two hosts in the topology. |
java.util.Vector |
getNeighbors(Host host)
This is equivalent to getNeighborsHostCanTalkTo(Host) . |
java.util.Vector |
getNeighborsHostCanHear(Host host)
Returns a vector of all of a host's neighbors that are capable of sending messages to the provided host. |
java.util.Vector |
getNeighborsHostCanTalkTo(Host host)
Returns a vector of all of a host's neighbors that are capable of receiving messages from the provided host. |
int |
getNumHosts()
Returns the number of hosts in the topology. |
static int[] |
getRoute(int[][] predecessorMatrix,
int i,
int j)
Returns an array of integers representing the shortest path (i.e. |
int |
numCommunicableHosts(Host host)
Returns the number of hosts that the provided host is connected to. |
static int[][] |
predecessorMatrixToRouteTable(int[][] predecessorMatrix)
Converts a predecessor matrix into a route table. |
void |
process(Bundle bundle)
Callback function for processing a Topology.TopologyBundle .
|
Topology.SingleSourceShortestPathData |
singleSourceShortestPath(Host host)
Calculates the shortest path from host to every
other host in the network, using Dijkstra's algorithm
implemented with a FibonacciHeap . |
void |
update(Host host1,
Host host2,
double link)
Manually updates the link quality between two hosts. |
void |
update(java.util.Vector hosts,
LinkModel link_model)
Updates this topology with a new set of hosts. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Topology()
public Topology(java.util.Vector hosts, LinkModel link_model)
update(Vector, LinkModel)
public Topology(Topology t)
Method Detail |
public void process(Bundle bundle)
Topology.TopologyBundle
.
This function is called by threads created by an internal
instance of a BatchProcessor
.
process
in interface Processor
public void update(java.util.Vector hosts, LinkModel link_model)
public java.lang.String[] getHostNames()
Host.getName()
public int[] getDegreeDistribution()
getNumHosts()
+1
. If there are no hosts
in the topology, null
is returned. The ith
element of the returned array will be set to the number of
hosts that have degree i. The degree of a host is the
number of outgoing edges from it. For example, if
getDegreeDistribution()[0] == 5
, then there are 5
hosts in the topology with no outgoing edges.
public static int[] getRoute(int[][] predecessorMatrix, int i, int j)
i
to
j
. The first element of the array will always
be i
(i.e. the length of the returned array
will always be greater than or equal to 1). If no route
exists between i
and j
, the
length of the route will be exactly 1. If a route does
exist, the last element of the returned array will be equal
to j
.
public static int[][] predecessorMatrixToRouteTable(int[][] predecessorMatrix)
public Topology.SingleSourceShortestPathData singleSourceShortestPath(Host host)
host
to every
other host in the network, using Dijkstra's algorithm
implemented with a FibonacciHeap
.
public Topology.AllPairsShortestPathData allPairsShortestPath()
public double calculateEccentricity(Host host)
host
to
any other host in the network.
public static int calculateRadius(double[][] graph, int vertex)
vertex
.
graph
- an adjacency matrix representation of a graphvertex
- the index of the vertex (with respect to its representation in the adjacency matrix)
0
is returned on error.public static int calculateDiameter(double[][] graph)
public int calculateDiameter()
public int calculateRadius(Host host)
calculateRadius(double[][], int)
public void update(Host host1, Host host2, double link)
public java.util.Vector getNeighborsHostCanHear(Host host)
getNeighborsHostCanTalkTo(Host)
public java.util.Vector getNeighborsHostCanTalkTo(Host host)
getNeighborsHostCanHear(Host)
public java.util.Vector getNeighbors(Host host)
getNeighborsHostCanTalkTo(Host)
.
public int numCommunicableHosts(Host host)
public java.util.Vector getCommunicableHosts(Host host)
public Host getHostByIndex(int index)
null
on error.
public int getHostIndex(Host host)
public double[][] getAdjacency()
public int getNumHosts()
public double getLinkQuality(Host host1, Host host2)
java.lang.IllegalArgumentException
- if either of the provided
hosts is not in this topology.public double[] calculateStationaryDistribution()
public static double[] calculateStationaryDistribution(double[][] adjacency)
calculateStationaryDistribution(double[][], int,
double)
with adjacency.length*100
iterations and a
damping factor of 0.15
.
public static double[] calculateStationaryDistribution(double[][] adjacency, int iterations, double damping_factor)
adjacency
- the adjacency matrix representation of the graphiterations
- the number of iterations to run the algorithmdamping_factor
- damping factor required by the PageRank algorithm
|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |