org.nd4j.autodiff.graph.api.Edge Maven / Gradle / Ivy
package org.nd4j.autodiff.graph.api;
import lombok.Data;
/** Edge in a graph. May be a directed or undirected edge.
* Parameterized, and may store a value/object associated with the edge
*/
@Data
public class Edge {
private final int from;
private final int to;
private final T value;
private final boolean directed;
public Edge(int from, int to, T value, boolean directed) {
this.from = from;
this.to = to;
this.value = value;
this.directed = directed;
}
@Override
public String toString() {
return "edge(" + (directed ? "directed" : "undirected") + "," + from + (directed ? "->" : "--") + to + ","
+ (value != null ? value : "") + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy