Calculate how many virtual keys are needed to represent the graph.
| 97 | |
| 98 | // Calculate how many virtual keys are needed to represent the graph. |
| 99 | static uint64_t _GraphContext_RequiredMetaKeys(const GraphContext *gc) { |
| 100 | uint64_t vkey_entity_count; |
| 101 | Config_Option_get(Config_VKEY_MAX_ENTITY_COUNT, &vkey_entity_count); |
| 102 | gc->encoding_context->vkey_entity_count = vkey_entity_count; |
| 103 | |
| 104 | uint64_t entities_count = Graph_NodeCount(gc->g) + Graph_EdgeCount(gc->g) + |
| 105 | Graph_DeletedNodeCount(gc->g) + Graph_DeletedEdgeCount(gc->g); |
| 106 | |
| 107 | if(entities_count == 0) return 0; |
| 108 | |
| 109 | // calculate the required keys |
| 110 | // substruct one since there is also the graph context key |
| 111 | uint64_t key_count = ceil((double)entities_count / vkey_entity_count) - 1; |
| 112 | return MAX(key_count, 0); |
| 113 | } |
| 114 | |
| 115 | static void _CreateGraphMetaKeys |
| 116 | ( |
no test coverage detected