From: Jean-Christophe Beaupré Date: Sat, 20 Dec 2014 22:56:46 +0000 (-0500) Subject: neo4j/graph: Add optimization methods. X-Git-Tag: v0.7.1~38^2~6 X-Git-Url: http://nitlanguage.org neo4j/graph: Add optimization methods. Signed-off-by: Jean-Christophe Beaupré --- 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.