@Test public void testJBC() { DGraph<String> graph = Graphs.jbcDirected(); List<Integer> nodes = Arrays.asList(13, 15, 16); DGraph<String> subgraph = Subgraph.dSubgraphIndices(graph, nodes); System.out.println(subgraph); assertEquals(3, subgraph.size()); assertEquals(2, subgraph.numLinks()); }
public static <L> DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes) { List<DNode<L>> list = new ArrayList<DNode<L>>(); for(int i : nodes) list.add(graph.nodes().get(i)); return dSubgraph(graph, list); }
Subgraph { public static <L> DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes) { List<DNode<L>> list = new ArrayList<DNode<L>>(); for(int i : nodes) list.add(graph.nodes().get(i)); return dSubgraph(graph, list); } }
Subgraph { public static <L> DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes) { List<DNode<L>> list = new ArrayList<DNode<L>>(); for(int i : nodes) list.add(graph.nodes().get(i)); return dSubgraph(graph, list); }  }
Subgraph { public static <L> DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes) { List<DNode<L>> list = new ArrayList<DNode<L>>(); for(int i : nodes) list.add(graph.nodes().get(i)); return dSubgraph(graph, list); }  static UTGraph<L, T> utSubgraph(UTGraph<L, T> graph, Collection<UTNode<L, T>> nodes); static UTGraph<L, T> utSubgraphIndices(UTGraph<L, T> graph, Collection<Integer> nodes); static DTGraph<L, T> dtSubgraph(DTGraph<L, T> graph, Collection<DTNode<L, T>> nodes); static DTGraph<L, T> dtSubgraphIndices(DTGraph<L, T> graph, Collection<Integer> nodes); static DGraph<L> dSubgraph(DGraph<L> graph, Collection<DNode<L>> nodes); static DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes); static Graph<L> subgraph(Graph<L> graph, Collection<Node<L>> nodes); static Graph<L> subgraphIndices(Graph<L> graph, Collection<Integer> nodes); static UGraph<L> uSubgraph(UGraph<L> graph, Collection<UNode<L>> nodes); static UGraph<L> uSubgraphIndices(UGraph<L> graph, Collection<Integer> nodes); }
Subgraph { public static <L> DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes) { List<DNode<L>> list = new ArrayList<DNode<L>>(); for(int i : nodes) list.add(graph.nodes().get(i)); return dSubgraph(graph, list); }  static UTGraph<L, T> utSubgraph(UTGraph<L, T> graph, Collection<UTNode<L, T>> nodes); static UTGraph<L, T> utSubgraphIndices(UTGraph<L, T> graph, Collection<Integer> nodes); static DTGraph<L, T> dtSubgraph(DTGraph<L, T> graph, Collection<DTNode<L, T>> nodes); static DTGraph<L, T> dtSubgraphIndices(DTGraph<L, T> graph, Collection<Integer> nodes); static DGraph<L> dSubgraph(DGraph<L> graph, Collection<DNode<L>> nodes); static DGraph<L> dSubgraphIndices(DGraph<L> graph, Collection<Integer> nodes); static Graph<L> subgraph(Graph<L> graph, Collection<Node<L>> nodes); static Graph<L> subgraphIndices(Graph<L> graph, Collection<Integer> nodes); static UGraph<L> uSubgraph(UGraph<L> graph, Collection<UNode<L>> nodes); static UGraph<L> uSubgraphIndices(UGraph<L> graph, Collection<Integer> nodes);  }