From 90bd939312efbdeca6d126df5f0f7d3d0f448aa1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Christophe=20Beaupr=C3=A9?= Date: Sat, 20 Dec 2014 17:56:46 -0500 Subject: [PATCH] neo4j/graph: Add optimization methods. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-Christophe Beaupré --- lib/neo4j/graph/graph.nit | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/neo4j/graph/graph.nit b/lib/neo4j/graph/graph.nit index f403744..db43a1f 100644 --- a/lib/neo4j/graph/graph.nit +++ b/lib/neo4j/graph/graph.nit @@ -86,6 +86,15 @@ abstract class NeoNodeCollection node[id_property] = id end + # Enlarge the collection to have at least the specified capacity. + # + # The capacity is specified in number of nodes. Used to minimize the + # number of times the collection need to be resized when adding nodes + # in batches. + # + # Do nothing by default. + fun enlarge(cap: Int) do end + # Add the specified node to the graph and set its local ID. # # SEE: `add` @@ -138,6 +147,11 @@ abstract class NeoNodeCollection if node == n then remove_node(n) end end + + # Optimize the collection, possibly by rewritting it. + # + # The local ID of the elements may be changed by this method. + fun compact do end end # A mean to save and load a Neo4j graph. -- 1.7.9.5