Skip to content

Instantly share code, notes, and snippets.

@digorithm
Created October 7, 2014 18:19
Show Gist options
  • Save digorithm/8a9dabafe2e31ba323d3 to your computer and use it in GitHub Desktop.
Save digorithm/8a9dabafe2e31ba323d3 to your computer and use it in GitHub Desktop.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package GraphModels;
/**
*
* @author rodrigo
*/
public class Edge {
/* This Data Structure will be capable to represent a Edge,
* that will be used on a graph
*/
public String id;
public Vertex source;
public Vertex destination;
private final int weight;
public Edge(String id, Vertex source, Vertex destination, int weight) {
this.id = id;
this.source = source;
this.destination = destination;
this.weight = weight;
}
public String getId() {
return id;
}
public Vertex getDestination() {
return destination;
}
public Vertex getSource() {
return source;
}
public int getWeight() {
return weight;
}
@Override
public String toString() {
return source + " " + destination;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment