@Test public void starTest() { DTGraph<String,String> graph = new LightDTGraph<String,String>(); DTNode<String,String> a = graph.add(null), b = graph.add(null), c = graph.add(null), d = graph.add(null), e = graph.add(null); b.connect(a, "1"); c.connect(a, "1"); d.connect(a, "1"); e.connect(a, "1"); System.out.println(graph); e.disconnect(a); System.out.println(graph); a.remove(); System.out.println(graph); }
@Override public DTNode<L, T> add(L label) { labels.add(label); in.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); out.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); inTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); outTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); sorted = false; return new LightDTNode(in.size() - 1); }
LightDTGraph implements DTGraph<L, T> { @Override public DTNode<L, T> add(L label) { labels.add(label); in.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); out.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); inTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); outTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); sorted = false; return new LightDTNode(in.size() - 1); } }
LightDTGraph implements DTGraph<L, T> { @Override public DTNode<L, T> add(L label) { labels.add(label); in.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); out.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); inTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); outTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); sorted = false; return new LightDTNode(in.size() - 1); } LightDTGraph();  LightDTGraph(int capacity); }
LightDTGraph implements DTGraph<L, T> { @Override public DTNode<L, T> add(L label) { labels.add(label); in.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); out.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); inTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); outTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); sorted = false; return new LightDTNode(in.size() - 1); } LightDTGraph();  LightDTGraph(int capacity); @Override Set<T> tags(); @Override int size(); @Override DTNode<L, T> node(L label); @Override Collection<? extends DTNode<L, T>> nodes(L label); @Override List<? extends DTNode<L, T>> nodes(); @Override DTNode<L, T> get(int i); @Override Iterable<? extends DTLink<L, T>> links(); @Override DTNode<L, T> add(L label); @Override long numLinks(); @Override Set<L> labels(); @Override boolean connected(L from, L to); @Override long state(); @SuppressWarnings("unchecked") @Override Class<? extends DTGraph<L, T>> level(); boolean equals(Object other); String toString(); }
LightDTGraph implements DTGraph<L, T> { @Override public DTNode<L, T> add(L label) { labels.add(label); in.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); out.add(new ArrayList<Integer>(NEIGHBOR_CAPACITY)); inTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); outTags.add(new ArrayList<T>(NEIGHBOR_CAPACITY)); sorted = false; return new LightDTNode(in.size() - 1); } LightDTGraph();  LightDTGraph(int capacity); @Override Set<T> tags(); @Override int size(); @Override DTNode<L, T> node(L label); @Override Collection<? extends DTNode<L, T>> nodes(L label); @Override List<? extends DTNode<L, T>> nodes(); @Override DTNode<L, T> get(int i); @Override Iterable<? extends DTLink<L, T>> links(); @Override DTNode<L, T> add(L label); @Override long numLinks(); @Override Set<L> labels(); @Override boolean connected(L from, L to); @Override long state(); @SuppressWarnings("unchecked") @Override Class<? extends DTGraph<L, T>> level(); boolean equals(Object other); String toString(); static final int NEIGHBOR_CAPACITY; }