bcds.phison.gm
Interface GraphMetric<V,E>

All Superinterfaces:
WithEnvParams
All Known Implementing Classes:
AlgebraicConnectivity, Assortativity, AverageEdgeBC, AverageNeighborConnectivity, AverageNodeBC, AvgPathLength, AvgTwoTermReliability, BrandesBC, CheegerConstantBruteForce, ClusteringCoeff, ConnectivityMatrixSpectralRadius, Density, Diameter, EdgeSetSize, Heterogeneity, LinkConnectivity, MaxNodeDegree, NodeConnectivity, OutNodeDegree, SpectralRadius, Spreaders, SymmetryRatio, VertexSetSize

public interface GraphMetric<V,E>
extends WithEnvParams

A graph metric is a measure of some property of the graph, its nodes or edges. In this implementation, it is assumed that all metrics have numeric value, and that they all "fit" into a double. The purpose of this interface is to facilitate operating on collections of graph metric calculators without needing to know too much about each calculator's peculiarities/parameters.

A graph metric class has environment parameters that callers can use to alter its behaviour. The main method is run. The results are returned to the caller through the various getXXXMetric methods.

In general, repeated call to a getXXXMetric method will return the same value, unless a call to setup is made in between.

Author:
Juan Segovia S.

Method Summary
 void dump(java.io.Writer wr)
          Dumps internal information (if any) to wr.
 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.util.Map<E,java.lang.Double> getEdgeMetric()
          Returns the values of the metric, one per edge.
 double getGraphMetric()
          Returns the value of the metric applied to the whole graph.
 double getGraphMetricStdev()
          Returns the value of the standard deviation of the metric applied to the whole graph.
 java.lang.String getLabel()
          Returns a string that can be used when printing this metric, for example, "Clustering coefficient";
 java.util.Map<V,java.lang.Double> getNodeMetric()
          Returns the values of the metric, one per node.
 boolean isApplicableTo(MetricTarget m)
          Returns true if this class supports the computation of the metric on the given element type.
 void run()
          Computes the metric.
 void setup(SimGraph<V,E> g, Environ env)
          (Re)initializes a graph metric instance.
 
Methods inherited from interface bcds.phison.WithEnvParams
getEnviron, getEnvParams, getName
 

Method Detail

setup

void setup(SimGraph<V,E> g,
           Environ env)
(Re)initializes a graph metric instance. Validates the environment parameters and leaves the object as if it has just been instantiated.


run

void run()
Computes the metric. Unless the metric is extremely simple to obtain, all computations must be performed in this method, leaving the getXXX methods the role of providing the results to the caller.

When loaded dynamically, this method can expect a hint of what "target" (graph, node, edge) its caller is aiming at. The hint is given in the environment parameter "GraphMetric.target", which must point to an object of type MetricTarget. This is usefull when a given class supports more than one target and computing all the possible values is wasteful (see for example BrandesBC). Note that this parameter need not be decleared in getEnvParams but some sane default behaviour should be assumed if not present.


isApplicableTo

boolean isApplicableTo(MetricTarget m)
Returns true if this class supports the computation of the metric on the given element type. Returning true for:


getLabel

java.lang.String getLabel()
Returns a string that can be used when printing this metric, for example, "Clustering coefficient";


getDescription

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.


getGraphMetric

double getGraphMetric()
Returns the value of the metric applied to the whole graph.


getGraphMetricStdev

double getGraphMetricStdev()
Returns the value of the standard deviation of the metric applied to the whole graph.


getNodeMetric

java.util.Map<V,java.lang.Double> getNodeMetric()
Returns the values of the metric, one per node.


getEdgeMetric

java.util.Map<E,java.lang.Double> getEdgeMetric()
Returns the values of the metric, one per edge.


dump

void dump(java.io.Writer wr)
Dumps internal information (if any) to wr.