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.
    • 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 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