info.debatty.java.graphs.Edge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-graphs Show documentation
Show all versions of java-graphs Show documentation
Algorithms that build k-nearest neighbors graph (k-nn graph): Brute-force, NN-Descent,...
package info.debatty.java.graphs;
/**
* Represent a weighted edge (a link from node n1 to node n2)
* @author Thibault Debatty
*/
public class Edge {
public Node n1;
public Node n2;
public double weight = 0;
public static final String SEPARATOR = ";";
public Edge() {
}
public Edge(Node n1, Node n2, double weight) {
this.n1 = n1;
this.n2 = n2;
this.weight = weight;
}
@Override
public String toString() {
return n1.id + SEPARATOR + n2.id + SEPARATOR + weight;
}
}