|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.phison.gm.GraphMetricBase<V,E>
bcds.phison.gm.Diameter<V,E>
public class Diameter<V,E>
Computes the network diameter, identifies the path that
corresponds to that diameter and computes the average of
the shortest paths.
This implementations uses MinHop
for finding the shortest paths.
It is required that each link is present in its two directions, that
is, that the graph is "undirected" in practice.
If the graph is disconnected, a runtime exception is thrown.
By default, the link cost is 1, so that the shortest path is the one with the fewer hops. To use another link cost, a non-null value can be put in the environment parameter cost_map.
Constructor Summary | |
---|---|
Diameter()
Default constructor. |
|
Diameter(SimGraph<V,E> g,
Environ env)
Creates a new instance and calls setup to complete the initialization. |
Method Summary | |
---|---|
float |
getAvgShortestPath()
Returns the average of the shortest paths, computed by run. |
float |
getAvgShortestPathStdev()
Returns the standard deviation of the average of the shortest paths, computed by run. |
java.lang.String |
getDescription()
Returns a string describing the metric, for example, article where it has been published, URL where to find reference implementation, etc. |
java.lang.Object[] |
getEnvParams()
Returns the environment parameters used by this class. |
double |
getGraphMetric()
Returns the network diameter. |
java.lang.String |
getLabel()
Returns the string "Diameter". |
Path<V,E> |
getLongestPath()
Returns the path that corresponds to the diameter, computed by run. |
boolean |
isApplicableTo(MetricTarget m)
Returns true if m is MetricTarget.GRAPH . |
void |
run()
Computes all the metrics offered by this class and store them for later retrieval. |
void |
setup(SimGraph<V,E> g,
Environ env)
Makes sure all links in the topology are bidirectional. |
Methods inherited from class bcds.phison.gm.GraphMetricBase |
---|
dump, getEdgeMetric, getEnviron, getGraph, getGraphMetricStdev, getName, getNodeMetric |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bcds.phison.gm.GraphMetric |
---|
dump, getEdgeMetric, getGraphMetricStdev, getNodeMetric |
Methods inherited from interface bcds.phison.WithEnvParams |
---|
getEnviron, getName |
Constructor Detail |
---|
public Diameter()
public Diameter(SimGraph<V,E> g, Environ env)
Method Detail |
---|
public boolean isApplicableTo(MetricTarget m)
m
is MetricTarget.GRAPH
.
isApplicableTo
in interface GraphMetric<V,E>
isApplicableTo
in class GraphMetricBase<V,E>
public void setup(SimGraph<V,E> g, Environ env)
setup
in interface GraphMetric<V,E>
setup
in class GraphMetricBase<V,E>
java.lang.IllegalArgumentException
- if there a exists a link with
only one direction.
java.lang.RuntimeException
- if "cost_map" is not a map
of edges to numbers.public void run()
run
in interface GraphMetric<V,E>
run
in class GraphMetricBase<V,E>
java.lang.IllegalArgumentException
- if the graph is not fully connected.public double getGraphMetric()
getGraphMetric
in interface GraphMetric<V,E>
getGraphMetric
in class GraphMetricBase<V,E>
public java.lang.String getLabel()
getLabel
in interface GraphMetric<V,E>
public java.lang.String getDescription()
GraphMetric
getDescription
in interface GraphMetric<V,E>
public Path<V,E> getLongestPath()
public float getAvgShortestPath()
public float getAvgShortestPathStdev()
public java.lang.Object[] getEnvParams()
cost_map
(default: null): a non-null map
suitable for use as link cost map with
TED
.
getEnvParams
in interface WithEnvParams
getEnvParams
in class GraphMetricBase<V,E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |