Class SimilarItemsGraph.Edge

java.lang.Object
org.troy.capstone.data_structures.SimilarItemsGraph.Edge
Enclosing class:
SimilarItemsGraph

public static class SimilarItemsGraph.Edge extends Object
Inner class to represent an edge in the graph.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    The index of the destination item that this edge points to.
    (package private) float
    The weight of the edge, representing the similarity score between the source and destination items.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Edge(int destIndex, float weight)
    Constructor for the Edge class.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) int
    Returns the destination index of this edge.
    Returns a string representation of the edge, including the destination index and weight.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • destIndex

      int destIndex
      The index of the destination item that this edge points to.
    • weight

      float weight
      The weight of the edge, representing the similarity score between the source and destination items.
  • Constructor Details

    • Edge

      public Edge(int destIndex, float weight)
      Constructor for the Edge class. Initializes the destination index and weight of the edge.
      Parameters:
      destIndex - The index of the destination item that this edge points to.
      weight - The weight of the edge, representing the similarity score between the source and destination items.
      Preconditions:
      destIndex should be a valid item index corresponding to an item in the graph. weight should be a non-negative float.
      Postconditions:
      An Edge instance is created with the specified destination index and weight, representing an edge in the graph between two items with a certain similarity score.
  • Method Details

    • toString

      public String toString()
      Returns a string representation of the edge, including the destination index and weight.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the edge, including the destination index and weight.
    • getDestIndex

      int getDestIndex()
      Returns the destination index of this edge.
      Returns:
      The destination index of this edge.