All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.debatty.java.graphs.Edge Maven / Gradle / Ivy

Go to download

Algorithms that build k-nearest neighbors graph (k-nn graph): Brute-force, NN-Descent,...

There is a newer version: 0.41
Show newest version
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;
        
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy