Automatic page layout and rule mining method and device based on multiple constraint conditions and medium

By using depth-first frequent subgraph mining and BERT model-based graph semantic analysis, the data visualization page layout is automatically generated, solving the problems of low efficiency and misjudgment in existing graph layout technologies, and achieving efficient and reasonable graph arrangement.

CN121637084APending Publication Date: 2026-03-1010TH RES INST OF CETC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-18
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing technologies lack automated support for semantic understanding of charts and domain-specific layout rules in data visualization scenarios, resulting in low layout efficiency and a high risk of misjudgment. In particular, when multiple charts are linked together, it is difficult to balance response speed and information relevance.

Method used

We employ a depth-first frequent subgraph mining algorithm and the BERT model, combined with similarity calculation and rule matching, to automatically identify semantic associations in graphs and generate reasonable layouts. We discover potential layout rules through frequent subgraph mining and use comprehensive similarity to assign IDs and optimize grid layout.

Benefits of technology

It improved the response speed and layout rationality of the data management system, reduced the workload of manual adjustments, and generated a more reasonable and aesthetically pleasing page layout.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121637084A_ABST
    Figure CN121637084A_ABST
Patent Text Reader

Abstract

The invention provides a page automatic layout and rule mining method and device based on multiple constraint conditions and a medium. The method comprises the steps that template rule mining is conducted on template data through a frequent subgraph mining algorithm based on depth first; calculating the similarity between the input chart and the template chart to obtain the comprehensive similarity between the input chart and the template chart; distributing an ID for the input chart according to the comprehensive similarity; checking whether the ID in the template rule is in the ID set of the input chart or not, and if yes, considering that the rule is successfully matched; arranging elements in a grid according to the number of the input elements and the size of the grid; calculating the effective size of the grid, and adjusting the grid; performing full arrangement on the input chart, and calculating a similarity score between each arrangement and the template; and selecting the most suitable template according to the score, and obtaining the position and size information of the chart in the template. According to the method, the reasonable page layout can be automatically generated according to the input chart information, and the layout efficiency and quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information visualization technology, and more specifically, to a method, device, and medium for automatic page layout and rule mining based on multiple constraints. Background Technology

[0002] In data processing, the visualization of data directly impacts daily work efficiency. Charts such as line charts, pie charts, and bar charts generated from daily work data need to be integrated into the information system's display interface in real time to provide users with intuitive data presentation. However, most chart layouts currently rely on manual drag-and-drop adjustments: when dealing with interconnected data across multiple charts (such as collaborative sales data between the eastern and southern regions), the relationships between charts must be manually set (e.g., adjacent regional charts side-by-side), which not only results in slow response times but also increases the risk of misinterpretations due to operational errors.

[0003] Existing automated layout technologies have significant limitations in real-world scenarios: First, they lack semantic understanding of hierarchical relationships and data types (e.g., charts of core flagship products and trial new products do not need to be mixed); second, they cannot adapt to layout rules specific to certain domains (e.g., in the sales domain, charts are arranged vertically by sales channels, and high-priority data charts occupy the visual center); and third, when the number of charts surges (e.g., multiple regions simultaneously report data on emergencies), manual adjustments struggle to balance layout efficiency and information relevance, potentially delaying optimal decision-making opportunities.

[0004] Therefore, developing a page layout algorithm that can automatically identify semantic relationships in charts and adapt to operational command rules for data visualization scenarios is of great application value for improving the response speed of data management systems and ensuring the rationality of layout. Summary of the Invention

[0005] The present invention aims to solve at least one of the aforementioned technical problems existing in the prior art.

[0006] Therefore, the first aspect of the present invention provides a method for automatic page layout and rule mining based on multiple constraints.

[0007] A second aspect of the present invention provides a computer device.

[0008] A third aspect of the present invention provides a computer-readable storage medium.

