@Test public void testIterateOutNeighbors() { int[] n = {100, 1000, 5000}; double[] p = {0.01, 0.1, 0.3}; for (int nodes : n) { for (double prob : p) { int edges = (int) (nodes * (nodes - 1) * prob); NanoBench.create().measurements(2).measure("iterate neighbors list out nodes=" + nodes + " edges=" + edges, new EdgeStoreBenchmark().iterateEdgeStoreNeighborsOut(nodes, prob)); } } }
public Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob) { final Configuration config = new Configuration(); config.setEdgeIdType(Integer.class); config.setNodeIdType(Integer.class); final RandomGraph graph = new RandomGraph(nodes, prob, config).generate().commit(); final EdgeStore edgeStore = graph.getStore().getEdgeStore(); final List<Node> nodeList = graph.getNodes(); Runnable runnable = new Runnable() { @Override public void run() { for (Node node : nodeList) { Iterator<Edge> itr = edgeStore.edgeOutIterator(node); for (; itr.hasNext();) { object = itr.next(); } } } }; return runnable; }
EdgeStoreBenchmark { public Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob) { final Configuration config = new Configuration(); config.setEdgeIdType(Integer.class); config.setNodeIdType(Integer.class); final RandomGraph graph = new RandomGraph(nodes, prob, config).generate().commit(); final EdgeStore edgeStore = graph.getStore().getEdgeStore(); final List<Node> nodeList = graph.getNodes(); Runnable runnable = new Runnable() { @Override public void run() { for (Node node : nodeList) { Iterator<Edge> itr = edgeStore.edgeOutIterator(node); for (; itr.hasNext();) { object = itr.next(); } } } }; return runnable; } }
EdgeStoreBenchmark { public Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob) { final Configuration config = new Configuration(); config.setEdgeIdType(Integer.class); config.setNodeIdType(Integer.class); final RandomGraph graph = new RandomGraph(nodes, prob, config).generate().commit(); final EdgeStore edgeStore = graph.getStore().getEdgeStore(); final List<Node> nodeList = graph.getNodes(); Runnable runnable = new Runnable() { @Override public void run() { for (Node node : nodeList) { Iterator<Edge> itr = edgeStore.edgeOutIterator(node); for (; itr.hasNext();) { object = itr.next(); } } } }; return runnable; }  }
EdgeStoreBenchmark { public Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob) { final Configuration config = new Configuration(); config.setEdgeIdType(Integer.class); config.setNodeIdType(Integer.class); final RandomGraph graph = new RandomGraph(nodes, prob, config).generate().commit(); final EdgeStore edgeStore = graph.getStore().getEdgeStore(); final List<Node> nodeList = graph.getNodes(); Runnable runnable = new Runnable() { @Override public void run() { for (Node node : nodeList) { Iterator<Edge> itr = edgeStore.edgeOutIterator(node); for (; itr.hasNext();) { object = itr.next(); } } } }; return runnable; }  Runnable pushEdgeStore(int nodes, double prob); Runnable iterateEdgeStore(int nodes, double prob); Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob); Runnable iterateEdgeStoreNeighborsInOut(int nodes, double prob); Runnable resetEdgeStore(int nodes, double prob); }
EdgeStoreBenchmark { public Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob) { final Configuration config = new Configuration(); config.setEdgeIdType(Integer.class); config.setNodeIdType(Integer.class); final RandomGraph graph = new RandomGraph(nodes, prob, config).generate().commit(); final EdgeStore edgeStore = graph.getStore().getEdgeStore(); final List<Node> nodeList = graph.getNodes(); Runnable runnable = new Runnable() { @Override public void run() { for (Node node : nodeList) { Iterator<Edge> itr = edgeStore.edgeOutIterator(node); for (; itr.hasNext();) { object = itr.next(); } } } }; return runnable; }  Runnable pushEdgeStore(int nodes, double prob); Runnable iterateEdgeStore(int nodes, double prob); Runnable iterateEdgeStoreNeighborsOut(int nodes, double prob); Runnable iterateEdgeStoreNeighborsInOut(int nodes, double prob); Runnable resetEdgeStore(int nodes, double prob);  }