Package ghidra.graph
Interface GEdgeWeightMetric<E extends GEdge<?>>
-
- Type Parameters:
E
- the type of the edge
public interface GEdgeWeightMetric<E extends GEdge<?>>
A callback to get the weight of an edge Analogous to Java'sComparator
, this provides a means to override the weight of an edge in a graph, or provide a weight in the absence of a natural weight, when executing various graph algorithms, e.g., shortest path.
-
-
Field Summary
Fields Modifier and Type Field Description static GEdgeWeightMetric<?>
NATURAL_METRIC
static GEdgeWeightMetric<?>
UNIT_METRIC
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description double
computeWeight(E e)
Compute or retrieve the weight of the given edgestatic <V,E extends GEdge<V>>
GEdgeWeightMetric<E>naturalMetric()
Use the natural weight of each edge The metric assumes every edge is aGWeightedEdge
.static <V,E extends GEdge<V>>
GEdgeWeightMetric<E>unitMetric()
Measure every edge as having a weight of 1
-
-
-
Field Detail
-
UNIT_METRIC
static final GEdgeWeightMetric<?> UNIT_METRIC
-
NATURAL_METRIC
static final GEdgeWeightMetric<?> NATURAL_METRIC
-
-
Method Detail
-
unitMetric
static <V,E extends GEdge<V>> GEdgeWeightMetric<E> unitMetric()
Measure every edge as having a weight of 1- Returns:
- the metric
-
naturalMetric
static <V,E extends GEdge<V>> GEdgeWeightMetric<E> naturalMetric()
Use the natural weight of each edge The metric assumes every edge is aGWeightedEdge
. If not, you will likely encounter aClassCastException
.- Returns:
- the metric
-
computeWeight
double computeWeight(E e)
Compute or retrieve the weight of the given edge- Parameters:
e
- the edge- Returns:
- the weight
-
-