[0009] This invention provides a method for automatic page layout and rule mining based on multiple constraints, including: Create a database to store template data, which includes chart information and rule information; Template data is read from the database, and template rules are mined from the template data using a depth-first frequent subgraph mining algorithm. Calculate the similarity between the input chart and the template chart, including title similarity and chart type similarity; combine the title similarity and chart type similarity to obtain the overall similarity between the input chart and the template chart; The input chart is assigned an ID based on the overall similarity. If the similarity exceeds the threshold, the ID of the template chart is used; otherwise, a new ID is assigned. The IDs in the template rules are checked to see if they are all in the set of IDs of the input chart. If they are, the rule is considered to be a successful match. Based on the input number of elements and grid size, arrange the elements in the grid to maximize the number of elements that satisfy the given constraints. The constraints include left-right adjacency and top-bottom adjacency. Calculate the effective size of the grid, which is the minimum rectangular area occupied by all non-zero elements, and adjust the grid accordingly. Perform full permutations of the input chart and calculate the similarity score between each permutation and the template; select the most suitable template based on the score and obtain the position and size information of the chart in the template.

[0010] The automatic page layout and rule mining method based on multiple constraints according to the above-described technical solution of the present invention may also have the following additional technical features: In the above technical solution, the chart information in the template data includes the chart's ID, title, and type; The rule information in the template data includes the rule ID, the relevant chart ID, the adjacency relationship ID, the rule support, and the specific rule content.

[0011] In the above technical solution, the step of reading template data from the database and performing template rule mining on the template data using a depth-first frequent subgraph mining algorithm includes: The read template data is preprocessed to convert each template into a graph structure. Each vertex represents a single chart, and its attributes include the chart's ID, title, and type. A unique ID is assigned to each chart. The edges represent the spatial adjacency between charts. The edge attributes are determined by calculating the chart's position and size: when two charts are horizontally adjacent, the edge attribute is marked as 1; when two charts are vertically adjacent, the edge attribute is marked as 2; if they are not adjacent, there is no corresponding edge. The gSpan algorithm is used to perform a depth-first search on the constructed graph structure set to find subgraph structures that appear more than a set value and define them as frequent subgraphs. The mined frequent subgraphs are converted into template rules; each frequent subgraph contains several vertices and edges, and the corresponding rule content is that graph A and graph B have a left-right or top-bottom adjacent relationship, and the support of the rule is recorded, that is, the number of templates containing the frequent subgraph; the extracted template rules are stored in the database.

[0012] In the above technical solution, the method for calculating the title similarity includes: The pre-trained BERT model is used to vectorize the input chart title and the template chart title, resulting in the input chart title vector vec_bert(title_input) and the template chart title vector vec_bert(title_template). Calculate the cosine similarity between the input chart title vector and the template chart title vector, as the title similarity, including: S_title=cos(vec_bert(title_input),vec_bert(title_template)) Where S_title represents the title similarity; The method for calculating the similarity of the chart types includes: The similarity between the input chart type and the template chart type is calculated based on a preset similarity matrix.

[0013] In the above technical solution, the method for calculating the comprehensive similarity includes: S = alpha * S_title + beta * S_type Where S represents the total amount and similarity; alpha represents the title similarity weight; S_title represents the title similarity; beta represents the template chart type similarity weight; and S_type represents the template chart type similarity.

[0014] In the above technical solution, the step of assigning an ID to the input chart based on comprehensive similarity, and using the template chart's ID if the similarity exceeds a threshold, otherwise assigning a new ID; and checking whether all IDs in the template rules are in the input chart's ID set, and if so, considering the rule a successful match, includes: The input chart is assigned an ID based on the overall similarity score; if the overall similarity score is greater than the similarity threshold, the input chart is mapped to the template chart ID; otherwise, a new ID is assigned. Check if all the IDs in the template rule are in the ID set of the input chart. If so, the rule is considered to be a successful match. For rules that match successfully, extract the set of chart IDs and the relation dictionary; The rules are sorted by priority; the number of charts has a higher priority than the support score, and the support score has a higher priority than the original order of the rules. Rule conflicts are resolved by prioritizing the results of rule ordering, and rules with higher priority are retained in the case of rule conflicts.

