bcds.phison.gm
Class AvgPathLength<V,E>

java.lang.Object
  extended by bcds.phison.gm.GraphMetricBase<V,E>
      extended by bcds.phison.gm.Diameter<V,E>
          extended by bcds.phison.gm.AvgPathLength<V,E>
All Implemented Interfaces:
GraphMetric<V,E>, WithEnvParams
Direct Known Subclasses:
Heterogeneity, MaxNodeDegree

public class AvgPathLength<V,E>
extends Diameter<V,E>
implements GraphMetric<V,E>

Computes the average of the shortest path lengths in the topology, where the link weights are all 1 (hop count). It reuses Diameter so that getGraphMetric returns Diameter.getAvgShortestPath. Note that it is wasteful to run both Diameter and AvgPathLength, because the same computations are performed twice, but only the caller might know of that situation or be able to avoid it.

Author:
Juan Segovia S.

Constructor Summary
AvgPathLength()
          Default constructor.
AvgPathLength(SimGraph<V,E> g, Environ env)
          Creates a new instance and calls setup to complete the initialization.
 
Method Summary
 java.lang.String getDescription()
          Returns a description of this metric.
 double getGraphMetric()
          Returns the average path length.
 double getGraphMetricStdev()
          Returns the average path length.
 java.lang.String getLabel()
          Returns the string {@literal "Avg.
 
Methods inherited from class bcds.phison.gm.Diameter
getAvgShortestPath, getAvgShortestPathStdev, getEnvParams, getLongestPath, isApplicableTo, run, setup
 
Methods inherited from class bcds.phison.gm.GraphMetricBase
dump, getEdgeMetric, getEnviron, getGraph, 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, getNodeMetric, isApplicableTo, run, setup
 
Methods inherited from interface bcds.phison.WithEnvParams
getEnviron, getEnvParams, getName
 

Constructor Detail

AvgPathLength

public AvgPathLength()
Default constructor.


AvgPathLength

public AvgPathLength(SimGraph<V,E> g,
                     Environ env)
Creates a new instance and calls setup to complete the initialization.

Method Detail

getGraphMetric

public double getGraphMetric()
Returns the average path length.

Specified by:
getGraphMetric in interface GraphMetric<V,E>
Overrides:
getGraphMetric in class Diameter<V,E>

getGraphMetricStdev

public double getGraphMetricStdev()
Returns the average path length.

Specified by:
getGraphMetricStdev in interface GraphMetric<V,E>
Overrides:
getGraphMetricStdev in class GraphMetricBase<V,E>

getLabel

public java.lang.String getLabel()
Returns the string "Avg. path length".

Specified by:
getLabel in interface GraphMetric<V,E>
Overrides:
getLabel in class Diameter<V,E>

getDescription

public java.lang.String getDescription()
Returns a description of this metric.

Specified by:
getDescription in interface GraphMetric<V,E>
Overrides:
getDescription in class Diameter<V,E>