|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GraphMetric<V,E>
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.
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 |
---|
void setup(SimGraph<V,E> g, Environ env)
void run()
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.
boolean isApplicableTo(MetricTarget m)
MetricTarget.GRAPH
means that getGraphMetric()
is supported.
MetricTarget.NODE
means that getNodeMetric()
is supported.
MetricTarget.EDGE
means that getEdgeMetric()
is supported.
java.lang.String getLabel()
java.lang.String getDescription()
double getGraphMetric()
double getGraphMetricStdev()
java.util.Map<V,java.lang.Double> getNodeMetric()
java.util.Map<E,java.lang.Double> getEdgeMetric()
void dump(java.io.Writer wr)
wr
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |