@Test public void testGetWeight() { System.out.println("getWeight"); assertEquals(0.0, g1.getWeight(1, 2), 1E-10); assertEquals(0.0, g1.getWeight(1, 1), 1E-10); assertEquals(1.0, g2.getWeight(1, 2), 1E-10); assertEquals(1.0, g2.getWeight(2, 1), 1E-10); assertEquals(1.0, g3.getWeight(1, 2), 1E-10); assertEquals(1.0, g3.getWeight(2, 1), 1E-10); assertEquals(1.0, g3.getWeight(3, 2), 1E-10); assertEquals(1.0, g3.getWeight(2, 3), 1E-10); assertEquals(1.0, g3.getWeight(1, 3), 1E-10); assertEquals(1.0, g3.getWeight(3, 1), 1E-10); assertEquals(0.0, g3.getWeight(4, 2), 1E-10); assertEquals(0.0, g4.getWeight(1, 4), 1E-10); g4.addEdge(1, 4); assertEquals(1.0, g4.getWeight(1, 4), 1E-10); assertEquals(0.0, g5.getWeight(1, 2), 1E-10); assertEquals(0.0, g5.getWeight(1, 1), 1E-10); assertEquals(1.0, g6.getWeight(1, 2), 1E-10); assertEquals(1.0, g6.getWeight(2, 1), 1E-10); assertEquals(1.0, g7.getWeight(1, 2), 1E-10); assertEquals(1.0, g7.getWeight(2, 1), 1E-10); assertEquals(1.0, g7.getWeight(3, 2), 1E-10); assertEquals(1.0, g7.getWeight(2, 3), 1E-10); assertEquals(1.0, g7.getWeight(1, 3), 1E-10); assertEquals(1.0, g7.getWeight(3, 1), 1E-10); assertEquals(0.0, g7.getWeight(4, 2), 1E-10); assertEquals(1.0, g8.getWeight(1, 4), 1E-10); }
@Override public double getWeight(int source, int target) { return graph[source][target]; }
AdjacencyMatrix implements Graph { @Override public double getWeight(int source, int target) { return graph[source][target]; } }
AdjacencyMatrix implements Graph { @Override public double getWeight(int source, int target) { return graph[source][target]; } AdjacencyMatrix(int n);  AdjacencyMatrix(int n, boolean digraph); }
AdjacencyMatrix implements Graph { @Override public double getWeight(int source, int target) { return graph[source][target]; } AdjacencyMatrix(int n);  AdjacencyMatrix(int n, boolean digraph); @Override int getNumVertices(); @Override boolean hasEdge(int source, int target); @Override double getWeight(int source, int target); @Override AdjacencyMatrix setWeight(int source, int target, double weight); @Override Collection<Edge> getEdges(); @Override Collection<Edge> getEdges(int vertex); @Override Collection<Edge> getEdges(int source, int target); @Override Edge getEdge(int source, int target); @Override void addEdge(int source, int target); @Override void addEdge(int source, int target, double weight); @Override void removeEdges(Collection<Edge> edges); @Override void removeEdge(int source, int target); @Override void removeEdge(Edge edge); @Override int getDegree(int vertex); @Override int getIndegree(int vertex); @Override int getOutdegree(int vertex); @Override int[] sortdfs(); @Override int[][] dfs(); @Override void dfs(Visitor visitor); @Override int[] sortbfs(); @Override int[][] bfs(); @Override void bfs(Visitor visitor); @Override double[] dijkstra(int s); double[] dijkstra(int s, boolean weighted); @Override AdjacencyMatrix subgraph(int[] vertices); double[][] toArray(); double pushRelabel(double[][] flow, int source, int sink); @Override Matrix toMatrix(); }
AdjacencyMatrix implements Graph { @Override public double getWeight(int source, int target) { return graph[source][target]; } AdjacencyMatrix(int n);  AdjacencyMatrix(int n, boolean digraph); @Override int getNumVertices(); @Override boolean hasEdge(int source, int target); @Override double getWeight(int source, int target); @Override AdjacencyMatrix setWeight(int source, int target, double weight); @Override Collection<Edge> getEdges(); @Override Collection<Edge> getEdges(int vertex); @Override Collection<Edge> getEdges(int source, int target); @Override Edge getEdge(int source, int target); @Override void addEdge(int source, int target); @Override void addEdge(int source, int target, double weight); @Override void removeEdges(Collection<Edge> edges); @Override void removeEdge(int source, int target); @Override void removeEdge(Edge edge); @Override int getDegree(int vertex); @Override int getIndegree(int vertex); @Override int getOutdegree(int vertex); @Override int[] sortdfs(); @Override int[][] dfs(); @Override void dfs(Visitor visitor); @Override int[] sortbfs(); @Override int[][] bfs(); @Override void bfs(Visitor visitor); @Override double[] dijkstra(int s); double[] dijkstra(int s, boolean weighted); @Override AdjacencyMatrix subgraph(int[] vertices); double[][] toArray(); double pushRelabel(double[][] flow, int source, int sink); @Override Matrix toMatrix();  }