exonware-xwnode 0.0.1.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. exonware/__init__.py +14 -0
  2. exonware/xwnode/__init__.py +127 -0
  3. exonware/xwnode/base.py +676 -0
  4. exonware/xwnode/config.py +178 -0
  5. exonware/xwnode/contracts.py +730 -0
  6. exonware/xwnode/errors.py +503 -0
  7. exonware/xwnode/facade.py +460 -0
  8. exonware/xwnode/strategies/__init__.py +158 -0
  9. exonware/xwnode/strategies/advisor.py +463 -0
  10. exonware/xwnode/strategies/edges/__init__.py +32 -0
  11. exonware/xwnode/strategies/edges/adj_list.py +227 -0
  12. exonware/xwnode/strategies/edges/adj_matrix.py +391 -0
  13. exonware/xwnode/strategies/edges/base.py +169 -0
  14. exonware/xwnode/strategies/flyweight.py +328 -0
  15. exonware/xwnode/strategies/impls/__init__.py +13 -0
  16. exonware/xwnode/strategies/impls/_base_edge.py +403 -0
  17. exonware/xwnode/strategies/impls/_base_node.py +307 -0
  18. exonware/xwnode/strategies/impls/edge_adj_list.py +353 -0
  19. exonware/xwnode/strategies/impls/edge_adj_matrix.py +445 -0
  20. exonware/xwnode/strategies/impls/edge_bidir_wrapper.py +455 -0
  21. exonware/xwnode/strategies/impls/edge_block_adj_matrix.py +539 -0
  22. exonware/xwnode/strategies/impls/edge_coo.py +533 -0
  23. exonware/xwnode/strategies/impls/edge_csc.py +447 -0
  24. exonware/xwnode/strategies/impls/edge_csr.py +492 -0
  25. exonware/xwnode/strategies/impls/edge_dynamic_adj_list.py +503 -0
  26. exonware/xwnode/strategies/impls/edge_flow_network.py +555 -0
  27. exonware/xwnode/strategies/impls/edge_hyperedge_set.py +516 -0
  28. exonware/xwnode/strategies/impls/edge_neural_graph.py +650 -0
  29. exonware/xwnode/strategies/impls/edge_octree.py +574 -0
  30. exonware/xwnode/strategies/impls/edge_property_store.py +655 -0
  31. exonware/xwnode/strategies/impls/edge_quadtree.py +519 -0
  32. exonware/xwnode/strategies/impls/edge_rtree.py +820 -0
  33. exonware/xwnode/strategies/impls/edge_temporal_edgeset.py +558 -0
  34. exonware/xwnode/strategies/impls/edge_tree_graph_basic.py +271 -0
  35. exonware/xwnode/strategies/impls/edge_weighted_graph.py +411 -0
  36. exonware/xwnode/strategies/manager.py +775 -0
  37. exonware/xwnode/strategies/metrics.py +538 -0
  38. exonware/xwnode/strategies/migration.py +432 -0
  39. exonware/xwnode/strategies/nodes/__init__.py +50 -0
  40. exonware/xwnode/strategies/nodes/_base_node.py +307 -0
  41. exonware/xwnode/strategies/nodes/adjacency_list.py +267 -0
  42. exonware/xwnode/strategies/nodes/aho_corasick.py +345 -0
  43. exonware/xwnode/strategies/nodes/array_list.py +209 -0
  44. exonware/xwnode/strategies/nodes/base.py +247 -0
  45. exonware/xwnode/strategies/nodes/deque.py +200 -0
  46. exonware/xwnode/strategies/nodes/hash_map.py +135 -0
  47. exonware/xwnode/strategies/nodes/heap.py +307 -0
  48. exonware/xwnode/strategies/nodes/linked_list.py +232 -0
  49. exonware/xwnode/strategies/nodes/node_aho_corasick.py +520 -0
  50. exonware/xwnode/strategies/nodes/node_array_list.py +175 -0
  51. exonware/xwnode/strategies/nodes/node_avl_tree.py +371 -0
  52. exonware/xwnode/strategies/nodes/node_b_plus_tree.py +542 -0
  53. exonware/xwnode/strategies/nodes/node_bitmap.py +420 -0
  54. exonware/xwnode/strategies/nodes/node_bitset_dynamic.py +513 -0
  55. exonware/xwnode/strategies/nodes/node_bloom_filter.py +347 -0
  56. exonware/xwnode/strategies/nodes/node_btree.py +357 -0
  57. exonware/xwnode/strategies/nodes/node_count_min_sketch.py +470 -0
  58. exonware/xwnode/strategies/nodes/node_cow_tree.py +473 -0
  59. exonware/xwnode/strategies/nodes/node_cuckoo_hash.py +392 -0
  60. exonware/xwnode/strategies/nodes/node_fenwick_tree.py +301 -0
  61. exonware/xwnode/strategies/nodes/node_hash_map.py +269 -0
  62. exonware/xwnode/strategies/nodes/node_heap.py +191 -0
  63. exonware/xwnode/strategies/nodes/node_hyperloglog.py +407 -0
  64. exonware/xwnode/strategies/nodes/node_linked_list.py +409 -0
  65. exonware/xwnode/strategies/nodes/node_lsm_tree.py +400 -0
  66. exonware/xwnode/strategies/nodes/node_ordered_map.py +390 -0
  67. exonware/xwnode/strategies/nodes/node_ordered_map_balanced.py +565 -0
  68. exonware/xwnode/strategies/nodes/node_patricia.py +512 -0
  69. exonware/xwnode/strategies/nodes/node_persistent_tree.py +378 -0
  70. exonware/xwnode/strategies/nodes/node_radix_trie.py +452 -0
  71. exonware/xwnode/strategies/nodes/node_red_black_tree.py +497 -0
  72. exonware/xwnode/strategies/nodes/node_roaring_bitmap.py +570 -0
  73. exonware/xwnode/strategies/nodes/node_segment_tree.py +289 -0
  74. exonware/xwnode/strategies/nodes/node_set_hash.py +354 -0
  75. exonware/xwnode/strategies/nodes/node_set_tree.py +480 -0
  76. exonware/xwnode/strategies/nodes/node_skip_list.py +316 -0
  77. exonware/xwnode/strategies/nodes/node_splay_tree.py +393 -0
  78. exonware/xwnode/strategies/nodes/node_suffix_array.py +487 -0
  79. exonware/xwnode/strategies/nodes/node_treap.py +387 -0
  80. exonware/xwnode/strategies/nodes/node_tree_graph_hybrid.py +1434 -0
  81. exonware/xwnode/strategies/nodes/node_trie.py +252 -0
  82. exonware/xwnode/strategies/nodes/node_union_find.py +187 -0
  83. exonware/xwnode/strategies/nodes/node_xdata_optimized.py +369 -0
  84. exonware/xwnode/strategies/nodes/priority_queue.py +209 -0
  85. exonware/xwnode/strategies/nodes/queue.py +161 -0
  86. exonware/xwnode/strategies/nodes/sparse_matrix.py +206 -0
  87. exonware/xwnode/strategies/nodes/stack.py +152 -0
  88. exonware/xwnode/strategies/nodes/trie.py +274 -0
  89. exonware/xwnode/strategies/nodes/union_find.py +283 -0
  90. exonware/xwnode/strategies/pattern_detector.py +603 -0
  91. exonware/xwnode/strategies/performance_monitor.py +487 -0
  92. exonware/xwnode/strategies/queries/__init__.py +24 -0
  93. exonware/xwnode/strategies/queries/base.py +236 -0
  94. exonware/xwnode/strategies/queries/cql.py +201 -0
  95. exonware/xwnode/strategies/queries/cypher.py +181 -0
  96. exonware/xwnode/strategies/queries/datalog.py +70 -0
  97. exonware/xwnode/strategies/queries/elastic_dsl.py +70 -0
  98. exonware/xwnode/strategies/queries/eql.py +70 -0
  99. exonware/xwnode/strategies/queries/flux.py +70 -0
  100. exonware/xwnode/strategies/queries/gql.py +70 -0
  101. exonware/xwnode/strategies/queries/graphql.py +240 -0
  102. exonware/xwnode/strategies/queries/gremlin.py +181 -0
  103. exonware/xwnode/strategies/queries/hiveql.py +214 -0
  104. exonware/xwnode/strategies/queries/hql.py +70 -0
  105. exonware/xwnode/strategies/queries/jmespath.py +219 -0
  106. exonware/xwnode/strategies/queries/jq.py +66 -0
  107. exonware/xwnode/strategies/queries/json_query.py +66 -0
  108. exonware/xwnode/strategies/queries/jsoniq.py +248 -0
  109. exonware/xwnode/strategies/queries/kql.py +70 -0
  110. exonware/xwnode/strategies/queries/linq.py +238 -0
  111. exonware/xwnode/strategies/queries/logql.py +70 -0
  112. exonware/xwnode/strategies/queries/mql.py +68 -0
  113. exonware/xwnode/strategies/queries/n1ql.py +210 -0
  114. exonware/xwnode/strategies/queries/partiql.py +70 -0
  115. exonware/xwnode/strategies/queries/pig.py +215 -0
  116. exonware/xwnode/strategies/queries/promql.py +70 -0
  117. exonware/xwnode/strategies/queries/sparql.py +220 -0
  118. exonware/xwnode/strategies/queries/sql.py +275 -0
  119. exonware/xwnode/strategies/queries/xml_query.py +66 -0
  120. exonware/xwnode/strategies/queries/xpath.py +223 -0
  121. exonware/xwnode/strategies/queries/xquery.py +258 -0
  122. exonware/xwnode/strategies/queries/xwnode_executor.py +332 -0
  123. exonware/xwnode/strategies/queries/xwquery_strategy.py +424 -0
  124. exonware/xwnode/strategies/registry.py +604 -0
  125. exonware/xwnode/strategies/simple.py +273 -0
  126. exonware/xwnode/strategies/utils.py +532 -0
  127. exonware/xwnode/types.py +912 -0
  128. exonware/xwnode/version.py +78 -0
  129. exonware_xwnode-0.0.1.12.dist-info/METADATA +169 -0
  130. exonware_xwnode-0.0.1.12.dist-info/RECORD +132 -0
  131. exonware_xwnode-0.0.1.12.dist-info/WHEEL +4 -0
  132. exonware_xwnode-0.0.1.12.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,912 @@