[0015] In the above technical solution, the step of arranging elements in the grid according to the input number of elements and grid size to maximize the number of elements satisfying given constraints; the constraints include left-right adjacency and top-bottom adjacency; calculating the effective size of the grid, i.e., the minimum rectangular area occupied by all non-zero elements, and adjusting the grid includes: Initialize a random layout based on the number of input elements and the preset grid size; The optimal layout is found by randomly selecting two elements and swapping their positions. The score of the new layout after each element swap is evaluated based on the number of given constraints satisfied and the effective size of the grid. If the new layout has a higher score and a smaller effective grid size, it is considered the better layout. The search process is repeated until the optimal layout is found. Calculate the effective size of the mesh and adjust the mesh accordingly.

[0016] In the above technical solution, the step of performing a full permutation of the input chart, calculating the similarity score between each permutation and the template, selecting the most suitable template based on the score, and obtaining the position and size information of the chart in the template includes: Perform all permutations on the input chart to generate all possible combinations; Calculate the similarity score between each permutation and combination and the template; The most suitable template is selected based on the similarity score, and the position and size information of the chart in the template are obtained. The input chart is then displayed according to the layout of the most suitable template.

[0017] The present invention provides a computer device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is loaded and executed by the processor, it implements the automatic page layout and rule mining method based on multiple constraints as described in any of the above technical solutions.

[0018] The present invention provides a computer-readable storage medium storing a program that, when loaded by a processor, implements the automatic page layout and rule mining method based on multiple constraints as described in any of the above technical solutions.

[0019] In summary, due to the adoption of the above-mentioned technical features, the beneficial effects of the present invention are: This invention provides an automatic page layout method based on similarity matching and rule constraints. This method can automatically generate a reasonable page layout based on input chart information, improving layout efficiency and quality. Specifically, this invention reduces the workload of manual layout adjustments through an automatic layout algorithm, significantly improving page layout efficiency. By considering constraints and similarity information between charts, it can generate more reasonable and aesthetically pleasing layout schemes. Frequent subgraph mining technology is used to discover potential layout rules, providing a reference for subsequent layouts.

[0020] Additional aspects and advantages of the invention will become apparent in the following description or may be learned by practice of the invention. Attached Figure Description

[0021] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart of an embodiment of the automatic page layout and rule mining method based on multiple constraints according to the present invention; Figure 2 This is a flowchart of the rule mining process in an embodiment of the automatic page layout and rule mining method based on multiple constraints of the present invention. Detailed Implementation

[0022] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0023] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0024] The following reference Figure 1 and Figure 2 This describes a method for automatic page layout and rule mining based on multiple constraints, provided by some embodiments of the present invention.

[0025] Some embodiments of this application provide a method for automatic page layout and rule mining based on multiple constraints.

[0026] like Figure 1 As shown, the first embodiment of the present invention proposes an automatic page layout and rule mining method based on multiple constraints, including six steps: database preparation, rule mining, similarity calculation, rule matching, layout arrangement and template matching, which correspond to the following steps S1-S6 respectively.

[0027] S1. Create a database to store template data, which includes chart information and rule information.

[0028] In some embodiments, the chart information in the template data includes the chart's ID, title, type, and location; the rule information in the template data includes the rule's ID, the chart ID involved, the adjacency relationship ID, the rule's support degree, and the specific rule content.

[0029] Specifically, the chart information records the chart's ID, title, and type (line chart, bar chart, etc.) (e.g., <Chart ID: 1, Title: Sales in the Eastern Market in the First Half of the Year, Chart Type: Line Chart>). The rule information records the rule's ID, the chart IDs involved, the adjacent relationship IDs, the rule's support, and the specific rule content (e.g., if <Chart ID: 1, Title: Sales in the Eastern Market in the First Half of the Year, Chart Type: Line Chart> and <Chart ID: 2, Title: Sales in the Southern Market in November, Chart Type: Bar Chart> are adjacent to each other, the recorded rule information would be in the form of: <Chart ID: 1, Chart ID: 2, Adjacency Relationship: 1, Support: 3>).

[0030] Data reading: S2. Read template data from the database and perform template rule mining on the template data using a depth-first frequent subgraph mining algorithm.

[0031] In some embodiments, when reading template data, a database connection tool can be used to read the template data from the database. For example, the visible_template_info table can be queried using SQL statements to obtain chart information, and the visible_template_rule table can be queried to obtain rule information.

