Created
April 20, 2016 14:58
-
-
Save ibogun/ead180a1369d4fb527f5e56588bfb591 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package graphs; | |
public class WeightedGraph extends Graph { | |
private double[][] weights; | |
public WeightedGraph(int V) { | |
super(V); | |
weights = new double[V][V]; | |
} | |
public double getWeight(int from, int to) { | |
return weights[from][to]; | |
} | |
public void addWeightedDirectedEdge(int from, int to, double weight) { | |
weights[from][to] = weight; | |
super.addDirectedEdge(from, to); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment