Class SimilarItemsGraph.Edge
java.lang.Object
org.troy.capstone.data_structures.SimilarItemsGraph.Edge
- Enclosing class:
SimilarItemsGraph
Inner class to represent an edge in the graph.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) intReturns the destination index of this edge.toString()Returns a string representation of the edge, including the destination index and weight.
-
Field Details
-
destIndex
int destIndexThe index of the destination item that this edge points to. -
weight
float weightThe 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 theEdgeclass. 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:
destIndexshould be a valid item index corresponding to an item in the graph.weightshould be a non-negative float.- Postconditions:
- An
Edgeinstance 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
-
getDestIndex
int getDestIndex()Returns the destination index of this edge.- Returns:
- The destination index of this edge.
-