[0032] In some embodiments, such as Figure 2 As shown, step S2 includes: S21. Convert the template data into a graph structure. Preprocess the read template data to convert each template into a graph structure. Each vertex represents a single chart, and its attributes include the chart's ID, title, and type (e.g., line chart, bar chart). The `process_dataset` function assigns a unique ID to each chart (if the combined similarity of the new chart's title and type with an existing template chart exceeds a threshold of 0.95, the existing ID is reused; otherwise, a new ID is assigned). The edges of the graph represent the spatial adjacency between charts. The edge attributes are determined by calculating the chart's position and size: when two charts are horizontally adjacent (left-right arrangement with vertical overlap and a spacing not exceeding a threshold, e.g., 10), the edge attribute is marked as 1; when two charts are vertically adjacent (up-down arrangement with horizontal overlap and a spacing not exceeding a threshold, e.g., 10), the edge attribute is marked as 2; if they are not adjacent, there is no corresponding edge. S22. Frequent subgraph mining: The gSpan algorithm is used to perform a depth-first search on the constructed graph structure set to mine subgraph structures that appear more than a set value, and these are defined as frequent subgraphs.

[0033] Specifically, a minimum support is set (e.g., 3), meaning only subgraphs appearing in at least three template graphs are retained as frequent subgraphs. The gSpan algorithm explores all possible substructures of the graph using a depth-first search approach, uniquely identifies the graph using DFS encoding to avoid duplicate mining, and improves efficiency through pruning strategies, ultimately obtaining a set of frequent subgraphs that meet the support requirement. The gSpan algorithm is a well-known algorithm for frequent subgraph mining and will not be elaborated upon here.

[0034] S23. Rule Extraction and Storage: The mined frequent subgraphs are converted into template rules. Each frequent subgraph contains several vertices (chart IDs) and edges (adjacency relationships). The corresponding rule content is "Chart A and Chart B have an X-adjacency relationship" (where X is 1 for left-right adjacency and 2 for top-bottom adjacency). The support of this rule (i.e., the number of templates containing this subgraph) is recorded. For example, if a frequent subgraph contains vertex 5 (title "November Sales Chart of Eastern Market"), vertex 7 (title "November Sales Chart of Southern Market"), and an edge with attribute 1, the extracted rule is: <Chart ID: 5, Chart ID: 7, Adjacency Relationship: 1, Support: 3>. This rule means: <Chart: November Sales Chart of Eastern Market, Chart: November Sales Chart of Southern Market, Adjacency Relationship: Left-Right Adjacency, Support: 3>. The extracted rules are finally stored in the visible_template_rule table (rule information table) in the database for subsequent matching.

[0035] S3. Calculate the similarity between the input chart and the template chart, including title similarity and chart type similarity; combine title similarity and chart type similarity to obtain the overall similarity between the input chart and the template chart.

[0036] In one specific embodiment, suppose there is an input chart list input_new, which contains information about each chart, such as [{'title':'Line chart of sales in the western market in November 2024','type':'Line chart'},{'title':'Bar chart of total weekly sales in the northern market in November','type':'Bar chart'}].

[0037] The method for calculating title similarity is as follows: The input chart title and template chart title are vectorized using a pre-trained BERT model. For example, for the input chart title "Sales in the Western Market in November 2024" and the template chart title "Sales in the Southern Market in November", the vectors vec_bert(title_input) and vec_bert(title_template) are obtained respectively.

[0038] Calculate the cosine similarity between the two: S_title=cos(vec_bert(title_input),vec_bert(title_template)).

[0039] The method for calculating type similarity is as follows: The similarity between the input chart type and the template chart type is calculated based on the preset similarity matrix TYPE_SIMILARITY. For example, if the input chart is a line chart and the template chart is a bar chart, the similarity is 0.4 according to the matrix. The preset similarity matrix can be flexibly configured according to actual needs.

[0040] In some embodiments, the method for calculating the comprehensive similarity includes: S = alpha * S_title + beta * S_type Where S represents the total amount and similarity; alpha represents the title similarity weight; S_title represents the title similarity; beta represents the template chart type similarity weight; and S_type represents the template chart type similarity.

