@Test public void testGetOutdegree() { System.out.println("getOutdegree"); assertEquals(0, g1.getOutdegree(1)); assertEquals(1, g2.getOutdegree(1)); g2.addEdge(1, 1); assertEquals(2, g2.getOutdegree(1)); assertEquals(2, g3.getOutdegree(1)); assertEquals(2, g3.getOutdegree(2)); assertEquals(2, g3.getOutdegree(3)); assertEquals(1, g4.getOutdegree(4)); assertEquals(0, g5.getOutdegree(1)); assertEquals(1, g6.getOutdegree(1)); g6.addEdge(1, 1); assertEquals(2, g6.getOutdegree(1)); assertEquals(2, g7.getOutdegree(1)); assertEquals(2, g7.getOutdegree(2)); assertEquals(2, g7.getOutdegree(3)); assertEquals(2, g8.getOutdegree(4)); }
@Override public int getOutdegree(int vertex) { return graph[vertex].size(); }
AdjacencyList implements Graph { @Override public int getOutdegree(int vertex) { return graph[vertex].size(); } }
AdjacencyList implements Graph { @Override public int getOutdegree(int vertex) { return graph[vertex].size(); } AdjacencyList(int n); @SuppressWarnings("unchecked")  AdjacencyList(int n, boolean digraph); }
AdjacencyList implements Graph { @Override public int getOutdegree(int vertex) { return graph[vertex].size(); } AdjacencyList(int n); @SuppressWarnings("unchecked")  AdjacencyList(int n, boolean digraph); @Override int getNumVertices(); @Override boolean hasEdge(int source, int target); @Override double getWeight(int source, int target); @Override AdjacencyList 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); @Override AdjacencyList subgraph(int[] vertices); @Override SparseMatrix toMatrix(); static AdjacencyList of(SparseMatrix matrix); }
AdjacencyList implements Graph { @Override public int getOutdegree(int vertex) { return graph[vertex].size(); } AdjacencyList(int n); @SuppressWarnings("unchecked")  AdjacencyList(int n, boolean digraph); @Override int getNumVertices(); @Override boolean hasEdge(int source, int target); @Override double getWeight(int source, int target); @Override AdjacencyList 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); @Override AdjacencyList subgraph(int[] vertices); @Override SparseMatrix toMatrix(); static AdjacencyList of(SparseMatrix matrix);  }