@Test public void testLine() { UTGraph<String, String> line = Graphs.line(3, "x"); System.out.println(line); assertEquals(3, line.size()); UTNode<String, String> node = line.node("x"); System.out.println(line.nodes().get(1).links(line.nodes().get(2))); }
public static UTGraph<String, String> line(int n, String label) { UTGraph<String, String> graph = new MapUTGraph<String, String>(); if(n == 0) return graph; UTNode<String, String> last = graph.add(label), next; for(int i : series(n-1)) { next = graph.add(label); last.connect(next); last = next; } return graph; }
Graphs { public static UTGraph<String, String> line(int n, String label) { UTGraph<String, String> graph = new MapUTGraph<String, String>(); if(n == 0) return graph; UTNode<String, String> last = graph.add(label), next; for(int i : series(n-1)) { next = graph.add(label); last.connect(next); last = next; } return graph; } }
Graphs { public static UTGraph<String, String> line(int n, String label) { UTGraph<String, String> graph = new MapUTGraph<String, String>(); if(n == 0) return graph; UTNode<String, String> last = graph.add(label), next; for(int i : series(n-1)) { next = graph.add(label); last.connect(next); last = next; } return graph; }  }
Graphs { public static UTGraph<String, String> line(int n, String label) { UTGraph<String, String> graph = new MapUTGraph<String, String>(); if(n == 0) return graph; UTNode<String, String> last = graph.add(label), next; for(int i : series(n-1)) { next = graph.add(label); last.connect(next); last = next; } return graph; }  static UTGraph<L, T> shuffle(UTGraph<L, T> graph); static UTGraph<String, String> k(int size, String label); static DTGraph<String, String> dk(int size, String label); static UTGraph<String, String> line(int n, String label); static UTGraph<String, String> star(int n, String label); static UTGraph<String, String> ladder(int n, String label); static UTGraph<String, String> jbc(); static DTGraph<String, String> jbcDirected(); static UTGraph<String, String> single(String label); static List<Integer> degrees(Graph<?> graph); static List<Integer> inDegrees(DGraph<?> graph); static List<Integer> outDegrees(DGraph<?> graph); static void add(Graph<L> graph, Graph<L> addition); static void add(TGraph<L, T> graph, TGraph<L, T> addition); static UTGraph<String, String> reduce(UTGraph<L, T> graph); static Graph<String> blank(Graph<L> graph, String label); static UGraph<String> blank(UGraph<L> graph, String label); static DGraph<String> blank(DGraph<L> graph, String label); static UTGraph<String, String> blank(UTGraph<L, T> graph, String label); static DTGraph<String, String> blank(DTGraph<L, T> graph, String label); static Graph<L> reorder(Graph<L> graph, Order order); static UGraph<L> reorder(UGraph<L> graph, Order order); static DGraph<L> reorder(DGraph<L> graph, Order order); static UTGraph<L, T> reorder(UTGraph<L, T> graph, Order order); static DTGraph<L, T> reorder(DTGraph<L, T> graph, Order order); static String canonicalString(Graph<L> graph); static String canonicalString(DGraph<L> graph); static String canonicalString(UGraph<L> graph); static String canonicalString(DTGraph<L, T> graph); static String canonicalString(UTGraph<L, T> graph); static boolean isSimple(Graph<L> graph); static boolean hasSelfLoops(Graph<L> graph); static boolean hasMultiEdges(Graph<L> graph); static UGraph<L> toSimpleUGraph(Graph<L> data); static UGraph<L> toSimpleUGraph(Graph<L> data, FrequencyModel<Pair<Integer, Integer>> removals); static DGraph<L> toSimpleDGraph(DGraph<L> data); static DGraph<L> toSimpleDGraph(DGraph<L> data, FrequencyModel<Pair<Integer, Integer>> removals); static Collection<UGraph<String>> all(final int n, final String label); static List<UGraph<String>> allIso(int n, String label); static List<UGraph<String>> allIsoConnected(int n, String label); static boolean connected(UGraph<L> graph); static boolean connected(Graph<L> graph); static UGraph<String> fromBits(BitString bits, String label); }
Graphs { public static UTGraph<String, String> line(int n, String label) { UTGraph<String, String> graph = new MapUTGraph<String, String>(); if(n == 0) return graph; UTNode<String, String> last = graph.add(label), next; for(int i : series(n-1)) { next = graph.add(label); last.connect(next); last = next; } return graph; }  static UTGraph<L, T> shuffle(UTGraph<L, T> graph); static UTGraph<String, String> k(int size, String label); static DTGraph<String, String> dk(int size, String label); static UTGraph<String, String> line(int n, String label); static UTGraph<String, String> star(int n, String label); static UTGraph<String, String> ladder(int n, String label); static UTGraph<String, String> jbc(); static DTGraph<String, String> jbcDirected(); static UTGraph<String, String> single(String label); static List<Integer> degrees(Graph<?> graph); static List<Integer> inDegrees(DGraph<?> graph); static List<Integer> outDegrees(DGraph<?> graph); static void add(Graph<L> graph, Graph<L> addition); static void add(TGraph<L, T> graph, TGraph<L, T> addition); static UTGraph<String, String> reduce(UTGraph<L, T> graph); static Graph<String> blank(Graph<L> graph, String label); static UGraph<String> blank(UGraph<L> graph, String label); static DGraph<String> blank(DGraph<L> graph, String label); static UTGraph<String, String> blank(UTGraph<L, T> graph, String label); static DTGraph<String, String> blank(DTGraph<L, T> graph, String label); static Graph<L> reorder(Graph<L> graph, Order order); static UGraph<L> reorder(UGraph<L> graph, Order order); static DGraph<L> reorder(DGraph<L> graph, Order order); static UTGraph<L, T> reorder(UTGraph<L, T> graph, Order order); static DTGraph<L, T> reorder(DTGraph<L, T> graph, Order order); static String canonicalString(Graph<L> graph); static String canonicalString(DGraph<L> graph); static String canonicalString(UGraph<L> graph); static String canonicalString(DTGraph<L, T> graph); static String canonicalString(UTGraph<L, T> graph); static boolean isSimple(Graph<L> graph); static boolean hasSelfLoops(Graph<L> graph); static boolean hasMultiEdges(Graph<L> graph); static UGraph<L> toSimpleUGraph(Graph<L> data); static UGraph<L> toSimpleUGraph(Graph<L> data, FrequencyModel<Pair<Integer, Integer>> removals); static DGraph<L> toSimpleDGraph(DGraph<L> data); static DGraph<L> toSimpleDGraph(DGraph<L> data, FrequencyModel<Pair<Integer, Integer>> removals); static Collection<UGraph<String>> all(final int n, final String label); static List<UGraph<String>> allIso(int n, String label); static List<UGraph<String>> allIsoConnected(int n, String label); static boolean connected(UGraph<L> graph); static boolean connected(Graph<L> graph); static UGraph<String> fromBits(BitString bits, String label);  }