[0041] In one specific embodiment, alpha=0.7, beta=0.3.

[0042] S4. Assign an ID to the input chart based on the overall similarity. If the similarity exceeds the threshold, use the ID of the template chart; otherwise, assign a new ID. Check if all the IDs in the template rules are in the set of IDs of the input chart. If so, the rule is considered to be a successful match.

[0043] In some embodiments, step S4 includes: The input chart is assigned an ID based on the overall similarity score; if the overall similarity score is greater than the similarity threshold, the input chart is mapped to the template chart ID; otherwise, a new ID is assigned. Check if all the IDs in the template rule are in the ID set of the input chart. If so, the rule is considered to be a successful match. For rules that match successfully, extract the set of chart IDs and the relation dictionary; The rules are sorted by priority; the number of charts has a higher priority than the support score, and the support score has a higher priority than the original order of the rules. Rule conflicts are resolved by prioritizing the results of rule ordering, and rules with higher priority are retained in the case of rule conflicts.

[0044] Specifically, step S4 can be divided into three main parts: ID allocation, rule matching, and rule conflict resolution.

[0045] ID Assignment: Input charts are assigned IDs based on overall similarity. A similarity threshold θ = 0.95 is set. When the overall similarity S ≥ θ, the input chart is mapped to the template chart ID; otherwise, a new ID is assigned. For example, if the input "Line Chart of Sales in the Western Market in November 2024" has an overall similarity greater than 0.95 with the template chart "Sales in the Southern Market in November", the template chart ID is used; if the similarity is less than 0.95, a new ID is assigned.

[0046] Rule Matching: Check if all the IDs in the template rule are in the ID set of the input chart. If so, the rule is considered a successful match. For example, if the template rule is "the chart with ID 5 is adjacent to the chart with ID 7 on the left and right", and the ID set of the input charts contains both 5 and 7, then the rule is a successful match.

[0047] Rule conflict resolution: For rules that match successfully, extract the chart ID set and the relation dictionary. For example, if the rule is "the chart with ID 5 is adjacent to the chart with ID 7 on the left and right", then the chart ID set is {5,7}, and the relation dictionary is {(5,7):1} (1 indicates that the charts are adjacent on the left and right).

[0048] The priority sorting rules are as follows (number of charts in descending order > support in descending order > original order in ascending order). For example, if there are two rules, rule A involves 3 charts and has a support of 5; rule B involves 2 charts and has a support of 6. In this case, rule A has a higher priority.

[0049] Perform conflict detection and filtering to exclude conflicting rules. For example, if rule A stipulates that charts with IDs 1 and 2 are adjacent horizontally, and rule B stipulates that charts with IDs 1 and 2 are adjacent vertically, then one of the rules will be retained based on priority.

[0050] S5. Based on the input number of elements and grid size, arrange the elements in the grid to maximize the number of elements that satisfy the given constraints. The constraints include left-right adjacency and top-bottom adjacency. Calculate the effective size of the grid, which is the minimum rectangular area occupied by all non-zero elements, and adjust the grid accordingly.

[0051] In some embodiments, step S5 includes: Initialize a random layout based on the number of input elements and the preset grid size; The optimal layout is found by randomly selecting two elements and swapping their positions. The score of the new layout after each element swap is evaluated based on the number of given constraints satisfied and the effective size of the grid. If the new layout has a higher score and a smaller effective grid size, it is considered the better layout. The search process is repeated until the optimal layout is found. Calculate the effective size of the mesh and adjust the mesh accordingly.

[0052] In other words, step S5 is divided into three parts: mesh initialization, local search (multiple iterations), and mesh adjustment.

[0053] Grid initialization: Based on the number of input elements and the preset grid size (e.g., m=3, n=4), a random layout is initialized. For example, if the input contains 3 charts, their positions are randomly assigned within a 3x4 grid.

[0054] Local search: Randomly select two elements and swap their positions, then evaluate the score of the new layout. The score evaluation considers two factors: the number of elements that satisfy the given constraints and the effective size of the grid (the smallest rectangular area occupied by all non-zero elements). If the new layout has a higher score and a smaller effective grid size, then the optimal layout is updated. For example, after swapping the positions of two graphs, a layout that previously did not satisfy the left-right adjacency constraint now satisfies it, and the effective size decreases; therefore, the layout is updated. Repeat the above local search steps multiple times (e.g., 1000 times) to improve the global optimality of the search through iteration.