1
+ """
2
+ GEMINI-2 Strategy Types and Enums
3
+
4
+ This module defines all the enums and types for the GEMINI-2 strategy system:
5
+ - NodeMode: 28 different node data structure strategies
6
+ - EdgeMode: 16 different edge storage strategies
7
+ - QueryMode: 19 different query language strategies
8
+ - NodeTrait: 12 cross-cutting node capabilities
9
+ - EdgeTrait: 12 cross-cutting edge capabilities
10
+ - QueryTrait: 8 cross-cutting query capabilities
11
+ """
12
+
13
+ from enum import Enum, Flag, auto as _auto
14
+ from typing import Dict, List, Any, Optional
15
+
16
+
17
+ # ============================================================================
18
+ # NODE MODES (28 total)
19
+ # ============================================================================
20
+
21
+ class NodeMode(Enum):
22
+ """Node data structure strategies for GEMINI-2."""
23
+
24
+ # Special modes
25
+ AUTO = _auto() # Intelligent automatic selection
26
+ TREE_GRAPH_HYBRID = _auto() # Tree navigation + basic graph capabilities
27
+
28
+ # Basic data structures
29
+ HASH_MAP = _auto() # Optimized for lookups
30
+ ORDERED_MAP = _auto() # Optimized for sorted operations
31
+ ORDERED_MAP_BALANCED = _auto() # Explicit balanced trees (RB/AVL/Treap)
32
+ ARRAY_LIST = _auto() # Optimized for small datasets
33
+ LINKED_LIST = _auto() # Optimized for insertions/deletions
34
+
35
+ # Linear data structures
36
+ STACK = _auto() # LIFO (Last In, First Out)
37
+ QUEUE = _auto() # FIFO (First In, First Out)
38
+ PRIORITY_QUEUE = _auto() # Priority-based operations
39
+ DEQUE = _auto() # Double-ended queue
40
+
41
+ # Tree structures
42
+ TRIE = _auto() # Basic trie implementation
43
+ RADIX_TRIE = _auto() # Compressed prefixes
44
+ PATRICIA = _auto() # Patricia trie (compressed binary trie)
45
+
46
+ # Specialized structures
47
+ HEAP = _auto() # Optimized for priority operations
48
+ SET_HASH = _auto() # Optimized for set operations
49
+ SET_TREE = _auto() # Optimized for ordered sets
50
+ BLOOM_FILTER = _auto() # Optimized for membership tests
51
+ CUCKOO_HASH = _auto() # Optimized for high load factors
52
+
53
+ # Bitmap structures
54
+ BITMAP = _auto() # Static bitmap operations
55
+ BITSET_DYNAMIC = _auto() # Resizable bitset
56
+ ROARING_BITMAP = _auto() # Optimized for sparse bitmaps
57
+
58
+ # Matrix structures
59
+ SPARSE_MATRIX = _auto() # Sparse matrix operations
60
+
61
+ # Graph structures
62
+ ADJACENCY_LIST = _auto() # Adjacency list representation
63
+
64
+ # Persistent structures
65
+ B_TREE = _auto() # Disk/page indexes
66
+ B_PLUS_TREE = _auto() # Database-friendly B+ tree
67
+ LSM_TREE = _auto() # Write-heavy key-value store
68
+ PERSISTENT_TREE = _auto() # Immutable functional tree
69
+ COW_TREE = _auto() # Copy-on-write tree
70
+
71
+ # Algorithmic structures
72
+ UNION_FIND = _auto() # Connectivity/disjoint sets
73
+ SEGMENT_TREE = _auto() # Range queries and updates
74
+ FENWICK_TREE = _auto() # Prefix sums (Binary Indexed Tree)
75
+
76
+ # String structures
77
+ SUFFIX_ARRAY = _auto() # Substring search
78
+ AHO_CORASICK = _auto() # Multi-pattern string matching
79
+
80
+ # Probabilistic structures
81
+ COUNT_MIN_SKETCH = _auto() # Streaming frequency estimation
82
+ HYPERLOGLOG = _auto() # Cardinality estimation
83
+
84
+ # Advanced tree structures
85
+ SKIP_LIST = _auto() # Probabilistic data structure
86
+ RED_BLACK_TREE = _auto() # Self-balancing binary search tree
87
+ AVL_TREE = _auto() # Strictly balanced binary search tree
88
+ TREAP = _auto() # Randomized balanced tree
89
+ SPLAY_TREE = _auto() # Self-adjusting binary search tree
90
+
91
+
92
+ # ============================================================================
93
+ # EDGE MODES (16 total)
94
+ # ============================================================================
95
+
96
+ class EdgeMode(Enum):
97
+ """Edge storage strategies for GEMINI-2."""
98
+
99
+ # Special modes
100
+ AUTO = _auto() # Intelligent automatic selection
101
+ TREE_GRAPH_BASIC = _auto() # Basic edge storage for tree+graph hybrid
102
+
103
+ # Basic graph structures
104
+ ADJ_LIST = _auto() # Optimized for sparse graphs
105
+ DYNAMIC_ADJ_LIST = _auto() # High churn graphs
106
+ ADJ_MATRIX = _auto() # Optimized for dense graphs
107
+ BLOCK_ADJ_MATRIX = _auto() # Cache-friendly dense operations
108
+
109
+ # Sparse matrix formats
110
+ CSR = _auto() # Compressed Sparse Row format
111
+ CSC = _auto() # Compressed Sparse Column format
112
+ COO = _auto() # Coordinate format
113
+
114
+ # Specialized graph structures
115
+ BIDIR_WRAPPER = _auto() # Undirected via dual arcs
116
+ TEMPORAL_EDGESET = _auto() # Time-keyed edges
117
+ HYPEREDGE_SET = _auto() # Hypergraphs
118
+ EDGE_PROPERTY_STORE = _auto() # Columnar edge attributes
119
+
120
+ # Spatial structures
121
+ R_TREE = _auto() # Spatial indexing (2D/3D rectangles)
122
+ QUADTREE = _auto() # 2D spatial partitioning
123
+ OCTREE = _auto() # 3D spatial partitioning
124
+
125
+ # Flow and neural networks
126
+ FLOW_NETWORK = _auto() # Flow graphs with capacity constraints
127
+ NEURAL_GRAPH = _auto() # Neural network computation graphs
128
+
129
+ # Weighted graph structures
130
+ WEIGHTED_GRAPH = _auto() # Graph with numerical edge weights
131
+
132
+
133
+ # ============================================================================
134
+ # NODE TRAITS (12 total)
135
+ # ============================================================================
136
+
137
+ class NodeTrait(Flag):
138
+ """Cross-cutting node capabilities for GEMINI-2."""
139
+
140
+ NONE = 0
141
+
142
+ # Basic capabilities
143
+ WEIGHTED = _auto() # Supports weighted operations
144
+ DIRECTED = _auto() # Supports directed operations
145
+ MULTI = _auto() # Supports multiple values per key
146
+ COMPRESSED = _auto() # Uses compression
147
+
148
+ # Advanced capabilities
149
+ PROBABILISTIC = _auto() # Probabilistic data structures
150
+ SPATIAL = _auto() # Spatial operations
151
+ ORDERED = _auto() # Maintains order
152
+ PERSISTENT = _auto() # Disk-friendly
153
+
154
+ # Performance capabilities
155
+ STREAMING = _auto() # Streaming operations
156
+ INDEXED = _auto() # Indexed operations
157
+ HIERARCHICAL = _auto() # Hierarchical structure
158
+ PRIORITY = _auto() # Priority operations
159
+
160
+ # Linear capabilities
161
+ LIFO = _auto() # Last In, First Out
162
+ FIFO = _auto() # First In, First Out
163
+ DOUBLE_ENDED = _auto() # Double-ended operations
164
+ FAST_INSERT = _auto() # Fast insertion operations
165
+ FAST_DELETE = _auto() # Fast deletion operations
166
+
167
+ # Matrix capabilities
168
+ MATRIX_OPS = _auto() # Matrix operations
169
+ SPARSE = _auto() # Sparse data structures
170
+ MEMORY_EFFICIENT = _auto() # Memory efficient
171
+
172
+ # Graph capabilities
173
+ FAST_NEIGHBORS = _auto() # Fast neighbor queries
174
+
175
+ # Advanced structure capabilities (from structures files)
176
+ GRAPH = _auto() # Graph operations (Union-Find, FSM, DAG)
177
+ NEURAL = _auto() # Neural network operations
178
+ STATE_MACHINE = _auto() # Finite state machine operations
179
+ PREFIX_TREE = _auto() # Trie/prefix tree operations
180
+ UNION_FIND = _auto() # Disjoint set operations
181
+ HEAP_OPERATIONS = _auto() # Priority queue operations
182
+
183
+
184
+ # ============================================================================
185
+ # EDGE TRAITS (12 total)
186
+ # ============================================================================
187
+
188
+ class EdgeTrait(Flag):
189
+ """Cross-cutting edge capabilities for GEMINI-2."""
190
+
191
+ NONE = 0
192
+
193
+ # Basic capabilities
194
+ WEIGHTED = _auto() # Weighted edges
195
+ DIRECTED = _auto() # Directed edges
196
+ MULTI = _auto() # Multiple edges between vertices
197
+ COMPRESSED = _auto() # Compressed storage
198
+
199
+ # Advanced capabilities
200
+ SPATIAL = _auto() # Spatial operations
201
+ TEMPORAL = _auto() # Time-aware edges
202
+ HYPER = _auto() # Hyperedge support
203
+
204
+ # Performance capabilities
205
+ DENSE = _auto() # Dense graph optimized
206
+ SPARSE = _auto() # Sparse graph optimized
207
+ CACHE_FRIENDLY = _auto() # Cache-optimized
208
+ COLUMNAR = _auto() # Columnar storage
209
+
210
+
211
+ # ============================================================================
212
+ # QUERY MODES (35 total)
213
+ # ============================================================================
214
+
215
+ class QueryMode(Enum):
216
+ """Query language strategies for GEMINI-2."""
217
+
218
+ # Special modes
219
+ AUTO = _auto() # Intelligent automatic selection
220
+
221
+ # Structured & Document Query Languages
222
+ SQL = _auto() # Standard SQL
223
+ HIVEQL = _auto() # Apache Hive SQL
224
+ PIG = _auto() # Apache Pig Latin
225
+ CQL = _auto() # Cassandra Query Language
226
+ N1QL = _auto() # Couchbase N1QL
227
+ KQL = _auto() # Kusto Query Language
228
+ DATALOG = _auto() # Datalog
229
+ MQL = _auto() # MongoDB Query Language
230
+ PARTIQL = _auto() # AWS PartiQL (SQL-compatible for nested/semi-structured)
231
+
232
+ # Search Query Languages
233
+ ELASTIC_DSL = _auto() # Elasticsearch Query DSL
234
+ EQL = _auto() # Elasticsearch Event Query Language
235
+ LUCENE = _auto() # Lucene query syntax
236
+
237
+ # Time Series & Monitoring
238
+ FLUX = _auto() # InfluxDB Flux
239
+ PROMQL = _auto() # Prometheus Query Language
240
+
241
+ # Data Streaming
242
+ KSQL = _auto() # Kafka Streams (ksqlDB)
243
+
244
+ # Graph Query Languages
245
+ GRAPHQL = _auto() # GraphQL
246
+ SPARQL = _auto() # SPARQL (RDF)
247
+ GREMLIN = _auto() # Apache TinkerPop Gremlin
248
+ CYPHER = _auto() # Neo4j Cypher
249
+ GQL = _auto() # ISO/IEC 39075:2024 Graph Query Language standard
250
+
251
+ # ORM / Integrated Query
252
+ LINQ = _auto() # .NET Language Integrated Query
253
+ HQL = _auto() # Hibernate Query Language / JPQL
254
+
255
+ # Markup & Document Structure
256
+ JSONIQ = _auto() # JSONiq
257
+ JMESPATH = _auto() # JMESPath
258
+ JQ = _auto() # jq JSON processor
259
+ XQUERY = _auto() # XQuery
260
+ XPATH = _auto() # XPath
261
+
262
+ # Logs & Analytics
263
+ LOGQL = _auto() # Grafana Loki Log Query Language
264
+ SPL = _auto() # Splunk Search Processing Language
265
+
266
+ # SQL Engines
267
+ TRINO_SQL = _auto() # Trino/Presto SQL
268
+ BIGQUERY_SQL = _auto() # Google BigQuery SQL
269
+ SNOWFLAKE_SQL = _auto() # Snowflake SQL
270
+
271
+ # Generic Query Languages
272
+ XML_QUERY = _auto() # Generic XML Query
273
+ JSON_QUERY = _auto() # Generic JSON Query
274
+
275
+
276
+ # ============================================================================
277
+ # QUERY TRAITS (8 total)
278
+ # ============================================================================
279
+
280
+ class QueryTrait(Flag):
281
+ """Cross-cutting query capabilities for GEMINI-2."""
282
+
283
+ NONE = 0
284
+
285
+ # Basic capabilities
286
+ STRUCTURED = _auto() # Structured data queries
287
+ GRAPH = _auto() # Graph traversal queries
288
+ DOCUMENT = _auto() # Document-based queries
289
+
290
+ # Advanced capabilities
291
+ TEMPORAL = _auto() # Time-aware queries
292
+ SPATIAL = _auto() # Spatial queries
293
+ ANALYTICAL = _auto() # Analytical queries
294
+
295
+ # Performance capabilities
296
+ STREAMING = _auto() # Streaming queries
297
+ BATCH = _auto() # Batch processing queries
298
+
299
+
300
+ # ============================================================================
301
+ # CONVENIENCE CONSTANTS
302
+ # ============================================================================
303
+
304
+ # Node Mode Constants
305
+ AUTO = NodeMode.AUTO
306
+ TREE_GRAPH_HYBRID = NodeMode.TREE_GRAPH_HYBRID
307
+ # Backwards compatibility
308
+ LEGACY = NodeMode.TREE_GRAPH_HYBRID # Maps to new name
309
+ HASH_MAP = NodeMode.HASH_MAP
310
+ ORDERED_MAP = NodeMode.ORDERED_MAP
311
+ ORDERED_MAP_BALANCED = NodeMode.ORDERED_MAP_BALANCED
312
+ ARRAY_LIST = NodeMode.ARRAY_LIST
313
+ LINKED_LIST = NodeMode.LINKED_LIST
314
+ STACK = NodeMode.STACK
315
+ QUEUE = NodeMode.QUEUE
316
+ PRIORITY_QUEUE = NodeMode.PRIORITY_QUEUE
317
+ DEQUE = NodeMode.DEQUE
318
+ TRIE = NodeMode.TRIE
319
+ RADIX_TRIE = NodeMode.RADIX_TRIE
320
+ PATRICIA = NodeMode.PATRICIA
321
+ HEAP = NodeMode.HEAP
322
+ SET_HASH = NodeMode.SET_HASH
323
+ SET_TREE = NodeMode.SET_TREE
324
+ BLOOM_FILTER = NodeMode.BLOOM_FILTER
325
+ CUCKOO_HASH = NodeMode.CUCKOO_HASH
326
+ BITMAP = NodeMode.BITMAP
327
+ BITSET_DYNAMIC = NodeMode.BITSET_DYNAMIC
328
+ ROARING_BITMAP = NodeMode.ROARING_BITMAP
329
+ SPARSE_MATRIX = NodeMode.SPARSE_MATRIX
330
+ ADJACENCY_LIST = NodeMode.ADJACENCY_LIST
331
+ B_TREE = NodeMode.B_TREE
332
+ B_PLUS_TREE = NodeMode.B_PLUS_TREE
333
+ LSM_TREE = NodeMode.LSM_TREE
334
+ PERSISTENT_TREE = NodeMode.PERSISTENT_TREE
335
+ COW_TREE = NodeMode.COW_TREE
336
+ UNION_FIND = NodeMode.UNION_FIND
337
+ SEGMENT_TREE = NodeMode.SEGMENT_TREE
338
+ FENWICK_TREE = NodeMode.FENWICK_TREE
339
+ SUFFIX_ARRAY = NodeMode.SUFFIX_ARRAY
340
+ AHO_CORASICK = NodeMode.AHO_CORASICK
341
+ COUNT_MIN_SKETCH = NodeMode.COUNT_MIN_SKETCH
342
+ HYPERLOGLOG = NodeMode.HYPERLOGLOG
343
+ SKIP_LIST = NodeMode.SKIP_LIST
344
+ RED_BLACK_TREE = NodeMode.RED_BLACK_TREE
345
+ AVL_TREE = NodeMode.AVL_TREE
346
+ TREAP = NodeMode.TREAP
347
+ SPLAY_TREE = NodeMode.SPLAY_TREE
348
+
349
+ # Edge Mode Constants
350
+ ADJ_LIST = EdgeMode.ADJ_LIST
351
+ DYNAMIC_ADJ_LIST = EdgeMode.DYNAMIC_ADJ_LIST
352
+ ADJ_MATRIX = EdgeMode.ADJ_MATRIX
353
+ BLOCK_ADJ_MATRIX = EdgeMode.BLOCK_ADJ_MATRIX
354
+ CSR = EdgeMode.CSR
355
+ CSC = EdgeMode.CSC
356
+ COO = EdgeMode.COO
357
+ BIDIR_WRAPPER = EdgeMode.BIDIR_WRAPPER
358
+ TEMPORAL_EDGESET = EdgeMode.TEMPORAL_EDGESET
359
+ HYPEREDGE_SET = EdgeMode.HYPEREDGE_SET
360
+ EDGE_PROPERTY_STORE = EdgeMode.EDGE_PROPERTY_STORE
361
+ R_TREE = EdgeMode.R_TREE
362
+ QUADTREE = EdgeMode.QUADTREE
363
+ OCTREE = EdgeMode.OCTREE
364
+ TREE_GRAPH_BASIC = EdgeMode.TREE_GRAPH_BASIC
365
+ WEIGHTED_GRAPH = EdgeMode.WEIGHTED_GRAPH
366
+
367
+ # Query Mode Constants
368
+ # Structured & Document Query Languages
369
+ SQL = QueryMode.SQL
370
+ HIVEQL = QueryMode.HIVEQL
371
+ PIG = QueryMode.PIG
372
+ CQL = QueryMode.CQL
373
+ N1QL = QueryMode.N1QL
374
+ KQL = QueryMode.KQL
375
+ DATALOG = QueryMode.DATALOG
376
+ MQL = QueryMode.MQL
377
+ PARTIQL = QueryMode.PARTIQL
378
+
379
+ # Search Query Languages
380
+ ELASTIC_DSL = QueryMode.ELASTIC_DSL
381
+ EQL = QueryMode.EQL
382
+ LUCENE = QueryMode.LUCENE
383
+
384
+ # Time Series & Monitoring
385
+ FLUX = QueryMode.FLUX
386
+ PROMQL = QueryMode.PROMQL
387
+
388
+ # Data Streaming
389
+ KSQL = QueryMode.KSQL
390
+
391
+ # Graph Query Languages
392
+ GRAPHQL = QueryMode.GRAPHQL
393
+ SPARQL = QueryMode.SPARQL
394
+ GREMLIN = QueryMode.GREMLIN
395
+ CYPHER = QueryMode.CYPHER
396
+ GQL = QueryMode.GQL
397
+
398
+ # ORM / Integrated Query
399
+ LINQ = QueryMode.LINQ
400
+ HQL = QueryMode.HQL
401
+
402
+ # Markup & Document Structure
403
+ JSONIQ = QueryMode.JSONIQ
404
+ JMESPATH = QueryMode.JMESPATH
405
+ JQ = QueryMode.JQ
406
+ XQUERY = QueryMode.XQUERY
407
+ XPATH = QueryMode.XPATH
408
+
409
+ # Logs & Analytics
410
+ LOGQL = QueryMode.LOGQL
411
+ SPL = QueryMode.SPL
412
+
413
+ # SQL Engines
414
+ TRINO_SQL = QueryMode.TRINO_SQL
415
+ BIGQUERY_SQL = QueryMode.BIGQUERY_SQL
416
+ SNOWFLAKE_SQL = QueryMode.SNOWFLAKE_SQL
417
+
418
+ # Generic Query Languages
419
+ XML_QUERY = QueryMode.XML_QUERY
420
+ JSON_QUERY = QueryMode.JSON_QUERY
421
+
422
+
423
+ # ============================================================================
424
+ # STRATEGY METADATA
425
+ # ============================================================================
426
+
427
+ class StrategyMetadata:
428
+ """Metadata for strategy modes including capabilities and performance characteristics."""
429
+
430
+ def __init__(self,
431
+ mode: NodeMode | EdgeMode | QueryMode,
432
+ traits: NodeTrait | EdgeTrait | QueryTrait,
433
+ description: str,
434
+ best_for: List[str],
435
+ performance_gain: str,
436
+ memory_usage: str = "medium",
437
+ time_complexity: Dict[str, str] = None):
438
+ self.mode = mode
439
+ self.traits = traits
440
+ self.description = description
441
+ self.best_for = best_for
442
+ self.performance_gain = performance_gain
443
+ self.memory_usage = memory_usage
444
+ self.time_complexity = time_complexity or {}
445
+
446
+
447
+ # Node strategy metadata
448
+ NODE_STRATEGY_METADATA: Dict[NodeMode, StrategyMetadata] = {
449
+ NodeMode.TREE_GRAPH_HYBRID: StrategyMetadata(
450
+ NodeMode.TREE_GRAPH_HYBRID,
451
+ NodeTrait.HIERARCHICAL,
452
+ "Tree navigation with basic graph capabilities",
453
+ ["general purpose", "tree + graph hybrid", "backward compatibility"],
454
+ "balanced performance",
455
+ "medium"
456
+ ),
457
+
458
+ NodeMode.HASH_MAP: StrategyMetadata(
459
+ NodeMode.HASH_MAP,
460
+ NodeTrait.INDEXED,
461
+ "Optimized hash table for fast lookups",
462
+ ["frequent lookups", "large datasets", "unordered data"],
463
+ "10-100x faster lookups",
464
+ "high",
465
+ {"get": "O(1)", "set": "O(1)", "delete": "O(1)"}
466
+ ),
467
+
468
+ NodeMode.ORDERED_MAP: StrategyMetadata(
469
+ NodeMode.ORDERED_MAP,
470
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
471
+ "Ordered map with sorted key traversal",
472
+ ["ordered iteration", "range queries", "sorted data"],
473
+ "5-20x faster ordered operations",
474
+ "medium",
475
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
476
+ ),
477
+
478
+ NodeMode.ARRAY_LIST: StrategyMetadata(
479
+ NodeMode.ARRAY_LIST,
480
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
481
+ "Dynamic array for small datasets",
482
+ ["small datasets", "sequential access", "frequent iteration"],
483
+ "2-5x faster for small datasets",
484
+ "low",
485
+ {"get": "O(1)", "set": "O(1)", "delete": "O(n)"}
486
+ ),
487
+
488
+ NodeMode.TRIE: StrategyMetadata(
489
+ NodeMode.TRIE,
490
+ NodeTrait.HIERARCHICAL | NodeTrait.INDEXED,
491
+ "Prefix tree for string operations",
492
+ ["prefix searches", "autocomplete", "string keys"],
493
+ "10-50x faster prefix operations",
494
+ "medium",
495
+ {"get": "O(k)", "set": "O(k)", "delete": "O(k)"}
496
+ ),
497
+
498
+ NodeMode.HEAP: StrategyMetadata(
499
+ NodeMode.HEAP,
500
+ NodeTrait.PRIORITY | NodeTrait.ORDERED,
501
+ "Priority queue for ordered access",
502
+ ["priority operations", "top-k queries", "scheduling"],
503
+ "5-10x faster priority operations",
504
+ "low",
505
+ {"get_min": "O(1)", "insert": "O(log n)", "delete_min": "O(log n)"}
506
+ ),
507
+
508
+ NodeMode.BLOOM_FILTER: StrategyMetadata(
509
+ NodeMode.BLOOM_FILTER,
510
+ NodeTrait.PROBABILISTIC,
511
+ "Probabilistic membership testing",
512
+ ["membership tests", "large datasets", "memory efficiency"],
513
+ "100-1000x memory reduction",
514
+ "very low",
515
+ {"contains": "O(k)", "add": "O(k)"}
516
+ ),
517
+
518
+ NodeMode.B_TREE: StrategyMetadata(
519
+ NodeMode.B_TREE,
520
+ NodeTrait.PERSISTENT | NodeTrait.ORDERED | NodeTrait.INDEXED,
521
+ "B-tree for disk-based storage",
522
+ ["large datasets", "disk storage", "range queries"],
523
+ "10-100x faster disk I/O",
524
+ "medium",
525
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
526
+ ),
527
+
528
+ NodeMode.LSM_TREE: StrategyMetadata(
529
+ NodeMode.LSM_TREE,
530
+ NodeTrait.PERSISTENT | NodeTrait.STREAMING,
531
+ "Log-structured merge tree for write-heavy workloads",
532
+ ["write-heavy workloads", "append operations", "large datasets"],
533
+ "100-1000x faster writes",
534
+ "high",
535
+ {"get": "O(log n)", "set": "O(1)", "delete": "O(1)"}
536
+ ),
537
+
538
+ NodeMode.PERSISTENT_TREE: StrategyMetadata(
539
+ NodeMode.PERSISTENT_TREE,
540
+ NodeTrait.PERSISTENT | NodeTrait.ORDERED | NodeTrait.INDEXED,
541
+ "Immutable functional tree with structural sharing",
542
+ ["functional programming", "versioning", "concurrent access", "undo/redo"],
543
+ "Lock-free concurrency, memory efficient",
544
+ "medium",
545
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
546
+ ),
547
+
548
+ NodeMode.COW_TREE: StrategyMetadata(
549
+ NodeMode.COW_TREE,
550
+ NodeTrait.PERSISTENT | NodeTrait.ORDERED | NodeTrait.INDEXED,
551
+ "Copy-on-write tree with atomic snapshots",
552
+ ["snapshots", "versioning", "crash consistency", "backup"],
553
+ "Instant snapshots, atomic updates",
554
+ "medium",
555
+ {"get": "O(log n)", "set": "O(log n)", "snapshot": "O(1)"}
556
+ ),
557
+
558
+ NodeMode.SKIP_LIST: StrategyMetadata(
559
+ NodeMode.SKIP_LIST,
560
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
561
+ "Probabilistic data structure with O(log n) expected performance",
562
+ ["probabilistic", "concurrent access", "simple implementation"],
563
+ "Simple, fast, concurrent-friendly",
564
+ "high",
565
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
566
+ ),
567
+
568
+ NodeMode.RED_BLACK_TREE: StrategyMetadata(
569
+ NodeMode.RED_BLACK_TREE,
570
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
571
+ "Self-balancing binary search tree with color properties",
572
+ ["self-balancing", "guaranteed height", "industry standard"],
573
+ "Guaranteed O(log n) height, widely used",
574
+ "high",
575
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
576
+ ),
577
+
578
+ NodeMode.AVL_TREE: StrategyMetadata(
579
+ NodeMode.AVL_TREE,
580
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
581
+ "Strictly balanced binary search tree with height balance",
582
+ ["strict balance", "height-based", "database optimization"],
583
+ "More balanced than red-black trees",
584
+ "high",
585
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
586
+ ),
587
+
588
+ NodeMode.TREAP: StrategyMetadata(
589
+ NodeMode.TREAP,
590
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
591
+ "Randomized balanced tree combining BST and heap properties",
592
+ ["randomized", "heap property", "self-balancing"],
593
+ "Randomized balancing, simple implementation",
594
+ "medium",
595
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
596
+ ),
597
+
598
+ NodeMode.SPLAY_TREE: StrategyMetadata(
599
+ NodeMode.SPLAY_TREE,
600
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
601
+ "Self-adjusting binary search tree with amortized performance",
602
+ ["self-adjusting", "cache-friendly", "recent access"],
603
+ "Recently accessed elements moved to root",
604
+ "medium",
605
+ {"get": "O(log n)", "set": "O(log n)", "delete": "O(log n)"}
606
+ ),
607
+
608
+ NodeMode.UNION_FIND: StrategyMetadata(
609
+ NodeMode.UNION_FIND,
610
+ NodeTrait.INDEXED,
611
+ "Disjoint-set data structure for connectivity",
612
+ ["connectivity queries", "graph algorithms", "component tracking"],
613
+ "10-100x faster union/find",
614
+ "low",
615
+ {"find": "O(α(n))", "union": "O(α(n))"}
616
+ ),
617
+
618
+ NodeMode.SEGMENT_TREE: StrategyMetadata(
619
+ NodeMode.SEGMENT_TREE,
620
+ NodeTrait.ORDERED | NodeTrait.INDEXED,
621
+ "Segment tree for range queries and updates",
622
+ ["range queries", "range updates", "interval operations"],
623
+ "10-50x faster range operations",
624
+ "medium",
625
+ {"query": "O(log n)", "update": "O(log n)"}
626
+ ),
627
+
628
+ NodeMode.ROARING_BITMAP: StrategyMetadata(
629
+ NodeMode.ROARING_BITMAP,
630
+ NodeTrait.COMPRESSED | NodeTrait.INDEXED,
631
+ "Compressed bitmap for sparse sets",
632
+ ["sparse sets", "boolean operations", "analytics"],
633
+ "10-100x memory reduction for sparse data",
634
+ "very low",
635
+ {"contains": "O(1)", "add": "O(1)", "remove": "O(1)"}
636
+ ),
637
+ }
638
+
639
+
640
+ # Edge strategy metadata
641
+ EDGE_STRATEGY_METADATA: Dict[EdgeMode, StrategyMetadata] = {
642
+ EdgeMode.TREE_GRAPH_BASIC: StrategyMetadata(
643
+ EdgeMode.TREE_GRAPH_BASIC,
644
+ EdgeTrait.SPARSE,
645
+ "Basic edge storage for tree+graph hybrid",
646
+ ["general purpose", "lightweight graphs", "backward compatibility"],
647
+ "balanced performance",
648
+ "medium"
649
+ ),
650
+
651
+ EdgeMode.WEIGHTED_GRAPH: StrategyMetadata(
652
+ EdgeMode.WEIGHTED_GRAPH,
653
+ EdgeTrait.DIRECTED | EdgeTrait.WEIGHTED | EdgeTrait.SPARSE,
654
+ "Graph with numerical edge weights for network algorithms",
655
+ ["weighted edges", "network algorithms", "shortest path"],
656
+ "Essential for network algorithms and routing",
657
+ "high",
658
+ {"add_edge": "O(1)", "get_edge": "O(1)", "delete_edge": "O(1)"}
659
+ ),
660
+
661
+ EdgeMode.ADJ_LIST: StrategyMetadata(
662
+ EdgeMode.ADJ_LIST,
663
+ EdgeTrait.SPARSE,
664
+ "Adjacency list for sparse graphs",
665
+ ["sparse graphs", "dynamic graphs", "memory efficiency"],
666
+ "5-20x faster for sparse graphs",
667
+ "low",
668
+ {"add_edge": "O(1)", "remove_edge": "O(1)", "neighbors": "O(degree)"}
669
+ ),
670
+
671
+ EdgeMode.ADJ_MATRIX: StrategyMetadata(
672
+ EdgeMode.ADJ_MATRIX,
673
+ EdgeTrait.DENSE,
674
+ "Adjacency matrix for dense graphs",
675
+ ["dense graphs", "matrix operations", "edge queries"],
676
+ "10-100x faster for dense graphs",
677
+ "high",
678
+ {"add_edge": "O(1)", "remove_edge": "O(1)", "neighbors": "O(n)"}
679
+ ),
680
+
681
+ EdgeMode.CSR: StrategyMetadata(
682
+ EdgeMode.CSR,
683
+ EdgeTrait.SPARSE | EdgeTrait.COMPRESSED,
684
+ "Compressed Sparse Row format",
685
+ ["sparse graphs", "matrix operations", "memory efficiency"],
686
+ "2-5x memory reduction",
687
+ "low",
688
+ {"add_edge": "O(m)", "remove_edge": "O(m)", "neighbors": "O(degree)"}
689
+ ),
690
+
691
+ EdgeMode.BLOCK_ADJ_MATRIX: StrategyMetadata(
692
+ EdgeMode.BLOCK_ADJ_MATRIX,
693
+ EdgeTrait.DENSE | EdgeTrait.CACHE_FRIENDLY,
694
+ "Cache-friendly block adjacency matrix",
695
+ ["dense graphs", "cache optimization", "matrix algorithms"],
696
+ "5-20x faster matrix operations",
697
+ "high",
698
+ {"add_edge": "O(1)", "remove_edge": "O(1)", "neighbors": "O(n)"}
699
+ ),
700
+
701
+ EdgeMode.R_TREE: StrategyMetadata(
702
+ EdgeMode.R_TREE,
703
+ EdgeTrait.SPATIAL,
704
+ "R-tree for spatial indexing",
705
+ ["spatial queries", "geographic data", "2D/3D graphs"],
706
+ "10-100x faster spatial queries",
707
+ "medium",
708
+ {"add_edge": "O(log n)", "remove_edge": "O(log n)", "spatial_query": "O(log n)"}
709
+ ),
710
+
711
+ EdgeMode.TEMPORAL_EDGESET: StrategyMetadata(
712
+ EdgeMode.TEMPORAL_EDGESET,
713
+ EdgeTrait.TEMPORAL | EdgeTrait.DIRECTED,
714
+ "Time-aware edge storage",
715
+ ["temporal graphs", "time-series data", "evolution tracking"],
716
+ "5-10x faster temporal queries",
717
+ "medium",
718
+ {"add_edge": "O(log n)", "remove_edge": "O(log n)", "temporal_query": "O(log n)"}
719
+ ),
720
+
721
+ EdgeMode.HYPEREDGE_SET: StrategyMetadata(
722
+ EdgeMode.HYPEREDGE_SET,
723
+ EdgeTrait.HYPER | EdgeTrait.MULTI,
724
+ "Hypergraph edge storage",
725
+ ["hypergraphs", "multi-vertex edges", "complex relationships"],
726
+ "2-5x faster hyperedge operations",
727
+ "medium",
728
+ {"add_hyperedge": "O(1)", "remove_hyperedge": "O(1)", "incident_edges": "O(degree)"}
729
+ ),
730
+ }
731
+
732
+
733
+ # ============================================================================
734
+ # A+ USABILITY PRESET SYSTEM
735
+ # ============================================================================
736
+
737
+ class PresetConfig:
738
+ """Configuration for a usability preset."""
739
+
740
+ def __init__(self,
741
+ node_mode: NodeMode,
742
+ edge_mode: Optional[EdgeMode] = None,
743
+ node_traits: NodeTrait = NodeTrait.NONE,
744
+ edge_traits: EdgeTrait = EdgeTrait.NONE,
745
+ description: str = "",
746
+ performance_class: str = "balanced",
747
+ disabled_features: List[str] = None,
748
+ internal_config: Dict[str, Any] = None):
749
+ self.node_mode = node_mode
750
+ self.edge_mode = edge_mode
751
+ self.node_traits = node_traits
752
+ self.edge_traits = edge_traits
753
+ self.description = description
754
+ self.performance_class = performance_class
755
+ self.disabled_features = disabled_features or []
756
+ self.internal_config = internal_config or {}
757
+
758
+
759
+ # === A+ USABILITY PRESETS ===
760
+ USABILITY_PRESETS: Dict[str, PresetConfig] = {
761
+ # === DATA INTERCHANGE OPTIMIZATION ===
762
+ 'DATA_INTERCHANGE_OPTIMIZED': PresetConfig(
763
+ node_mode=NodeMode.HASH_MAP,
764
+ edge_mode=None, # No edge support for maximum efficiency
765
+ node_traits=NodeTrait.INDEXED,
766
+ edge_traits=EdgeTrait.NONE,
767
+ description='Ultra-lightweight preset optimized for data interchange patterns',
768
+ performance_class='maximum_efficiency',
769
+ disabled_features=[
770
+ 'graph_operations', 'edge_storage', 'spatial_indexing',
771
+ 'temporal_tracking', 'hypergraph_support', 'advanced_traversal'
772
+ ],
773
+ internal_config={
774
+ 'enable_cow': True, # Copy-on-write for data interchange
775
+ 'enable_pooling': True, # Object pooling support
776
+ 'enable_hash_caching': True, # Structural hash caching
777
+ 'minimal_metadata': True, # Reduce memory footprint
778
+ 'slots_optimization': True, # __slots__ for memory
779
+ 'fast_creation': True, # Factory pattern optimization
780
+ 'lazy_loading': False, # Eager loading for predictability
781
+ 'memory_profile': 'ultra_minimal'
782
+ }
783
+ ),
784
+
785
+ # === GENERAL PURPOSE ===
786
+ 'DEFAULT': PresetConfig(
787
+ node_mode=NodeMode.AUTO,
788
+ edge_mode=EdgeMode.AUTO,
789
+ description='Smart auto-selection for general use',
790
+ performance_class='balanced'
791
+ ),
792
+
793
+ 'PURE_TREE': PresetConfig(
794
+ node_mode=NodeMode.HASH_MAP,
795
+ edge_mode=None, # Tree-only, no graph
796
+ node_traits=NodeTrait.INDEXED,
797
+ description='Pure tree operations, maximum performance',
798
+ performance_class='high_performance',
799
+ disabled_features=['graph_operations', 'edge_storage']
800
+ ),
801
+
802
+ 'TREE_GRAPH_MIX': PresetConfig(
803
+ node_mode=NodeMode.TREE_GRAPH_HYBRID,
804
+ edge_mode=EdgeMode.TREE_GRAPH_BASIC,
805
+ node_traits=NodeTrait.HIERARCHICAL,
806
+ edge_traits=EdgeTrait.SPARSE,
807
+ description='Balanced tree + graph capabilities (replaces old legacy)',
808
+ performance_class='balanced'
809
+ ),
810
+
811
+ # === PERFORMANCE-ORIENTED ===
812
+ 'FAST_LOOKUP': PresetConfig(
813
+ node_mode=NodeMode.HASH_MAP,
814
+ edge_mode=EdgeMode.ADJ_LIST,
815
+ node_traits=NodeTrait.INDEXED,
816
+ edge_traits=EdgeTrait.SPARSE,
817
+ description='Optimized for frequent key-based access',
818
+ performance_class='high_performance'
819
+ ),
820
+
821
+ 'PERFORMANCE_OPTIMIZED': PresetConfig(
822
+ node_mode=NodeMode.HASH_MAP,
823
+ edge_mode=EdgeMode.ADJ_LIST,
824
+ node_traits=NodeTrait.INDEXED,
825
+ edge_traits=EdgeTrait.SPARSE,
826
+ description='General performance optimization for most use cases',
827
+ performance_class='high_performance'
828
+ ),
829
+
830
+ 'MEMORY_EFFICIENT': PresetConfig(
831
+ node_mode=NodeMode.HASH_MAP,
832
+ edge_mode=EdgeMode.CSR,
833
+ node_traits=NodeTrait.INDEXED,
834
+ edge_traits=EdgeTrait.SPARSE,
835
+ description='Minimizes memory usage',
836
+ performance_class='memory_optimized'
837
+ ),
838
+
839
+ # === DOMAIN-SPECIFIC ===
840
+ 'SOCIAL_GRAPH': PresetConfig(
841
+ node_mode=NodeMode.TREE_GRAPH_HYBRID,
842
+ edge_mode=EdgeMode.ADJ_LIST,
843
+ node_traits=NodeTrait.INDEXED,
844
+ edge_traits=EdgeTrait.SPARSE | EdgeTrait.MULTI,
845
+ description='Optimized for social networks and relationships',
846
+ performance_class='graph_optimized'
847
+ ),
848
+
849
+ 'ANALYTICS': PresetConfig(
850
+ node_mode=NodeMode.ORDERED_MAP_BALANCED,
851
+ edge_mode=EdgeMode.EDGE_PROPERTY_STORE,
852
+ node_traits=NodeTrait.ORDERED | NodeTrait.INDEXED,
853
+ edge_traits=EdgeTrait.COLUMNAR,
854
+ description='Column-oriented for data analysis',
855
+ performance_class='analytics_optimized'
856
+ ),
857
+
858
+ 'SEARCH_ENGINE': PresetConfig(
859
+ node_mode=NodeMode.TRIE,
860
+ edge_mode=EdgeMode.ADJ_LIST,
861
+ node_traits=NodeTrait.HIERARCHICAL | NodeTrait.INDEXED,
862
+ edge_traits=EdgeTrait.SPARSE,
863
+ description='Optimized for text search and autocomplete',
864
+ performance_class='search_optimized'
865
+ ),
866
+
867
+ 'TIME_SERIES': PresetConfig(
868
+ node_mode=NodeMode.ORDERED_MAP,
869
+ edge_mode=EdgeMode.TEMPORAL_EDGESET,
870
+ node_traits=NodeTrait.ORDERED | NodeTrait.STREAMING,
871
+ edge_traits=EdgeTrait.TEMPORAL,
872
+ description='Optimized for time-ordered data',
873
+ performance_class='temporal_optimized'
874
+ ),
875
+
876
+ 'SPATIAL_MAP': PresetConfig(
877
+ node_mode=NodeMode.HASH_MAP,
878
+ edge_mode=EdgeMode.R_TREE,
879
+ node_traits=NodeTrait.INDEXED,
880
+ edge_traits=EdgeTrait.SPATIAL,
881
+ description='Optimized for geographic/spatial data',
882
+ performance_class='spatial_optimized'
883
+ ),
884
+
885
+ 'ML_DATASET': PresetConfig(
886
+ node_mode=NodeMode.ARRAY_LIST,
887
+ edge_mode=EdgeMode.NEURAL_GRAPH,
888
+ node_traits=NodeTrait.STREAMING | NodeTrait.INDEXED,
889
+ edge_traits=EdgeTrait.SPARSE,
890
+ description='Optimized for machine learning workflows',
891
+ performance_class='ml_optimized'
892
+ )
893
+ }
894
+
895
+
896
+ def get_preset(name: str) -> PresetConfig:
897
+ """Get preset configuration by name."""
898
+ if name not in USABILITY_PRESETS:
899
+ available = ', '.join(USABILITY_PRESETS.keys())
900
+ raise ValueError(f"Unknown preset '{name}'. Available: {available}")
901
+ return USABILITY_PRESETS[name]
902
+
903
+
904
+ def list_presets() -> List[str]:
905
+ """Get list of available preset names."""
906
+ return list(USABILITY_PRESETS.keys())
907
+
908
+
909
+ def get_presets_by_performance_class(performance_class: str) -> List[str]:
910
+ """Get presets by performance class."""
911
+ return [name for name, config in USABILITY_PRESETS.items()
912
+ if config.performance_class == performance_class]