Information storage method, device and storage medium
By dividing the serial and parallel flowchart into matrix cells and storing their content information, the problem of difficult to store flowcharts containing closed loops in the prior art is solved, and a more flexible and efficient storage method is achieved.
Patent Information
- Application Number
- CN202111278009.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-30
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-10-30
AI Technical Summary
It is difficult for prior art to flexibly store flowcharts containing serial and parallel structures, especially when there is a closed loop in the flowchart, the use of tree structure storage becomes complicated.
By dividing the serial and parallel flowchart into multiple matrix cells and storing the content information in each cell in sequence using multi-dimensional array objects, flexible storage of the serial and parallel flowchart is achieved.
This method can effectively store a series-parallel flowchart containing a closed loop, improving storage flexibility and complexity processing capabilities.
Smart Images

Figure CN113971232B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to an information storage method, apparatus, and storage medium. Background Art
[0002] A flowchart is a block diagram representation of an algorithm, workflow, or process. It uses different blocks to represent different steps, and arrows to connect every two steps. This representation method is convenient for explaining the method of solving known problems. Flowcharts are widely used in analyzing, designing, recording, and manipulating processes and programs in many fields. Usually, the tree data structure is used to store flowcharts and draw diagrams. In computer science, a tree is an abstract data type or a data structure that implements this abstract data type, used to simulate a data set with a tree-like structure property. It is a set composed of n (n>0) finite nodes with a hierarchical relationship. Each node has a finite number of child nodes or no child nodes; a node without a parent node is called the root node; each non-root node has exactly one parent node; except for the root node, each child node can be divided into multiple non-overlapping subtrees; there is no cycle in the tree.
[0003] If there are series-parallel blocks in the flowchart, that is, there is a closed loop in the flowchart, it becomes extremely complex to continue using the tree structure for storage or drawing. The subtrees in the series-parallel flowchart will eventually intersect, so the method of using the tree structure to store the series-parallel flowchart is not flexible enough. Summary of the Invention
[0004] Based on this, in view of the above technical problems, it is necessary to provide an information storage method, apparatus, and storage medium. By dividing the closed graph formed by the series-parallel flowchart into multiple cells in the way of matrix cells, obtaining the content information in each cell, and storing the content information in each cell in sequence, the series-parallel flowchart can be stored more flexibly.
[0005] In a first aspect, this application provides an information storage method, and the method includes: obtaining a series-parallel graph, where the series-parallel graph includes multiple nodes and the connections between the multiple nodes; constructing a closed graph including the series-parallel graph; dividing the closed graph into multiple cells according to a target division rule; obtaining the content information in each of the multiple cells, and sequentially storing the content information in each cell using multiple array objects in a multi-dimensional array.
[0006] In an optional implementation manner, the constructing a closed graph including the series-parallel graph includes:
[0007] obtaining the maximum value in the series direction and the maximum value in the parallel direction in the series-parallel graph;
[0008] Construct a rectangle including the series-parallel graph with the maximum value in the series direction and the maximum value in the parallel direction as the length and width of the rectangle, respectively, as the closed graph.
[0009] In an alternative embodiment, the dividing the closed graph into a plurality of cells according to the target division rule includes:
[0010] Divide the closed graph into m columns, each column including at least one node in parallel;
[0011] Divide the closed graph into n rows, each row including at least one node in series;
[0012] Determine m*n cells obtained by dividing the closed graph according to the m columns and the n rows.
[0013] In an alternative embodiment, the obtaining the content information in each of the plurality of cells includes:
[0014] Traverse each of the plurality of cells in sequence. If the cell includes a node, obtain the content information of the node; if the cell includes a connection line, obtain the line type identifier of the connection line; if the cell does not include a node and does not include a connection line, the content information in the cell is empty.
[0015] In an alternative embodiment, the storing the content information in each cell sequentially using a plurality of array objects in a multi-dimensional array includes:
[0016] Obtain a plurality of array objects in the multi-dimensional array. One array object is used to store the content information in one cell, and the array object includes a first attribute name and a second attribute name;
[0017] Obtain the content information in each of the plurality of cells in sequence;
[0018] If the content information in the cell is empty, set the associated stored content of the first attribute name in the corresponding array object to be empty, and set the associated stored content of the second attribute name in the corresponding array object to be empty;
[0019] If the content information in the cell includes the content information of a node, set the associated stored content of the first attribute name in the corresponding array object to be the content information of the node;
[0020] If the content information in the cell includes a connection line type identifier, set the associated stored content of the second attribute name in the corresponding array object to be the line type identifier.
[0021] In an alternative embodiment, after storing the content information of each cell in sequence using multiple array objects in the multi-dimensional array, the method further includes:
[0022] When a drawing instruction is detected, traverse each array object in the multi-dimensional array in sequence, perform rendering and drawing based on the stored content in each array object, and obtain the drawing result in the cell corresponding to each array object;
[0023] Stitch together the drawing results in the cells corresponding to each array object in sequence to obtain the series-parallel graph.
[0024] In an alternative embodiment, the performing rendering and drawing based on the stored content in each array object to obtain the drawing result in the cell corresponding to each array object includes:
[0025] If the associated stored content of the first attribute name in the array object is not empty, input the associated stored content of the first attribute name into the first UI component for drawing rendering to obtain a first drawing rendering result, where the first UI component is used to generate nodes based on node content;
[0026] If the associated stored content of the second attribute name in the array object is not empty, input the associated stored content of the second attribute name into the second UI component for drawing rendering to obtain a second drawing rendering result, where the second UI component is used to generate connection lines based on line type identifiers;
[0027] Obtain the drawing result in the cell corresponding to the array object based on the first drawing rendering result and / or the second drawing rendering result.
[0028] In a second aspect, the present application provides an information storage device, which includes:
[0029] A first acquisition unit, configured to acquire a series-parallel graph, where the series-parallel graph includes multiple nodes and connection lines between the multiple nodes;
[0030] A construction unit, configured to construct a closed graph including the series-parallel graph;
[0031] A division unit, configured to divide the closed graph into multiple cells according to a target division rule;
[0032] A second acquisition unit, configured to acquire the content information of each cell in the multiple cells;
[0033] A storage unit, configured to store the content information of each cell in sequence using multiple array objects in a multi-dimensional array object.
[0034] In combination with the second aspect, in some embodiments, the apparatus further includes:
[0035] A third acquisition unit, configured to acquire the maximum value in the series direction and the maximum value in the parallel direction in the series-parallel graph;
[0036] The construction unit is specifically configured to construct a rectangle including the series-parallel graph, with the maximum value in the series direction and the maximum value in the parallel direction as the length and width of the rectangle respectively, as a closed graph.
[0037] In combination with the second aspect, in some embodiments, the partitioning unit is specifically configured to:
[0038] Partition the closed graph into m columns, each column including at least one node in parallel;
[0039] Partition the closed graph into n rows, each row including at least one node in series;
[0040] Determine m*n cells obtained by partitioning the closed graph according to the m columns and the n rows.
[0041] In combination with the second aspect, in some embodiments, the second acquisition unit is specifically configured to: sequentially traverse each cell among the multiple cells. If the cell includes a node, acquire the content information of the node; if the cell includes a connection line, acquire the line type identifier of the connection line; if the cell does not include a node and does not include a connection line, the content information in the cell is empty.
[0042] In combination with the second aspect, in some embodiments, the apparatus further includes:
[0043] A fourth acquisition unit, configured to acquire multiple array objects in a multi-dimensional array, where one array object is used to store the content information in one cell, and the array object includes a first attribute name and a second attribute name;
[0044] The storage unit is specifically configured to:
[0045] If the content information in the cell is empty, set the associated storage content of the first attribute name in the corresponding array object to be empty, and set the associated storage content of the second attribute name in the corresponding array object to be empty;
[0046] If the content information in the cell includes the content information of a node, set the associated storage content of the first attribute name in the corresponding array object to be the content information of the node;
[0047] If the content information in the cell includes a connection line type identifier, set the associated storage content of the second attribute name in the corresponding array object to be the line type identifier.
[0048] In combination with the second aspect, in some embodiments, the device further includes:
[0049] A traversal unit, configured to sequentially traverse each array object in the multi-dimensional array when a drawing instruction is detected;
[0050] A drawing unit, configured to perform rendering and drawing according to the stored content in each array object to obtain a drawing result in a cell corresponding to each array object;
[0051] A splicing unit, configured to splice the drawing results in the cells corresponding to each array object in sequence to obtain the series-parallel graph.
[0052] In combination with the second aspect, in some embodiments, the drawing unit is specifically configured to:
[0053] If the associated stored content of the first attribute name in the array object is not empty, input the associated stored content of the first attribute name into a first UI component for drawing rendering to obtain a first drawing rendering result, where the first UI component is configured to generate a node according to node content;
[0054] If the associated stored content of the second attribute name in the array object is not empty, input the associated stored content of the second attribute name into a second UI component for drawing rendering to obtain a second drawing rendering result, where the second UI component is configured to generate a connection line according to a line type identifier;
[0055] Obtain the drawing result in the cell corresponding to the array object according to the first drawing rendering result and / or the second drawing rendering result.
[0056] In a third aspect, the present application provides an information storage device, including a processor, a memory, and a communication interface, where the processor, the memory, and the communication interface are connected to each other. The communication interface is configured to receive and send data, the memory is configured to store program code, and the processor is configured to call the program code to execute the method described in the first aspect and any optional implementation manner in the first aspect.
[0057] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored; when the computer program runs on one or more processors, the terminal device is enabled to execute the method described in the first aspect and any possible implementation manner in the first aspect.
[0058] In the embodiments of the present application, a matrix cell method is used to divide the closed figure formed by the series-parallel graph into cells, and the content information in each cell is obtained and stored in sequence. Such a storage method can orderly obtain the node and connection information in the complex series-parallel graph and store it. The storage method is simple and can realize the storage of the closed-loop structure in the series-parallel flow chart. Brief Description of the Drawings
[0059] To more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below.
[0060] Figure 1 It is a schematic flowchart of an information storage method provided by an embodiment of the present application;
[0061] Figure 2 It is a schematic flowchart of a method for constructing a closed figure provided by an embodiment of the present application;
[0062] Figure 3 It is an example diagram of a series-parallel graph provided by an embodiment of the present application;
[0063] Figure 4 It is an example diagram of a closed figure constructed according to a series-parallel graph provided by an embodiment of the present application;
[0064] Figure 5 It is an example diagram of dividing a closed figure into cells provided by an embodiment of the present application;
[0065] Figure 6 It is an example diagram of the line type of a series-parallel graph provided by an embodiment of the present application;
[0066] Figure 7 It is a schematic flowchart of a method for obtaining a drawing result provided by an embodiment of the present application;
[0067] Figure 8 It is an example diagram of obtaining the drawing result in a cell provided by an embodiment of the present application;
[0068] Figure 9 It is an example diagram of splicing the drawing results to obtain a series-parallel graph provided by an embodiment of the present application;
[0069] Figure 10 It is a schematic diagram of an information storage device provided by an embodiment of the present application. Detailed Embodiments
[0070] The present invention will be further described in detail below with reference to the drawings.
[0071] It should be noted that in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or elements inherent to such a process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including that element. In addition, components, features, and elements with the same name in different embodiments of this application may have the same meaning or different meanings, and their specific meanings need to be determined based on their explanations in the specific embodiments or further in combination with the context in the specific embodiments.
[0072] It should be understood that in this text, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this text indicates that the associated objects before and after are in an "or" relationship.
[0073] It should be understood that in this text, the term "plurality" refers to two or more.
[0074] It should be understood that in this text, the descriptions such as "first", "second", etc. appear only for the purpose of indicating and distinguishing the described objects, without an order, and do not represent a special limitation on the number of devices in the embodiments of this application, and cannot constitute any limitation on the embodiments of this application.
[0075] The embodiments of this application provide an information storage method. To more clearly describe the solution of this application, the following further introduces some drawings related to this application.
[0076] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of an information storage method provided by the embodiments of this application. As Figure 1 shown, the method includes the following steps:
[0077] S101, obtain a series-parallel graph, where the series-parallel graph includes a plurality of nodes and the connections between the plurality of nodes;
[0078] In the embodiments of the present application, there is a closed loop in the series-parallel graph. The series-parallel graph can be a graph with a series-parallel structure such as a series-parallel flowchart. The series-parallel graph includes a series structure and a parallel structure. The connection order of each node in the series-parallel flowchart is used to represent the execution order of the operations indicated by each node and the relationship between the operations indicated by each node. For example, if node 1 and node 2 are in parallel, the operations indicated by node 1 and node 2 can be executed in parallel. Another example is that if node 3 and node 4 are in series, the operations indicated by node 3 and node 4 are in a serial relationship. Please refer to Figure 3 , Figure 3 which is an example diagram of a series-parallel graph provided by the embodiments of the present application. As shown in the figure, each node in block diagram A1 is a schematic diagram of a series structure, that is, nodes 301 - 307 are in series, and each node in block diagram A2 is in a parallel relationship.
[0079] S102. Construct a closed graph including the above series-parallel graph;
[0080] In the embodiments of the present application, the closed graph includes but is not limited to a rectangle, a circle, a triangle, other polygons or irregular polygons, etc. The series-parallel graph is entirely contained in the closed graph. Taking a rectangle as an example for description, the rectangle can be the smallest rectangle containing the series-parallel image. Specifically, optionally, obtain the maximum length value in the series direction and the maximum length value in the parallel direction of the above series-parallel graph, and use the maximum value in the series direction and the maximum value in the parallel direction as the length and width of the rectangle respectively to construct a rectangle including the above series-parallel graph as the closed graph. Among them, the series direction is the direction in which two or more nodes in the series-parallel graph are sequentially connected in series, and the maximum length value in the series direction refers to the maximum length value in the series direction in the above series-parallel graph. For example, the block diagram A1 in Figure 3 is the maximum length value in the series direction. The parallel direction refers to the direction in which two or more nodes in the series-parallel graph are in parallel, and the maximum length value in the parallel direction refers to the maximum length value in the parallel direction in the series-parallel graph. For example, the block diagram A2 in Figure 3 is the maximum length value in the parallel direction.
[0081] Among them, please refer to the flowchart of a method for constructing a closed graph provided by the embodiments of the present application in Figure 2 , and please refer to the example diagram of the closed graph constructed for the example diagram of the series-parallel graph provided in step S101 in Figure 4 .
[0082] S103. Divide the above closed graph into multiple cells according to the target division rule;
[0083] In the embodiments of the present application, the target partitioning rule can be any rule that can partition the above-mentioned closed figure into multiple cells. For example, after partitioning according to the target partitioning rule, the maximum number of nodes in one cell is at most one, and the maximum number of connections in one cell is at most one. In actual situations, the target partitioning rule can be determined according to the circumstances, and the embodiments of the present application do not limit this. Specifically, optionally, partitioning the above-mentioned closed figure into multiple cells according to the above-mentioned target partitioning rule includes: partitioning the above-mentioned closed figure into m columns, each column including at least one node in parallel; partitioning the above-mentioned closed figure into n rows, each row including at least one node in series; and determining m*n cells obtained by partitioning the above-mentioned closed figure according to the above-mentioned m columns and the above-mentioned n rows. When partitioning, the above-mentioned closed figure is partitioned into multiple cells according to the above-mentioned target partitioning rule, where in the above-mentioned target partitioning rule, each column does not include multiple nodes in series, and each row does not include multiple nodes in parallel, that is, there is only one node in each cell.
[0084] Among them, please refer to Figure 5 , Figure 5 which is an example diagram of partitioning cells of a closed figure provided by the embodiments of the present application. For the example diagram of the closed figure as shown in Figure 4 , partitioning cells according to the above-mentioned target partitioning rule is as shown in Figure 5 . Since the maximum number of nodes in one cell is at most one, the maximum values in the series direction and the parallel direction of this closed figure are both 7, and a total of 49 cells are partitioned. As can be seen from Figure 5 , one cell may not contain nodes or connections, such as cell 501 in Figure 5 , or one cell may only contain nodes, such as cell 502 in Figure 5 , or one cell may only include connections, such as cell 503 in Figure 5 , or one cell may contain one node and the connections associated with this node, such as cell 504 in Figure 5 . Among them, the connections associated with a node can refer to the connections connected to this node. Exemplarily, the forms of the connections in each cell can be divided into at least two line types, and the line type of the connection is used to mark the line type of the connection, which is convenient for storage and use. For the example diagram of the line type obtained according to Figure 5 , please refer to Figure 6 .
[0085] S104. Obtain the content information in each of the above-mentioned multiple cells, and sequentially store the content information in each cell using multiple array objects in a multi-dimensional array.
[0086] Specifically, each of the above-mentioned multiple cells is traversed in sequence. If a node is included in the above cell, the content information of the above node is obtained. If a connection line is included in the above cell, the line type identifier of the above connection line is obtained. If neither a node nor a connection line is included in the above cell, the content information in the above cell is empty. For example, as Figure 5 shown, there are no nodes and connection lines in cell 501, so the obtained content information is empty. There is only a node in cell 502, so the obtained content information is the content information of the node. There is only a connection line in cell 503, so the obtained content information is the line type identifier of the connection line. There are a node and a connection line in cell 504, so the obtained content information is the content information of the node and the line type identifier of the connection line.
[0087] Specifically, the content information in each cell is stored in sequence using multiple array objects in a multi-dimensional array, including: obtaining multiple array objects in the multi-dimensional array, where one array object is used to store the content information in one cell, and the above array object includes a first attribute name and a second attribute name; obtaining the content information in each of the above-mentioned multiple cells in sequence; if the content information in the above cell is empty, the associated stored content of the above first attribute name in the corresponding array object is set to be empty, and the associated stored content of the above second attribute name in the corresponding array object is set to be empty; if the content information in the above cell includes the content information of a node, the associated stored content of the above first attribute name in the corresponding array object is set to the content information of the node; if the content information in the above cell includes a connection line type identifier, the associated stored content of the above second attribute name in the corresponding array object is set to the above line type identifier. Optionally, the storage order can be from left to right in units of rows. The dimension of the multi-dimensional array can be the number of rows of the matrix. The above line type identifier can be obtained by identifying several line types after dividing a closed graph into cells, or by calling a line type identifier pre-stored in a database.
[0088] Optionally, if it is necessary to add or delete nodes in the flowchart, only the content of the node and the line types of the array objects corresponding to the surrounding cells in the array object corresponding to the multi-dimensional array of the stored flowchart need to be modified. Among them, if the above cells do not include nodes, the content pointed to by the first attribute name of the array object used to store the content information in the above cells is empty. If the above cells do not include connection lines, the content pointed to by the second attribute name of the array object used to store the content information in the above cells is empty. For example, {line: '1', node: {title: '301'}} can be understood as an array object. In this array object, the attribute name line is the line type, that is, the above second attribute name, the attribute name node is the node, that is, the above first attribute name, and title: '301' is the specific content of the node. Then {line: '1', node: {}} means that the cell includes a connection line but does not include a node, {line: '', node: {title: '301'}} means that the cell includes a node but does not include a connection line, {line: '1', node: {title: '301'}} means that the cell includes both a node and a connection line, and {line: '', node: {}} means that the cell does not include a node and a connection line.
[0089] Exemplarily, according to Figure 6 the line types of the series-parallel graphs shown are stored for the content of each cell in the enclosed graph after dividing the cells using a multi-dimensional array. The dimension of this multi-dimensional array is the same as the number of rows of the matrix, which is 7. The storage result is as follows: Figure 5
[0092] {line: '1', node: {title: '301'}},
[0093] {line: '2', node: {title: '302'}},
[0094] {line: '2', node: {title: '303'}},
[0095] {line: '1', node: {title: '304'}},
[0096] {line: '2', node: {title: '305'}},
[0097] {line: '1', node: {title: '306'}},
[0098] {line: '', node: {title: '307'}}
[0099] ,
[0101] {line: '3', node: {}},
[0102] {line: '', node: {title: '308'}},
[0103] {line: '', node: {}},
[0104] {line: '3', node: {title: '309'}},
[0105] {line: '', node: {}},
[0106] {line: '3', node: {}},
[0107] {line: '', node: {}}
[0108] ,
[0110] {line: '3', node:{}},
[0111] {line: '', node: {}},
[0112] {line: '', node: {}},
[0113] {line: '3', node: {title: '310'}},
[0114] {line: '', node: {}},
[0115] {line: '3', node: {}},
[0116] {line: '', node: {}}
[0117] ,
[0119] {line: '4', node: {}},
[0120] {line: '1', node: {title: '311'}},
[0121] {line: '2', node: {title: '312'}},
[0122] {line: '6', node: {title: '313'}},
[0123] {line: '', node: {}},
[0124] {line: '3', node: {}},
[0125] {line: '', node: {}}
[0126] ,
[0128] {line: '3', node: {}},
[0129] {line: '5', node: {}},
[0130] {line: '2', node: {title: '314'}},
[0131] {line: '7', node: {title: '315'}},
[0132] {line: '', node: {}},
[0133] {line: '3', node: {}},
[0134] {line: '', node: {}}
[0135] ,
[0137] {line: '3', node: {}},
[0138] {line: '', node: {}},
[0139] {line: '', node: {}},
[0140] {line: '', node: {title: '316'}},
[0141] {line: '', node: {}},
[0142] {line: '3', node: {}},
[0143] {line: '', node: {}}
[0144] ,
[0146] {line: '5', node: {}}
[0147] {line: '8', node: {title: '317'}}
[0148] {line: '9', node: {}}
[0149] {line: '9', node: {}}
[0150] {line: '9', node: {}}
[0151] {line: '10', node: {}}
[0152] {line: '', node: {}}
[0155] Please refer to Figure 2 , Figure 2 , which is a schematic flow chart of a method for constructing a closed figure provided by an embodiment of the present application. The method includes but is not limited to the following steps:
[0156] S201. Obtain the maximum value in the series direction and the maximum value in the parallel direction in the above series - parallel figure;
[0157] Exemplarily, please refer to Figure 3 , Figure 3 , which is an example diagram of a series - parallel figure provided by an embodiment of the present application. For easy understanding, 301 - 317 represent each node of the series - parallel figure, and the content information of each node is set as the label of the node. For example, the content information of the node with node label 301 is 301. The series direction of the series - parallel figure is the horizontal direction framed by frame A1 in the figure, and the parallel direction of the series - parallel figure is the vertical direction framed by frame A2 in the figure. Then, the maximum value in the series direction of the series - parallel figure is the maximum value of the number of nodes in the series direction, which is 7, and the maximum value in the parallel direction of the series - parallel figure is the maximum value of the number of nodes in the parallel direction, which is 7.
[0158] S202. Respectively use the maximum value in the series direction and the maximum value in the parallel direction as the length and width of a rectangle to construct a matrix including the above series - parallel figure as a closed figure.
[0159] Exemplarily, according to the maximum value in the series direction and the maximum value in the parallel direction of the series - parallel figure shown in step S201 Figure 3 , construct a matrix including the above series - parallel figure. The length and width of the matrix are 7. Please refer to Figure 4 , Figure 4 , which is an example diagram of a closed figure constructed according to a series - parallel figure provided by an embodiment of the present application, whereFigure 4 Among them, A3 is a closed figure formed by constructing a matrix including the series-parallel figures shown above. Figure 3 Please refer to
[0160] For example, Figure 6 , Figure 6 FIG. is an example diagram of the line types of a series-parallel figure provided by an embodiment of the present application. According to Figure 5 the example diagram of dividing the closed figure into cells shown, the connections therein can be divided into Figure 6 the 10 line types shown. It should be noted that Figure 6 the line types shown are only exemplified for the above-mentioned closed figure, and in actual situations, the line types of the connections can be determined according to the circumstances, and the embodiments of the present application do not limit this. As Figure 6 shown, for ease of understanding, the identifier of each line type is set as the number in the upper left corner. It can be understood that the connection of line type 1 is the connection connected to node 301, node 304, and node 311 in Figure 5 , the connection of line type 2 is the connection connected to node 302, node 303, node 305, node 306, node 312, and node 314 in Figure 5 , the connection of line type 3 is the connection with the same connection in cell 503 in Figure 5 , the connection of line type 4 is the connection connected to node 311, the connection of line type 5 is the connection connected to node 314, the connection of line type 6 is the connection connected to node 313, the connection of line type 7 is the connection connected to node 316, the connection of line type 8 is the connection connected to node 317, the connection of line type 9 is the connection with the same connection in cell 505 in Figure 5 , and the connection of line type 10 is the connection with the same connection in cell 506 in Figure 5 .
[0161] Please refer to Figure 7 , Figure 7 which is a schematic flowchart of a process for obtaining a drawing result provided by an embodiment of the present application. The method includes but is not limited to the following steps:
[0162] S701, when a drawing instruction is detected, sequentially traverse each array object in the above-mentioned multi-dimensional array, and perform rendering and drawing according to the content stored in each array object to obtain the drawing result in the cell corresponding to each array object;
[0163] Optionally, the drawing instruction may include traversing each array object of a multi-dimensional array, which may be a multi-dimensional array stored in a database, or a multi-dimensional array obtained by modifying the node content or line type identifier of the array objects in the multi-dimensional array, or a newly created multi-dimensional array with its node content and line type identifier configured. Specifically, if the associated stored content of the first attribute name in the above array object is not empty, the associated stored content of the first attribute name is input into the first UI component for drawing rendering to obtain a first drawing rendering result, and the first UI component is used to generate nodes according to the node content; if the associated stored content of the second attribute name in the above array object is not empty, the associated stored content of the second attribute name is input into the second UI component for drawing rendering to obtain a second drawing rendering result, and the second UI component is used to generate connection lines according to the line type identifier; according to the above first drawing rendering result and / or second drawing rendering result, the drawing result in the cell corresponding to the above array object is obtained.
[0164] Exemplarily, after successively traversing each array object of the multi-dimensional array, the obtained array is as follows:
[0167] {line: '1', node: {title: '901'}},
[0168] {line: '', node: { title: '902'}},
[0169] {line: '', node: {}}
[0170] ,
[0172] {line: '5', node: {}},
[0173] {line: '1', node: {title: '903'}},
[0174] {line: '', node: { title: '904'}}
[0175] ,
[0177] {line: '', node: {}},
[0178] {line: '5', node: {}},
[0179] {line: '', node: { title: '905'}}
[0182] According to the traversal result, it can be known that the cells of the closed figure are 3 rows and 3 columns. Based on the stored content of the array object, the node information and the line type identifier of the connection line in the corresponding cell are obtained, and the drawing result in the cell corresponding to each array object is obtained as Figure 8 shown.
[0183] S702, splice the drawing results in the cells corresponding to the above array objects in sequence to obtain a series-parallel graph.
[0184] Exemplarily, splice the drawing results in the cells corresponding to each array object in the above Figure 8 in sequence, and this sequence is the same as the sequence when the multi-dimensional array stores cell information. Please refer to Figure 9 , Figure 9 For splicing Figure 8 the drawing results shown to obtain an example diagram of a series-parallel graph.
[0185] Please refer to Figure 10 , which is a schematic structural diagram of an information storage device provided by an embodiment of the present application. As Figure 10 shown, the information storage device 1000 may include:
[0186] A first acquisition unit 1001, configured to acquire a series-parallel graph, where the series-parallel graph includes a plurality of nodes and connections between the plurality of nodes;
[0187] A construction unit 1002, configured to construct a closed figure including the series-parallel graph;
[0188] A division unit 1003, configured to divide the closed figure into a plurality of cells according to a target division rule;
[0189] A second acquisition unit 1004, configured to acquire the content information in each of the plurality of cells;
[0190] A storage unit 1005, configured to sequentially store the content information in each cell by using a plurality of array objects in a multi-dimensional array object.
[0191] In a possible design, the device further includes:
[0192] A third acquisition unit 1006, configured to acquire the maximum value in the series direction and the maximum value in the parallel direction in the series-parallel graph;
[0193] The construction unit 1002 is specifically configured to use the maximum value in the series direction and the maximum value in the parallel direction as the length and width of a rectangle respectively, and construct a rectangle including the series-parallel graph as a closed figure.
[0194] In a possible design, the partitioning unit 1003 is specifically configured to:
[0195] Partition the above-mentioned closed figure into m columns, with each column including at least one node connected in parallel;
[0196] Partition the above-mentioned closed figure into n rows, with each row including at least one node connected in series;
[0197] Determine m * n cells obtained by partitioning the above-mentioned closed figure according to the above m columns and the above n rows.
[0198] In a possible design, the second acquisition unit 1004 is specifically configured to:
[0199] Traverse each of the above-mentioned multiple cells in sequence. If the above cell includes a node, obtain the content information of the above node;
[0200] If the above cell includes a connection line, obtain the line type identifier of the above connection line; if the above cell does not include a node and does not include a connection line, the content information in the above cell is empty.
[0201] In a possible design, the device further includes:
[0202] A fourth acquisition unit 1010, configured to acquire multiple array objects in a multi-dimensional array. One array object is used to store the content information of a cell, and the above array object includes a first attribute name and a second attribute name;
[0203] The storage unit 1005 is specifically configured to:
[0204] If the content information in the above cell is empty, set the associated stored content of the above first attribute name in the corresponding array object to be empty, and set the associated stored content of the above second attribute name in the above corresponding array object to be empty;
[0205] If the content information in the above cell includes the content information of a node, set the associated stored content of the above first attribute name in the corresponding array object to be the content information of the above node;
[0206] If the content information in the above cell includes a connection line type identifier, set the associated stored content of the above second attribute name in the corresponding array object to be the above line type identifier.
[0207] In a possible design, the device further includes:
[0208] A traversal unit 1007, configured to sequentially traverse each array object in the above multi-dimensional array when a drawing instruction is detected;
[0209] A drawing unit 1008 is configured to perform rendering and drawing based on the stored content in each of the above array objects, and obtain drawing results in the cells corresponding to each of the above array objects;
[0210] A splicing unit 1009 is configured to splice the drawing results in the cells corresponding to each of the above array objects in sequence to obtain the above series-parallel graph.
[0211] In a possible design, the drawing unit 1008 is specifically configured to:
[0212] If the associated stored content of the first attribute name in the above array object is not empty, input the associated stored content of the first attribute name into the first UI component for drawing rendering to obtain a first drawing rendering result, where the first UI component is configured to generate nodes according to node content;
[0213] If the associated stored content of the second attribute name in the above array object is not empty, input the associated stored content of the second attribute name into the second UI component for drawing rendering to obtain a second drawing rendering result, where the second UI component is configured to generate connection lines according to line type identifiers;
[0214] Obtain the drawing result in the cell corresponding to the above array object according to the above first drawing rendering result and / or second drawing rendering result.
[0215] Wherein, Figure 10 For the specific description of the device embodiments shown, reference may be made to the foregoing Figure 1 , Figure 2 or Figure 7 For the specific description of the method embodiments shown, details are not described herein again.
[0216] The embodiments of the present application further provide a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor to perform the method steps of the embodiments as shown in the above Figure 1 , Figure 2 or Figure 7 For the specific execution process, reference may be made to the specific description of the embodiments shown in Figure 1 , Figure 2 or Figure 7 Details are not described herein again.
[0217] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive), etc.
[0218] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware with a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The foregoing storage medium includes: various media that can store program codes such as ROM or random access memory RAM, magnetic disks, or optical discs.
Claims
1. An information storage method, characterized in that, Including: Obtain a series-parallel graph, where the series-parallel graph includes multiple nodes and connections between the multiple nodes; Construct a closed graph including the series-parallel graph; According to a target partitioning rule, divide the closed graph into multiple cells, where the maximum number of nodes in one cell is one, and the maximum number of connections in one cell is one; Traverse each of the multiple cells, and obtain the content information in each cell. If the cell only includes a node, the content information in the cell includes the content information of the node. If the cell only includes a connection, the content information in the cell includes the line type identifier of the connection. If the cell includes a node and a connection, the content information in the cell includes the line type identifier of the connection and the content information of the node. If the cell does not include a node and a connection, the content information in the cell is empty; Obtain multiple array objects in a multi-dimensional array, where one array object is used to store the content information in one cell, and the array object includes a first attribute name and a second attribute name, and the storage order is row-by-row from left to right; If the content information in the cell is empty, set the associated stored content of the first attribute name in the corresponding array object to be empty, and set the associated stored content of the second attribute name in the corresponding array object to be empty; If the content information in the cell includes the content information of a node, set the associated stored content of the first attribute name in the corresponding array object to be the content information of the node; If the content information in the cell includes a line type identifier, set the associated stored content of the second attribute name in the corresponding array object to be the line type identifier.
2. The method according to claim 1, characterized in that, The constructing a closed graph including the series-parallel graph includes: Obtain the maximum value in the series direction and the maximum value in the parallel direction in the series-parallel graph; Respectively use the maximum value in the series direction and the maximum value in the parallel direction as the length and width of a rectangle, and construct a rectangle including the series-parallel graph as the closed graph.
3. The method according to claim 2, characterized in that, The dividing the closed graph into multiple cells according to the target partitioning rule includes: Divide the closed graph into m columns, and each column includes at least one node in parallel; Divide the closed graph into n rows, and each row includes at least one node in series; Determine m*n cells obtained by dividing the closed graph according to the m columns and the n rows.
4. The method according to any one of claims 1 - 3, characterized in that, The method further includes: if the cell does not include a node and does not include a connection, the content information in the cell is empty.
5. The method according to claim 4, characterized in that, The method further includes: When a drawing instruction is detected, sequentially traverse each array object in the multi-dimensional array, perform rendering and drawing according to the stored content in each array object, and obtain the drawing result in the cell corresponding to each array object; Splice the drawing results in the cells corresponding to each array object in order to obtain the series-parallel graph.
6. The method according to claim 5, characterized in that, The performing rendering and drawing according to the stored content in each array object to obtain the drawing result in the cell corresponding to each array object includes: If the associated stored content of the first attribute name in the array object is not empty, the stored content pointed to by the first attribute name is input into the first UI component for drawing and rendering to obtain a first drawing and rendering result, and the first UI component is used to generate nodes according to node content; If the associated stored content of the second attribute name in the array object is not empty, the stored content pointed to by the second attribute name is input into the second UI component for drawing and rendering to obtain a second drawing and rendering result, and the second UI component is used to generate connection lines according to line type identifiers; According to the first drawing and rendering result and / or the second drawing and rendering result, the drawing result in the cell corresponding to the array object is obtained.
7. An information storage device, characterized in that, The device includes units for executing the method according to any one of claims 1-6, and the device includes: A first acquisition unit for acquiring a series-parallel graph, the series-parallel graph including a plurality of nodes and connection lines between the plurality of nodes; A construction unit for constructing a closed graph including the series-parallel graph; A division unit for dividing the closed graph into a plurality of cells according to a target division rule; A second acquisition unit for acquiring content information in each of the plurality of cells; A storage unit for sequentially storing the content information in each cell by using a plurality of array objects in a multi-dimensional array object.
8. An information storage device, characterized in that, Including a processor, a memory, and a communication interface, the processor, the memory, and the communication interface are connected to each other, wherein the communication interface is used for receiving and sending data, the memory is used for storing program code, and the processor is used for calling the program code to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program; when the computer program runs on one or more processors, the method according to any one of claims 1-6 is executed.
Citation Information
Patent Citations
Method and device for constructing data structure chart, and display method of data structure chart
CN107562702A