[0055] Mesh Adjustment: Calculates the effective size of the mesh and adjusts it accordingly. For example, if some areas of the mesh are empty and do not affect layout constraints, the mesh area is reduced.

[0056] S6. Perform full permutations of the input charts and calculate the similarity score between each permutation and the template; select the most suitable template based on the score and obtain the position and size information of the charts in the template.

[0057] In some embodiments, step S6 includes: Perform all permutations on the input chart to generate all possible combinations; Calculate the similarity score between each permutation and combination and the template; The most suitable template is selected based on the similarity score, and the position and size information of the chart in the template are obtained. The input chart is then displayed according to the layout of the most suitable template.

[0058] Specifically, step S6 includes the following three parts: generating all permutations, calculating similarity scores, and selecting templates.

[0059] Permutation Generation: Generates all possible permutations from the input chart. For example, given three charts A, B, and C, the permutations are ABC, ACB, BAC, BCA, CAB, and CBA.

[0060] Similarity score calculation: Calculate the similarity score between each permutation and the template. The score can be calculated based on the overall similarity and the satisfaction of layout constraints; a higher score indicates a higher similarity.

[0061] Template Selection: Select the most suitable template based on the score and obtain the position and size information of the chart within that template. For example, if ABC arrangement scores the highest, select the corresponding template and display the input chart according to the layout of that template.

[0062] Other embodiments of the present invention provide a computer device including a processor and a memory, wherein the memory stores a computer program that, when loaded and executed by the processor, implements the automatic page layout and rule mining method based on multiple constraints as described in any of the above embodiments.

[0063] Some embodiments of the present invention provide a computer-readable storage medium storing a program that, when loaded by a processor, implements the automatic page layout and rule mining method based on multiple constraints as described in any of the above embodiments.

[0064] In this specification, the illustrative expressions of the terms used do not necessarily refer to the same embodiments or examples. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0065] Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this invention shall be included within the scope of protection of this invention.

Claims

1. A method for automatic page layout and rule mining based on multi-constraints, characterized in that, The method comprises the following steps: creating a database for storing template data, wherein the template data comprises chart information and rule information; reading the template data from the database, and performing template rule mining on the template data by using a depth-first based frequent subgraph mining algorithm; calculating the similarity between the input chart and the template chart, including title similarity and chart type similarity; and synthesizing the title similarity and the chart type similarity to obtain the comprehensive similarity between the input chart and the template chart; allocating an ID to the input chart according to the comprehensive similarity, using the ID of the template chart if the similarity exceeds a threshold, otherwise allocating a new ID; checking whether all the IDs in the template rule are in the ID set of the input chart, and if so, considering that the rule is matched successfully; arranging the elements in a grid according to the number of input elements and the grid size, so as to maximize the number of elements that satisfy the given constraint conditions; the constraint conditions include left and right adjacency and top and bottom adjacency; calculating the effective size of the grid, i.e. the minimum rectangular area occupied by all non-zero elements, and adjusting the grid; performing full permutation on the input chart, calculating the similarity score of each permutation with the template, and selecting the most suitable template according to the score and obtaining the position and size information of the chart in the template.

2. The method of claim 1, wherein, The chart information in the template data comprises the ID, title and type of the chart; The rule information in the template data comprises the ID of the rule, the involved chart ID, the adjacent relationship ID, the rule support degree and the specific rule content.

