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's `Comparator`, 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 final GEdgeWeightMetric<?>`
  `NATURAL_METRIC`
  `static final GEdgeWeightMetric<?>`
  `UNIT_METRIC`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `computeWeight(E e)`
  Compute or retrieve the weight of the given edge
  `static <V, E extends GEdge<V>>
  GEdgeWeightMetric<E>`
  `naturalMetric()`
  Use the natural weight of each edge The metric assumes every edge is a `GWeightedEdge`.
  `static <V, E extends GEdge<V>>
  GEdgeWeightMetric<E>`
  `unitMetric()`
  Measure every edge as having a weight of 1

- ## Field Details

  - ### UNIT_METRIC

    static final GEdgeWeightMetric<?> UNIT_METRIC

  - ### NATURAL_METRIC

    static final GEdgeWeightMetric<?> NATURAL_METRIC

- ## Method Details

  - ### 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 a `GWeightedEdge`. If not, you will likely encounter a `ClassCastException`.
    Returns:
      the metric

  - ### computeWeight

    double computeWeight(E e)
    Compute or retrieve the weight of the given edge
    Parameters:
      `e` - the edge
    Returns:
      the weight