CN115309945A - Method, system, equipment and storage medium for constructing data structure of key value pair - Google Patents
Method, system, equipment and storage medium for constructing data structure of key value pair Download PDFInfo
- Publication number
- CN115309945A CN115309945A CN202210813885.1A CN202210813885A CN115309945A CN 115309945 A CN115309945 A CN 115309945A CN 202210813885 A CN202210813885 A CN 202210813885A CN 115309945 A CN115309945 A CN 115309945A
- Authority
- CN
- China
- Prior art keywords
- key
- okvs
- graph
- edge
- value pairs
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 239000013598 vector Substances 0.000 claims abstract description 76
- 238000000926 separation method Methods 0.000 claims abstract description 18
- 238000010276 construction Methods 0.000 claims abstract description 13
- 238000003780 insertion Methods 0.000 claims abstract description 5
- 230000037431 insertion Effects 0.000 claims abstract description 5
- 230000006870 function Effects 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 4
- 239000000945 filler Substances 0.000 claims description 3
- 238000005192 partition Methods 0.000 claims description 3
- 238000004519 manufacturing process Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 6
- 230000002457 bidirectional effect Effects 0.000 description 4
- 201000004569 Blindness Diseases 0.000 description 3
- 125000002015 acyclic group Chemical group 0.000 description 2
- 125000004122 cyclic group Chemical group 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 150000003839 salts Chemical class 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000013077 scoring method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9024—Graphs; Linked lists
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9027—Trees
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/11—Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
- G06F17/12—Simultaneous equations, e.g. systems of linear equations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/15—Correlation function computation including computation of convolution operations
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Algebra (AREA)
- Operations Research (AREA)
- Computing Systems (AREA)
- Complex Calculations (AREA)
Abstract
The invention discloses a method, a system, equipment and a storage medium for constructing a key-value pair data structure, wherein the construction method comprises the following steps: generating an undirected graph corresponding to the plurality of key value pairs, wherein the undirected graph comprises a plurality of vertexes and a plurality of insertion edges; if the undirected graph has a ring graph, separating out the ring graph and at least one separation edge of the undirected graph; dividing the plurality of key-value pairs into a first key set corresponding to the acyclic graph and a second key set corresponding to at least one separating edge; coding the first key set and the corresponding value to obtain a solution vector; constructing and obtaining a first OKVS based on the second key set and the random function; performing vertex vector expansion on at least one separation edge and constructing to obtain a second OKVS; and constructing a total OKVS of a plurality of key value pairs according to the solution vector, the first OKVS and the second OKVS. The method and the device aim at manufacturing linear independence, and improve the efficiency of solving the equation set and the space utilization rate of the final OKVS.
Description
Technical Field
The invention belongs to the field of data processing, and particularly relates to a method, a system, equipment and a storage medium for constructing a key-value pair data structure.
Background
OKVS (oblivious key-value store) refers to a data structure capable of preserving the key-value mapping relationship on the premise of hiding the key and value contents, for example, there is a set of key value pairs { (x 1, y 1), (x 2, y 2), (x 3, y 3) }, then there is an OKVS function f, such that f (x 1) = y1, f (x 2) = y2, f (x 3) = y3, and for other keys f (x _ other) are random numbers. OKVS is a data structure concept for securely storing key-value pairs, and is directly or indirectly applied to the implementation of cryptographic protocols such as multi-party secure intersection, and there are various ways to implement OKVS, of which PaXoS (linear independent bit vector generator) is a more common way.
The key to the PaXoS structure is that for the vector generated by the element being processed, it needs to be detected in time whether it is linearly related to the set of resultant vectors generated by the element that has already been processed. The present processing method includes making the dimension of the output vector large enough to make the probability that the result vector group obtained after all elements are inserted is linearly independent large enough, or fixing the dimension of the vector first, adjusting the order of processing elements, preferentially processing the elements that do not generate linear correlation, and then expanding the dimension of the output vector to solve the remaining elements that will cause linear correlation.
The resultant vector set output by PaXoS will be used as coefficients to form a bit linear equation set in the subsequent application of constructing OKVS, and the solution of the equation set is used as an output data structure of OKVS. On one hand, the dimension of the expanded vector is consistent with the number of unknowns of the equation set, the larger the dimension of the vector is, the more the unknowns of the equation are, the larger the space size of a set of solutions (possibly multiple sets of solutions) of the equation set as an OKVS output structure is, and on the other hand, because the current dimension expanding mode is random expansion, the coefficients of the expanded part are consistent and random, and the complexity of equation solution is higher.
Disclosure of Invention
The invention provides a method, a system, equipment and a storage medium for constructing a key-value pair data structure, aiming at overcoming the defect of low equation solving efficiency caused by large dimensionality of an expansion vector and large randomness of an expansion mode when the OKVS is realized by PaXoS in the prior art.
The invention solves the technical problems through the following technical scheme:
a method of building a data structure of key-value pairs, the method of building comprising:
s11, generating an undirected graph corresponding to a plurality of key value pairs, wherein the undirected graph comprises a plurality of vertexes and a plurality of inserting edges, the undirected graph corresponds to a key edge list, and the key edge list is used for representing the corresponding relation between each key value pair and the corresponding inserting edge and the vertex value of the inserting edge;
s12, if the undirected graph has a ring graph, separating out the ring graph and at least one separation edge of the undirected graph;
s13, dividing the plurality of key value pairs to obtain a first key set corresponding to the acyclic graph and a second key set corresponding to the at least one separating edge;
s14, coding the first key set and the corresponding values to obtain a solution vector;
s15, constructing and obtaining a first OKVS based on the second key set and a random function;
s16, performing vertex vector expansion on the at least one separation edge and constructing to obtain a second OKVS;
s17, a total OKVS of the multiple key value pairs is constructed according to the solution vector, the first OKVS and the second OKVS.
Preferably, the construction method further comprises:
executing steps S11 to S17 on the first OKVS to obtain a first solution vector, a first partial OKVS and a second partial OKVS corresponding to the first OKVS, and combining the first solution vector, the first partial OKVS and the second partial OKVS to construct the first OKVS;
and/or the presence of a gas in the gas,
and executing steps S11 to S17 on the second OKVS to obtain a second solution vector, a third partial OKVS and a fourth partial OKVS corresponding to the second OKVS, and combining the second solution vector, the third partial OKVS and the fourth partial OKVS to construct the second OKVS.
Preferably, step S12 specifically includes:
traversing all vertexes of the undirected graph based on a graph traversal method, and outputting at least one ordered list and a corresponding undirected edge set;
and separating out the acyclic graph and the corresponding at least one separation edge based on the selected target ordered list.
Preferably, step S14 specifically includes:
sequentially carrying out vector assignment on the vertexes of the acyclic graph to obtain the solution vector;
each inserting edge corresponds to a target key, and values in the key value pair to which the target key belongs are obtained through calculation of two end point vectors of each inserting edge.
Preferably, step S14 further comprises:
and if the solution vector has a vacancy, filling any value in the plurality of key value pairs.
Preferably, step S15 specifically includes:
processing keys in the second key set based on the random function to obtain corresponding values;
generating a new key-value pair based on the keys in the second set of keys and the corresponding values to construct the first OKVS.
A system for building a data structure of key-value pairs, the system comprising:
the device comprises a graph generator, a graph generation unit and a graph generation unit, wherein the graph generator is used for generating an undirected graph corresponding to a plurality of key value pairs, the undirected graph comprises a plurality of vertexes and a plurality of inserting edges, the undirected graph corresponds to a key edge list, and the key edge list is used for representing the corresponding relation between each key value pair and the vertex value of the corresponding inserting edge;
the ring extractor is used for extracting an acyclic graph and at least one separation edge of the undirected graph when the undirected graph has a cyclic graph;
a ring processor to partition the plurality of key-value pairs into a first set of keys corresponding to the acyclic graph and a second set of keys corresponding to the at least one disjunct edge;
the tree assignor is used for encoding the first key set and the corresponding value to obtain a solution vector;
the ring assignor is used for constructing and obtaining a first OKVS based on the second key set and the random function;
the position encoder is used for performing vertex vector expansion on the at least one separation edge and constructing to obtain a second OKVS;
and the key value pair assignor is used for constructing the total OKVS of the plurality of key value pairs according to the solution vector, the first OKVS and the second OKVS in a combined mode.
Preferably, the construction system further comprises:
a null filler for filling with any value of the plurality of key value pairs when a null exists for the solution vector.
An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for constructing the data structure of key-value pairs when executing the computer program.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method of constructing a data structure of key-value pairs as described above.
The positive progress effects of the invention are as follows: the blindness of PaXoS in manufacturing linear independence is eliminated, the linear independence is manufactured in a targeted mode, OKVS is generated in a mode of solving an equation set of the traditional PaXoS, so that the efficiency of solving the equation set when the PaXoS is used as a coefficient of the linear equation set is improved, the OKVS is realized in a self-iteration mode by combining a multi-layer OKVS structure, namely the OKVS is required in the process of realizing the OKVS, and the space utilization rate of the final OKVS is improved.
Drawings
Fig. 1 is a flowchart of a method for constructing a data structure of key-value pairs according to embodiment 1 of the present invention.
Fig. 2 is a schematic diagram of an undirected graph in the method for constructing a key-value pair data structure according to embodiment 1 of the present invention.
Fig. 3 is a schematic analysis diagram of an undirected graph in the method for constructing a key-value pair data structure according to embodiment 1 of the present invention.
Fig. 4 is a schematic block diagram of a system for constructing a key-value pair data structure according to embodiment 2 of the present invention.
Fig. 5 is a schematic structural diagram of an electronic device according to embodiment 3 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
A method for constructing a data structure of key-value pairs, as shown in fig. 1, the method comprising:
s11, generating an undirected graph corresponding to a plurality of key value pairs, wherein the undirected graph comprises a plurality of vertexes and a plurality of inserting edges; the undirected graph corresponds to a key edge list, and the key edge list is used for representing the corresponding relation between each key value pair and the corresponding insertion edge and the vertex value of the insertion edge;
wherein, suppose that the n key value pairs to be inserted by OKVS arek i ≠k j I ≠ j, where the key space is K and the value space is W. The preset vector dimension is m. Defining two different hash functions h 1 (·),h 2 (. Cndot.) whose output is an integer from 1 to m. And defining an undirected graph, wherein the number of vertexes of the graph is at most m, the vertexes are numbered from 1 to m, initializing an empty undirected graph G = (V, E), and the V and the E are empty sets. A list M of key-edge bi-directional correspondences is initialized.
A new key-value pair (k) is generated by the following steps i ,v i ) And (5) writing the key-edge bidirectional correspondence table into a graph G, and updating a key-edge bidirectional correspondence table M:
(1) Calculating two position valuesAndif the two values are equal, calculatingAndc as salt value increases untilAnd withAre not equal.
(3) If there is no sideAlready in E, the graph generation fails, otherwise it will beAdd to E with key-edgeAdd to M.
Is woven intoAnd after more key-value pairs exist, G and M are output. FIG. 2 is an example of an added 17 sides, with an intervening side e 7 = (6,10) for example, since h is assumed 1 (k 7 )=6,h 2 (k 7 ) =10. After all edges have been added, the complete figure 2 is obtained.
S12, if the undirected graph has a ring graph, separating out the ring graph and at least one separation edge of the undirected graph;
in this embodiment, step S12 specifically includes:
traversing all vertexes of the undirected graph based on a graph traversal method, and outputting at least one ordered list and a corresponding undirected edge set;
and separating out the acyclic graph and the corresponding at least one separation edge based on the selected target ordered list.
Wherein, the observation G is composed of a plurality of connected subgraphs, and a ring structure may exist in each connected subgraph. The purpose of this processing module is to derive each maximum acyclic part of each connected subgraph. Traversing all the vertexes of the graph G according to the graph traversing method and using E t The order of edges experienced during traversal is recorded. Finally outputting the ordered list E of the experienced edges t And discarded set of undirected edges E c 。
S13, dividing the plurality of key value pairs to obtain a first key set corresponding to the acyclic graph and a second key set corresponding to the at least one separating edge;
wherein the inserted key set can be divided into two disjoint parts K by a list M of key-edge bi-directional correspondences t ,K c ,Wherein K is t A plurality of tree structures (also called forests) are formed in the graph. Still following the example, the resulting ordered list of edges is:
E t = { (3, 31), (31, 4), (31, 1), (1,159), (31,15), (15,9), (9,2), (2,6), (6,10), (12,30), (30,25), (25,66), (21,315), (315,27) }; its corresponding ordered key list:
K t ={k 8 ,k 14 ,k 9 ,k 16 ,k 11 ,k 1 ,k 10 ,k 2 ,k 7 ,k 5 ,k 12 ,k 15 ,k 17 ,k 13 }, separated K c ={k 6 ,k 3 ,k 4 And as shown in fig. 3, the edge on which the current strip is obliquely cut on the way is a separated edge. It should be noted that, according to different traversal manners, the separation edge may also be different, for example, k may also be used 3 ,k 7 ,k 17 And the subsequent construction of OKVS is not influenced.
S14, coding the first key set and the corresponding values to obtain a solution vector;
in this embodiment, step S14 specifically includes:
sequentially carrying out vector assignment on the vertexes of the acyclic graph to obtain the solution vector;
each inserting edge corresponds to a target key, and the value in the key value pair to which the target key belongs is obtained through calculation of two end point vectors of each inserting edge.
Wherein, to encode tree-related key-value pairs into OKVS, i.e. K t The key in (1) and its value are encoded into OKVS. Due to K t Key and order list E in t Corresponds to an edge in, so according to E t In order access E t And determines the value in array S accordingly. In particular, for order List E t Each edge e in t Necessarily, there is a unique key k t ∈K t In correspondence with this, there is further a value v t . Let e t =(s t ,d t )=(h 1 (k t ),h 2 (k t ) Or = (h) 2 (k t ),h 1 (k t ) Because it is an edge of an undirected graph), set the value into S as follows:
observation of S [ S ] t ]And S [ d ] t ]If both are empty, one of them is selected and filled with a random value of the value space W, otherwise nothing is done. Operating the decoding module with the input being the key k t Out of the codeThe result is b t . If b is t =b(k t ) Randomly selecting an integer η between 1 and r t And η t Not in the set of values of R, S [ m + η ] is filled with a random value of the value space W t ]Not provided for S [ S ] t ]And S [ d ] t ]The null is Sd t ]Let us orderFinally, the key value pair (k) t ,η t ) Adding into R; if b is t ≠b(k t ) Is not represented by S [ S ] t ]And S [ d ] t ]The null is Sd t ]Let us order
For the above-mentioned decoding module, the decoding of OKVS (S, S) for any one key k 1 ,S 2 ) The module operates as follows:
calculate g 1 =h 1 (k),g 2 =h 2 (k) If g is 1 =g 2 Calculating c and g from the increase 1 =h 1 (k|c),g 2 =h 2 (k | c) until equal.
Operation S 1 The decoding module of (1), the input key is k, the decoding result is b ', then the random function b (k) is calculated and whether it is equal to b' is judged: if not, returning the valueIf equal, then S is run 2 The decoding module obtains a result eta and returns the resultThe operation of the decoding module is completed.
In this embodiment, step S14 further includes:
if the solution vector has a vacancy, any value in the plurality of key value pairs is used for filling.
S15, constructing and obtaining a first OKVS based on the second key set and a random function;
in this embodiment, step S15 specifically includes:
processing keys in the second key set based on the random function to obtain corresponding values;
generating a new key-value pair based on the keys in the second set of keys and the corresponding values to construct the first OKVS.
Wherein, from the perspective of fig. 2 and 3, the figures are formed based on the foregoing steps, respectively, and the ring structure in the figures is temporarily separated from the figure trunk portion in an unprocessed manner. The portion to be separated is treated first as follows. The addition of this part of the edges (i.e. keys) will make the already formed set of vectors linearly dependent, requiring the extension of the vector dimensions to make them linearly independent, where K is indirectly recorded by an OKVS c Of (2). Specifically, if K c Is an empty set, then an empty OKVS is output. If K is c Instead of an empty set, the following key-value pairs are recorded with an OKVSWherein b (-) is a random bit function, which is called OKVS S 1 。
S16, performing vertex vector expansion on the at least one separation edge and constructing to obtain a second OKVS;
wherein the assigner generates a new key-value pair container and the position encoder is operative to encode the key-value pair in the new OKVS, which is designated as S 2 。
S17, a total OKVS of the multiple key value pairs is constructed according to the solution vector, the first OKVS and the second OKVS in a combined mode.
In this embodiment, the construction method further includes:
executing steps S11 to S17 on the first OKVS to obtain a first solution vector, a first partial OKVS and a second partial OKVS corresponding to the first OKVS, and combining the first solution vector, the first partial OKVS and the second partial OKVS to construct the first OKVS;
wherein S is 1 As OKVSThe output structure can be implemented as the scheme described in steps S11 to S17 of this embodiment 1 Further construction of the data structure of (c).
And executing steps S11 to S17 on the second OKVS to obtain a second solution vector, a third partial OKVS and a fourth partial OKVS corresponding to the second OKVS, and combining the second solution vector, the third partial OKVS and the fourth partial OKVS to construct the second OKVS.
Wherein S is 2 As the output structure of OKVS, S can be realized according to the scheme described in steps S11 to S17 of the present embodiment 2 Further construction of the data structure of (1).
Furthermore, when the total OKVS is constructed, the data structure of the total OKVS is multi-layered OKVS, and each layer OKVS comprises 3 parts: solution vector, one OKVS constructed based on the key of vector expansion, and one OKVS constructed by the new key value pair after vector expansion. To encode all key-value pairs into the data structure, a fully empty array S [0 + m + R ] of length m + R and a null key-value pair container R may be initialized. And continuously inserting the key value pair and updating the array S by the method to finally obtain the output data structure.
In the embodiment, blindness of PaXoS in manufacturing linear independence is eliminated, the linear independence is manufactured in a targeted manner, and OKVS is generated without a traditional method for solving an equation set of PaXoS, so that efficiency of solving the equation set when PaXoS is used as a coefficient of the linear equation set is improved, and the OKVS is realized by using a self-iteration method in combination with a multi-layer OKVS structure, namely the OKVS is required to be used in a process of realizing the OKVS, and space utilization rate of the final OKVS is improved.
Example 2
A system for building a data structure of key-value pairs, as shown in fig. 4, the system comprising:
the device comprises a graph generator, a graph generation unit and a graph generation unit, wherein the graph generator is used for generating an undirected graph corresponding to a plurality of key value pairs, the undirected graph comprises a plurality of vertexes and a plurality of inserting edges, the undirected graph corresponds to a key edge list, and the key edge list is used for representing the corresponding relation between each key value pair and the vertex value of the corresponding inserting edge;
wherein,suppose that the n key value pairs into which OKVS is to be inserted arek i ≠k j I ≠ j, where the key space is K and the value space is W. The preset vector dimension is m. Defining two different hash functions h 1 (·),h 2 (. Cndot.), the output of which is an integer from 1 to m. And defining an undirected graph, wherein the number of vertexes of the graph is at most m, the vertexes are respectively numbered from 1 to m, initializing an empty undirected graph G = (V, E), and both V and E are empty sets. A list M of key-edge bi-directional correspondences is initialized.
A new key-value pair (k) is generated by the following steps i ,v i ) And (5) writing the key-edge bidirectional correspondence table into a graph G, and updating a key-edge bidirectional correspondence table M:
(1) Calculating two position valuesAndif the two values are equal, calculatingAndc as salt value increases untilAnd withAre not equal.
(3) If there is no sideAlready in E, the graph generation fails, otherwise it will beAdd to E with key-edgeAdded to M.
And after a plurality of key value pairs are coded, G and M are output. FIG. 2 is an example of an added 17-edge with an intervening edge e 7 = (6,10) for example, since h is assumed 1 (k 7 )=6,h 2 (k 7 ) =10. After all edges have been added, the complete figure 2 is obtained.
The ring extractor is used for extracting an acyclic graph and at least one separation edge of the undirected graph when the undirected graph has a cyclic graph;
the loop extractor is specifically configured to traverse all vertices of the undirected graph based on a graph traversal method, output at least one ordered list and a corresponding undirected edge set, and extract the acyclic graph and at least one corresponding separating edge based on the selected target ordered list.
Wherein, the observation G is composed of a plurality of connected subgraphs, and a ring structure may exist in each connected subgraph. The purpose of this processing module is to derive each maximum acyclic part of each connected subgraph. Traversing all the vertexes of the graph G according to the graph traversing method and using E t The order of edges experienced during traversal is recorded. Finally outputting an ordered list E of edges traversed t And discarded set of undirected edges E c 。
A ring processor to partition the plurality of key-value pairs into a first set of keys corresponding to the acyclic graph and a second set of keys corresponding to the at least one disjunct edge;
wherein the inserted key set can be divided into two disjoint parts K by a list M of key-edge bi-directional correspondences t ,K c ,Wherein K t A plurality of tree structures (also called forests) are formed in the graph. Still following the example, the resulting ordered list of edges is:
E t = { (3, 31), (31, 4), (31, 1), (1,159), (31,15), (15,9), (9,2), (2,6), (6,10), (12,30), (30,25), (25,66), (21,315), (315,27) }; its corresponding ordered key list:
K t ={k 8 ,k 14 ,k 9 ,k 16 ,k 11 ,k 1 ,k 10 ,k 2 ,k 7 ,k 5 ,k 12 ,k 15 ,k 17 ,k 13 }, separated K c ={k 6 ,k 3 ,k 4 And as shown in fig. 3, the edge on which the current strip is obliquely cut on the way is a separated edge. It should be noted that, according to different traversal manners, the separation edge may also be different, for example, k may also be used 3 ,k 7 ,k 17 And the subsequent construction of OKVS is not influenced.
A tree assignor for encoding the first key set and corresponding values to obtain a solution vector;
each inserting edge corresponds to a target key, and values in the key value pair to which the target key belongs are obtained through calculation of two end point vectors of each inserting edge.
Wherein, to encode tree-related key-value pairs into OKVS, i.e. K t The key in (1) and its value are encoded into OKVS. Due to K t Key and order list E in t In (3) correspond to each other, so according to E t In order access E t And determines the value in the array S accordingly. In particular, for order List E t Each edge e in t Necessarily, there is a unique key k t ∈K t In correspondence with this, there is further a value v t . Let e t =(s t ,d t )=(h 1 (k t ),h 2 (k t ) Or = (h) 2 (k t ),h 1 (k t ) Because it is an edge of an undirected graph), set the value into S as follows:
observation of S [ S ] t ]And S [ d ] t ]If both are empty, one of them is selected and filled with a random value of the value space W, otherwise nothing is done. Operating the decoding module with the input being the key k t The decoded result is b t . If b is t =b(k t ) Randomly selecting an integer η between 1 and r t And η t Not in the set of values of R, S [ m + η ] is filled with a random value of the value space W t ]Not provided for S [ S ] t ]And S [ d ] t ]If the empty is Sd t ]Let us orderFinally, the key value pair (k) t ,η t ) Adding into R; if b is t ≠b(k t ) Is not represented by S [ S ] t ]And S [ d ] t ]The null is Sd t ]Let us order
For the above-mentioned decoding module, the decoding of OKVS (S, S) for any one key k 1 ,S 2 ) The module operates as follows:
calculating g 1 =h 1 (k),g 2 =h 2 (k) If g is 1 =g 2 Calculating c and g from the increase 1 =h 1 (k|c),g 2 =h 2 (k | c) until equal.
Operation S 1 The decoding module of (1), the input key is k, the decoding result is b ', then the random function b (k) is calculated and whether it is equal to b' is judged: if not, returning the valueIf equal, then S is run 2 The decoding module obtains a result eta and returns the resultGo up toInto the operation of the decoding module.
The ring assigner is used for constructing and obtaining a first OKVS based on the second key set and the random function;
the ring assigner is specifically configured to process the keys in the second key set based on the random function to obtain corresponding values, and generate new key-value pairs based on the keys in the second key set and the corresponding values to construct and obtain the first OKVS. In addition, for the obtained first OKVS, a first solution vector, a first partial OKVS and a second partial OKVS corresponding to the first OKVS are generated based on the construction system, and the first OKVS is constructed by combining the first solution vector, the first partial OKVS and the second partial OKVS;
wherein, from the perspective of fig. 2 and 3, the figures are formed based on the foregoing steps, respectively, and the ring structures in the figures are temporarily separated from the figure stem portion in an unprocessed manner. The portion to be separated is treated first as follows. The addition of this part of the edges (i.e. keys) will make the already formed set of vectors linearly dependent, requiring the extension of the vector dimensions to make them linearly independent, where K is indirectly recorded by an OKVS c Of (2). In particular, if K c Is an empty set, then an empty OKVS is output. If K is c Instead of an empty set, the following key-value pairs are recorded with an OKVSWherein b (-) is a random bit function, which is called OKVS S 1 。
The position encoder is used for performing vertex vector expansion on the at least one separation edge and constructing to obtain a second OKVS;
wherein the assigner generates a new key-value pair container, and the position encoder is operative to encode the key-value pair in a new OKVS, which is called S 2 . And for the obtained second OKVS, generating a second solution vector, a third partial OKVS and a fourth partial OKVS corresponding to the second OKVS based on the construction system, and constructing the second OKVS by combining the second solution vector, the third partial OKVS and the fourth partial OKVS.
And the key value pair assignor is used for constructing the total OKVS of the plurality of key value pairs according to the solution vector, the first OKVS and the second OKVS in a combined mode.
It should be noted that, the above-mentioned encoding process may call the OKVS encoding module to perform the encoding operation correspondingly.
In addition, based on the above nested construction of the first and second OKVS, when constructing the total OKVS, the data structure thereof is of multiple layers of OKVS, each layer of OKVS comprising 3 parts: solution vector, one OKVS constructed based on the key of vector expansion, and one OKVS constructed by the new key value pair after vector expansion. To encode all key-value pairs into the data structure, a fully empty array S [0 + m + R ] of length m + R and a null key-value pair container R may be initialized. And continuously inserting the key value pair and updating the array S by the method to finally obtain the output data structure.
In this embodiment, referring to fig. 4, the construction system further includes:
a null filler for filling with any value of the plurality of key value pairs when a null exists for the solution vector.
In the embodiment, blindness of PaXoS in manufacturing linear independence is eliminated, the linear independence is manufactured in a targeted manner, and OKVS is generated without a traditional method for solving an equation set of PaXoS, so that efficiency of solving the equation set when PaXoS is used as a coefficient of the linear equation set is improved, and the OKVS is realized by using a self-iteration method in combination with a multi-layer OKVS structure, namely the OKVS is required to be used in a process of realizing the OKVS, and space utilization rate of the final OKVS is improved.
Example 3
An electronic device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor implements the method for constructing the data structure of the key-value pair when executing the computer program.
Fig. 5 is a schematic structural diagram of an electronic device provided in this embodiment. Fig. 5 illustrates a block diagram of an exemplary electronic device 90 suitable for use in implementing embodiments of the present invention. The electronic device 90 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, the electronic device 90 may take the form of a general purpose computing device, which may be a server device, for example. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 that connects the various system components, including the memory 92 and the processor 91.
The bus 93 includes a data bus, an address bus, and a control bus.
The processor 91 executes various functional applications and data processing by running a computer program stored in the memory 92.
The electronic device 90 may also communicate with one or more external devices 94 (e.g., keyboard, pointing device, etc.). Such communication may be through an input/output (I/O) interface 95. Also, the electronic device 90 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via a network adapter 96. The network adapter 96 communicates with the other modules of the electronic device 90 via the bus 93. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, to name a few.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the electronic device are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module, according to embodiments of the application. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Example 4
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method of constructing a data structure of key-value pairs as described above.
More specific examples, among others, that the readable storage medium may employ may include, but are not limited to: a portable disk, a hard disk, random access memory, read only memory, erasable programmable read only memory, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code for causing a terminal device to execute the steps of implementing the user expertise scoring method according to any one of embodiments 1 to 4 when the program product runs on the terminal device.
Where program code for carrying out the invention is written in any combination of one or more programming languages, the program code may be executed entirely on the user device, partly on the user device, as a stand-alone software package, partly on the user device and partly on a remote device or entirely on the remote device.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.
Claims (10)
1. A method for constructing a data structure of key-value pairs, the method comprising:
s11, generating an undirected graph corresponding to a plurality of key value pairs, wherein the undirected graph comprises a plurality of vertexes and a plurality of inserting edges, the undirected graph corresponds to a key edge list, and the key edge list is used for representing the corresponding relation between each key value pair and the corresponding inserting edge and the vertex value of the inserting edge;
s12, if the undirected graph has a ring graph, separating out the ring graph and at least one separation edge of the undirected graph;
s13, dividing the plurality of key value pairs to obtain a first key set corresponding to the acyclic graph and a second key set corresponding to the at least one separating edge;
s14, coding the first key set and the corresponding values to obtain a solution vector;
s15, constructing and obtaining a first OKVS based on the second key set and a random function;
s16, performing vertex vector expansion on the at least one separation edge and constructing to obtain a second OKVS;
s17, a total OKVS of the multiple key value pairs is constructed according to the solution vector, the first OKVS and the second OKVS.
2. The method of building a data structure of key-value pairs according to claim 1, further comprising:
executing steps S11 to S17 on the first OKVS to obtain a first solution vector, a first division OKVS and a second division OKVS corresponding to the first OKVS, and combining the first solution vector, the first division OKVS and the second division OKVS to construct the first OKVS;
and/or the presence of a gas in the atmosphere,
and executing steps S11 to S17 on the second OKVS to obtain a second solution vector, a third partial OKVS and a fourth partial OKVS corresponding to the second OKVS, and combining the second solution vector, the third partial OKVS and the fourth partial OKVS to construct the second OKVS.
3. The method for constructing a data structure of key-value pairs according to claim 1, wherein step S12 specifically includes:
traversing all vertexes of the undirected graph based on a graph traversal method, and outputting at least one ordered list and a corresponding undirected edge set;
and separating out the acyclic graph and the corresponding at least one separation edge based on the selected target ordered list.
4. The method for constructing a data structure of key-value pairs according to claim 1, wherein step S14 specifically includes:
sequentially carrying out vector assignment on the vertexes of the acyclic graph to obtain the solution vector;
each inserting edge corresponds to a target key, and values in the key value pair to which the target key belongs are obtained through calculation of two end point vectors of each inserting edge.
5. The method for constructing a data structure of key-value pairs according to claim 4, wherein step S14 further comprises:
and if the solution vector has a vacancy, filling any value in the plurality of key value pairs.
6. The method for constructing a data structure of key-value pairs according to claim 1, wherein step S15 specifically includes:
processing keys in the second key set based on the random function to obtain corresponding values;
generating a new key-value pair based on the keys in the second set of keys and the corresponding values to construct the first OKVS.
7. A system for building a data structure of key-value pairs, the system comprising:
the device comprises a graph generator, a graph generation unit and a graph generation unit, wherein the graph generator is used for generating an undirected graph corresponding to a plurality of key value pairs, the undirected graph comprises a plurality of vertexes and a plurality of insertion edges, the undirected graph corresponds to a key edge list, and the key edge list is used for representing the corresponding relation between each key value pair and the vertex value of the corresponding insertion edge;
a ring extractor for extracting an acyclic graph and at least one separating edge of the acyclic graph when the acyclic graph exists;
a ring processor to partition the plurality of key value pairs into a first set of keys corresponding to the acyclic graph and a second set of keys corresponding to the at least one disjunct edge;
the tree assignor is used for encoding the first key set and the corresponding value to obtain a solution vector;
the ring assignor is used for constructing and obtaining a first OKVS based on the second key set and the random function;
the position encoder is used for performing vertex vector expansion on the at least one separation edge and constructing to obtain a second OKVS;
a key-value pair assignor to assign a key-value pair to the first OKVS and the second OKVS based on the solution vectorOKVS combined construction results Total OKVS of the plurality of key-value pairs.
8. The system for building a data structure of key-value pairs according to claim 7, wherein the building system further comprises:
a null filler for filling with any value of the plurality of key value pairs when a null exists in the solution vector.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of constructing a data structure of key-value pairs according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the method for constructing a data structure of key-value pairs according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210813885.1A CN115309945A (en) | 2022-07-11 | 2022-07-11 | Method, system, equipment and storage medium for constructing data structure of key value pair |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210813885.1A CN115309945A (en) | 2022-07-11 | 2022-07-11 | Method, system, equipment and storage medium for constructing data structure of key value pair |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115309945A true CN115309945A (en) | 2022-11-08 |
Family
ID=83857615
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210813885.1A Pending CN115309945A (en) | 2022-07-11 | 2022-07-11 | Method, system, equipment and storage medium for constructing data structure of key value pair |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115309945A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116684083A (en) * | 2023-06-02 | 2023-09-01 | 西南财经大学 | Inadvertent key value storage method based on two hash functions and one-way step thereof |
CN117436127A (en) * | 2023-11-14 | 2024-01-23 | 西南财经大学 | Star-shaped unintentional key value storage expansion optimization method and system |
-
2022
- 2022-07-11 CN CN202210813885.1A patent/CN115309945A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116684083A (en) * | 2023-06-02 | 2023-09-01 | 西南财经大学 | Inadvertent key value storage method based on two hash functions and one-way step thereof |
CN116684083B (en) * | 2023-06-02 | 2024-05-28 | 西南财经大学 | Inadvertent key value storage method based on two hash functions and one-way step thereof |
CN117436127A (en) * | 2023-11-14 | 2024-01-23 | 西南财经大学 | Star-shaped unintentional key value storage expansion optimization method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115309945A (en) | Method, system, equipment and storage medium for constructing data structure of key value pair | |
US5905507A (en) | Compression of geometric models using spanning trees | |
US7076486B2 (en) | Method and system for efficiently identifying differences between large files | |
US8051032B2 (en) | System and method for loading records into a partitioned database table | |
KR100233972B1 (en) | Compression of simple geotric models using spanning trees | |
CN108961141B (en) | Vector map double zero watermarking method, system, storage medium and server | |
US10644726B2 (en) | Method and apparatus for reconstructing a data block | |
CN106797446A (en) | Historical search based on memory | |
US6366279B1 (en) | Triangle mesh compression | |
WO2023274059A1 (en) | Method for training alternating sequence generation model, and method for extracting graph from text | |
JP7376006B2 (en) | Drivable 3D character generation method, device, electronic device, and storage medium | |
CN112667860A (en) | Sub-graph matching method, device, equipment and storage medium | |
Plumecoq et al. | From template analysis to generating partitions: I: periodic orbits, knots and symbolic encodings | |
Ver Steeg et al. | The information sieve | |
JP3184785B2 (en) | 3D shape model transmission method and device, 3D shape model compression method and device, 3D shape model display method and device | |
JP2019197438A (en) | Graph updating device, graph updating method, and program | |
CN113407976A (en) | Digital signature method, signature information verification method, related device and electronic equipment | |
CN114647764B (en) | Query method and device of graph structure and storage medium | |
Han et al. | The edit-distance between a regular language and a context-free language | |
US20120324560A1 (en) | Token data operations | |
CN114745104A (en) | Information transmission method for eliminating noise interference based on multi-dimensional quantum error correction | |
CN106658034A (en) | File storage and reading method and device | |
US9361578B2 (en) | Memory efficient state-set representation for planning | |
CN107426580A (en) | Colony's picture coding structure generation method based on Zhu Liu method and ant colony method | |
JP2009169171A (en) | Point compression device for elliptic curve, point deployment device for elliptic curve, method therefor, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20230802 Address after: 201802 room 416, 4th floor, building 1, No. 655, Yinxiang Road, Jiading District, Shanghai Applicant after: SHANGHAI FUDATA TECHNOLOGY Co.,Ltd. Address before: Room 741, Block C, Floor 2, No. 38, Shengtang Street Industrial Zone, Cencun Village, Tianhe District, Guangzhou, Guangdong 510640 (office only) Applicant before: Shanghai Fushu Technology Co.,Ltd. Guangzhou Branch |