3. The method of claim 2, wherein, The reading of the template data from the database and the template rule mining on the template data by using the depth-first based frequent subgraph mining algorithm comprise the following steps: preprocessing the read template data, and converting each template into a graph structure; wherein the vertex of the graph represents a single chart, and the vertex attribute contains the ID, title and type of the chart; a unique ID is allocated to each chart; the edge of the graph represents the spatial adjacent relationship between the charts, and the edge attribute is determined by calculating the chart position and size: when two charts are horizontally adjacent, the edge attribute is marked as 1; when two charts are vertically adjacent, the edge attribute is marked as 2; and no corresponding edge exists when they are not adjacent; performing depth-first search on the constructed graph structure set by using the gSpan algorithm, mining subgraph structures with an occurrence frequency greater than a set value, and defining the subgraph structures as frequent subgraphs; converting the mined frequent subgraphs into template rules; each frequent subgraph contains a plurality of vertices and edges, and the corresponding rule content is that chart A and chart B have left-right or top-bottom adjacent relationship, and the support degree of the rule is recorded, i.e. the number of templates containing the frequent subgraph; the extracted template rules are stored in the database.

4. The method of claim 3, wherein, The calculation method of the title similarity comprises the following steps: using a pre-trained BERT model to perform vectorization representation on the input chart title and the template chart title to obtain the input chart title vector vec_bert(title_input) and the template chart title vector vec_bert(title_template); calculating the cosine similarity between the input chart title vector and the template chart title vector as the title similarity, including: S_title = cos(vec_bert(title_input), vec_bert(title_template)) where S_title represents the title similarity; the calculation method of the chart type similarity comprises: calculating the similarity between the input chart type and the template chart type according to a preset similarity matrix.

5. The method of claim 1, wherein, the calculation method of the comprehensive similarity comprises: S = alpha * S_title + beta * S_type where S represents the total similarity; alpha represents the title similarity weight; S_title represents the title similarity; beta represents the template chart type similarity weight; and S_type represents the template chart type similarity.

6. The method for multi-constraint based page automatic layout and rule mining according to claim 1, wherein, the method of assigning an ID to the input chart according to the comprehensive similarity, if the similarity exceeds a threshold, using the ID of the template chart, otherwise assigning a new ID; checking whether all the IDs in the template rule are in the ID set of the input chart, if yes, considering that the rule is matched successfully, comprising: assigning an ID to the input chart according to the comprehensive similarity; mapping the input chart to the template chart ID when the comprehensive similarity is greater than a similarity threshold; otherwise, assigning a new ID; checking whether all the IDs in the template rule are in the ID set of the input chart, if yes, considering that the rule is matched successfully; for the matched rule, extracting the chart ID set and the relationship dictionary; sorting the rules according to the priority; wherein the priority of the chart quantity is higher than the priority of the support, and the priority of the support is higher than the original order of the rule; based on the rule priority sorting result to solve the rule conflict, and keeping the rule with higher priority in the rule conflict.

7. The method of claim 1, wherein, arranging the elements in the grid according to the number of input elements and the grid size, so that the number of satisfying the given constraint condition is the largest; the constraint condition comprises left and right adjacent and upper and lower adjacent; calculating the effective size of the grid, that is, the minimum rectangular area of the region occupied by all non-zero elements, and adjusting the grid, comprising: initializing a random layout according to the number of input elements and the preset grid size; searching for the best layout by randomly selecting two elements to exchange positions; wherein the score of the new layout after each element exchange is evaluated, and the new layout score is evaluated based on the number of satisfying the given constraint condition and the effective size of the grid; if the new layout score is higher and the grid effective size is smaller, the new layout is taken as the better layout; repeating the searching process until the best layout is found; calculating the effective size of the grid and adjusting the grid.

8. The method of claim 1, wherein, performing full permutation on the input chart, and calculating the similarity score of each permutation and the template; selecting the most suitable template according to the score, and obtaining the position and size information of the chart in the template, comprising: performing full permutation on the input chart to generate all possible permutation combinations; calculating the similarity score of each permutation combination and the template; selecting the most suitable template according to the similarity score, and obtaining the position and size information of the chart in the template, and displaying the input chart according to the layout of the most suitable template.

9. A computer device, comprising: A computer program product comprising a computer readable medium having stored thereon the computer program of claim 9, wherein said computer program is loadable into the internal memory of a digital computer and / or work station and / or server and / or mainframe computer and / or microcomputer and / or personal computer and / or laptop computer and / or netbook computer and / or tablet computer and / or smartphone and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses and / or smarttv and / or smartcar and / or smartwatch and / or smartglasses 10. A computer-readable storage medium, characterized in that, ​