A graph model automatic layout method
Patent Information
- Application Number
- CN202310433735.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-21
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-04-21
AI Technical Summary
[0029]1)本发明在图文法形式框架下提出了一种新型图模型布局技术,可以对图模型的布局进行调整,而重新绘制出符合相应布局约束的图。该方法对于任意输入的图模型使用图文法对其进行归约操作,归约的过程中不考虑其空间布局而仅分析其语法结构信息,并记录其归约过程;然后,根据合法图归约的相反过程,从初始图出发进行推导操作,在推导过程中进行图模型的重新绘制,直至得到所需规范布局。
Smart Images

Figure CN116823996B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of graph model layout technology, and in particular, it is a method for automatically laying out an input graph model based on a graph-text method. Background Technology
[0002] Visualization is a theory and technology that uses computer graphics and image processing to transform specific data into graphics or images and display them in the user's view, allowing the user to interact with them. After data is visualized, it can help users analyze complex relational data and further discover the potential value of the data. Graph model layout technology is a very important cornerstone in graph visualization. For a complex graph containing a large amount of data, a reasonable layout can help users analyze quickly and accurately locate the problem. The core of graph model layout technology is how to better display the structure of the graph and make it easy to understand and use. Generally speaking, the effect of graph model layout should meet aesthetic standards. Although aesthetic annotations are not consistent under different application requirements, they generally meet the following principles: (1) Minimum number of edge intersections: In order to clearly show the structure of the graph, the number of edge intersections should be reduced; (2) Proximity of adjacent points: Adjacent nodes should be configured in close proximity as much as possible to reduce the length of the edges; (3) Straight edge principle: The edges of the graph should be straight as much as possible, and curves should be avoided; (4) Balanced edge layout principle: Multiple edges of the same node should be balanced around the node as much as possible. Furthermore, when laying out the graph, the regularity and flexibility of the graph must be considered. Regularity means that the reference principles for laying out nodes should remain consistent throughout the entire drawing process, while flexibility means that the edges of the graph should be able to form paths within the graph. In short, a layout algorithm can not only draw a clear and aesthetically pleasing graph model, but also provide convenience for extracting graph information.
[0003] Currently, common graph layout techniques include force-directed layout, circular layout, and radial layout. Force-directed layout uses a spring model to simulate the layout process, treating graph points as steel rings and edges as springs in a physical system. The ideal length of the spring is proportional to the graph distance between two points. Initially, the steel rings are randomly positioned. The spring force causes the steel rings to experience attractive or repulsive forces, causing the rings at the ends of the spring to move closer or further apart. This movement continues until the system reaches equilibrium, i.e., when the system energy is at its minimum. Ideally, at this point, the net force on all the steel rings is zero. Circular layout is a layout algorithm used for visualizing graphs. It typically uses forced guidance to arrange nodes into a circular pattern, placing nodes in a specific order on the circumference with connections between adjacent nodes. Circular layout is often used to display information structures such as topology graphs, computer network topologies, and social networks. Radial layout is a layout algorithm that arranges nodes in a radial pattern, typically using a central point as a reference point and distributing other nodes accordingly. It is commonly used to describe graphs with a clear hierarchical structure, such as tree structures, social networks, and scientific collaboration networks.
[0004] These algorithms all have some drawbacks, such as: high dependence on initial states: Both force-directed placement and radial placement algorithms will produce different placement results depending on different initial states. Over-reliance on local optima: Radial placement algorithms rely on local information and can only obtain locally optimal solutions, not guaranteeing a globally optimal solution. Limitations on the number of nodes: Ring placement algorithms require all nodes to be placed on a ring, and radial placement algorithms display the network graph based on a radial distribution from a central point. Therefore, both algorithms will experience increased node density as the number of nodes increases, thus reducing the visualization effect. Summary of the Invention
[0005] The purpose of this invention is to address the problems existing in the prior art by providing a method for automatically laying out an input graph model based on graph grammar. This invention proposes a novel graph model layout technique within the framework of graph grammar, which can adjust the layout of the graph model and redraw it to conform to the layout specifications defined by the grammar. The method generally consists of three stages: First, a set of production rules describing the grammar rules and layout specifications are designed for a given type of graph model or graph language; second, for any input graph model, a reduction operation is performed using graph grammar. During the reduction process, the spatial layout can be disregarded, and only the syntactic structure information is analyzed to determine the legality of the input graph, and the reduction process is recorded; third, based on the reverse process of legal graph reduction, a derivation operation is performed starting from the initial graph, during which the graph model is redrawn until the desired standardized layout is obtained.
[0006] The technical solution to achieve the objective of this invention is as follows: On one hand, an automatic layout method for graph models is provided, the method comprising the following steps:
[0007] Design a set of production rules based on the specific application domain and graph model category, and perform local layout for the nodes contained in the production rules;
[0008] Take any input graph model as the main graph, use the production rules to perform a reduction operation on the main graph, determine the legality of its syntactic structure, and record the reduction process;
[0009] The initial graph is used as the main graph, and the derivation operation is performed in the reverse direction of the reduction process recorded above. During the derivation operation, the input graph is rearranged.
[0010] Furthermore, in each step of the graph transformation process in the derivation operation, the global coordinates of the main graph node are adjusted according to the spatial orientation relationship between the main graph node and the embedded graph.
[0011] Furthermore, the step of designing a set of production rules based on the specific application domain and graph model category, and performing local layout for the nodes contained in the production rules, specifically includes:
[0012] Design production rules based on the grammatical structure of the specified category graph model, and the production rules must satisfy the context-independent condition, that is, the left-hand side of the production rule is only a non-terminal point;
[0013] Set the primary and secondary drawing directions for the production method according to the display terminal and layout requirements;
[0014] Perform local layout on the graphs at both ends of the production rule, with both ends of the production rule located in the same local coordinate system, and assign a local coordinate to each node of the production rule graph;
[0015] Record the minimum and maximum coordinate values of the right-hand side based on the node coordinates on the right-hand side of the production rule.
[0016] Furthermore, the drawing primary and secondary directions are set according to the display terminal and layout requirements. Specifically, the X-axis is the primary direction and the Y-axis is the secondary direction; the minimum and maximum coordinate values are the minimum and maximum X and Y coordinate values.
[0017] Furthermore, the step of using any input graph model as the main graph, performing a reduction operation on the main graph using the production rules, determining the validity of its syntactic structure, and recording the reduction process specifically includes:
[0018] Determine whether the current main image is the initial image. If so, perform the derivation operation by taking the initial image as the main image and following the reverse process of the reduction process recorded above. In the derivation operation, the input image is rearranged. Otherwise, proceed to the next step.
[0019] Select a production right-hand side and search for the graph handle in the main graph. If the graph handle exists, proceed to the next step; if the graph handle does not exist, it means that the input graph is invalid, prompt an error, and the process terminates.
[0020] Based on the context of the production, the left-hand side of the production is used to replace the graph handle in the main graph, and the process returns to the first step.
[0021] Furthermore, the derivation operation, which uses the initial graph as the main graph and follows the reverse process of the reduction process recorded above, involves rearranging the input graph during the derivation operation. The specific process includes:
[0022] The left and right ends of the production are shifted by the coordinate difference between the handle and the left end of the production, that is: the coordinates of the left end node of the production are equal to those of the handle.
[0023] In the X-axis translation of the main graph, all nodes whose coordinate values are greater than the coordinates of the left-hand node of the production rule are translated by an amount of X. rmax -X l , where X rmax X is the maximum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule;
[0024] For nodes in the main graph whose coordinate values are less than the coordinates on the left side of the production rule, the translation amount is X. rmin -X l , where X rmin Let X be the minimum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule;
[0025] In the Y-axis translation of the main graph, for all nodes whose X-coordinate is equal to the X-coordinate of the left-hand node of the production rule, if the Y-coordinate of a node in the main graph is greater than the Y-coordinate of the left-hand node, the translation amount is Y. rmax -Y l If the Y-coordinate of the main node is less than the Y-coordinate of the left node, the translation amount is Y. rmin -Y l , where Y rmax and Y rmin Let Y be the maximum and minimum Y coordinates of the right-hand node of the production equation, respectively. l The Y-coordinate of the left-hand node of the production rule;
[0026] Replace the graph handle in the main graph using the right-hand side of the production rule according to the context of the production rule;
[0027] Repeat the above steps in the reverse direction of the reduction process until the input graph is derived and the layout is complete.
[0028] Compared with the prior art, the significant advantages of this invention are:
[0029] 1) This invention proposes a novel graph model layout technique within the framework of graph grammar, which can adjust the layout of a graph model and redraw it to conform to the corresponding layout constraints. This method uses graph grammar to reduce any input graph model, analyzing only its syntactic structure information without considering its spatial layout and recording the reduction process. Then, based on the reverse process of legal graph reduction, a derivation operation is performed starting from the initial graph, redrawing the graph model during the derivation process until the desired canonical layout is obtained.
[0030] 2) Compared to the force-directed placement algorithm, the main drawback of the force-directed placement algorithm is its sensitivity to the initial state. Different initial states may lead to different final placement results. Furthermore, due to the uncertainty of the placement process, the placement result may differ with each run under the same initial state and parameters. The method proposed in this invention first reduces the input graph model to an initial graph (if the graph model is valid) through a graph-text reduction operation. During the reduction process, spatial layout is not considered; only its syntactic structure information is analyzed, and the reduction process is recorded. Then, based on the reverse process of graph reduction, a derivation operation is performed starting from the initial graph. During the derivation process, the graph model is redrawn until the desired canonical layout is obtained. This process ensures that even if the spatial layout of the input graph model is different, as long as the structure is the same, the final placement result will be the same.
[0031] 3) Compared to the circular layout algorithm, which places all nodes on a ring, the increased number of nodes leads to higher node density, and the correlation between node relationships and orientations is not strong enough, resulting in insufficient intuitiveness and readability of the graph model adjusted using the circular layout algorithm. This invention uses a graphical derivation operation to adjust the graph layout. The completed layout clearly shows the structural relationships between nodes, and the coordinates of the nodes are adjusted to appropriate positions through designed production rules, resulting in better intuitiveness and interpretability.
[0032] The present invention will now be described in further detail with reference to the accompanying drawings. Attached Figure Description
[0033] Figure 1 This is a flowchart of the automatic layout process for the graphical model of the present invention.
[0034] Figure 2 This is a schematic diagram of the production rules for a set of graphical representations (EGGs) in one embodiment.
[0035] Figure 3 This is a schematic diagram of an input graph model in one embodiment.
[0036] Figure 4 To Figure 3 The graphical model shown uses Figure 2A schematic diagram of the reduction process of production rules.
[0037] Figure 5 This is a schematic diagram of the rearrangement process of the graphical model of the present invention in one embodiment. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0039] It should be noted that if the embodiments of the present invention involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0040] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0041] In one embodiment, combined Figure 1 An automatic layout method for graph models is provided, the method comprising the following steps:
[0042] S1. Design a set of production rules based on the specific application domain and graph model category, and perform local layout for the nodes contained in the production rules;
[0043] S2, take any input graph model as the main graph, use the production rules to perform a reduction operation on the main graph, determine the validity of its syntactic structure, and record the reduction process; Note: In this step, only its syntactic structure is considered, and no layout operation is performed;
[0044] S3: Using the initial graph as the main graph, perform the derivation operation in the reverse direction of the reduction process recorded above. During the derivation operation, the input graph is rearranged. In each step of the graph transformation process in the derivation operation, the global coordinates of the main graph nodes are adjusted according to the spatial orientation relationship between the main graph nodes and the embedded graph.
[0045] Furthermore, in one embodiment, step S1 specifically includes the following process:
[0046] S1-1, Design production rules based on the syntax structure of the specified category graph model. Here, we take the dangling edge graph grammar EGG as an example. The designed production rules are required to satisfy the context-independent condition, that is, the left side of the production rule is only a non-terminal point. Preferably, the design of production rules can also be automatically generated with the help of some production rule extraction techniques.
[0047] S1-2, Set the main and secondary directions of drawing for the production method according to the specific display terminal and layout requirements. Here, we take the X-axis as the main direction and the Y-axis as the secondary direction as an example.
[0048] S1-3, perform local layout on the graphs at both ends of the production rule, with both ends of the production rule located in the same local coordinate system, and assign a local coordinate to each node of the production rule graph;
[0049] S1-4, record the minimum and maximum X and Y coordinate values of the right side according to the node coordinates on the right side of the production.
[0050] Furthermore, in one embodiment, step S2 specifically includes:
[0051] S2-1: Determine if the current main image is the initial image. If it is, execute S3; otherwise, execute S2-2.
[0052] S2-2: Select the right-hand side of a production rule and search for the graph handle in the main graph. If the graph handle exists, execute S2-3; if the graph handle does not exist, it means that the input graph is invalid, prompt an error, and the process terminates.
[0053] S2-3, based on the context of the production, replace the graph handle in the main graph using the left-hand side of the production, and return to execute S2-1.
[0054] Furthermore, in one embodiment, step S3 specifically includes:
[0055] S3-1, shift the left and right ends of the production formula by the coordinate difference between the handle and the left end of the production formula, that is: make the coordinates of the left end node of the production formula equal to the coordinates of the handle.
[0056] S3-2, in the X-axis translation of the main graph, all nodes whose coordinate values are greater than the coordinates of the left-hand node of the production rule are translated by an amount of X. rmax -X l , where X rmax X is the maximum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule;
[0057] S3-3, in the X-axis translation of the main graph, for all nodes whose coordinate values are less than the coordinates on the left side of the production formula, the translation amount is X.rmin -X l , where X rmin Let X be the minimum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule;
[0058] S3-4, in the Y-axis translation of the main graph, for all nodes whose X-coordinate is equal to the X-coordinate of the left-hand node of the production rule, if the Y-coordinate of a node in the main graph is greater than the Y-coordinate of the left-hand node, the translation amount is Y. rmax -Y l If the Y-coordinate of the main node is less than the Y-coordinate of the left node, the translation amount is Y. rmin -Y l , where Y rmax and Y rmin Let Y be the maximum and minimum Y coordinates of the right-hand node of the production equation, respectively. l The Y-coordinate of the left-hand node of the production rule;
[0059] S3-5, Replace the graph handle in the main graph using the right-hand side of the production rule according to the context of the production rule;
[0060] S3-6, repeat the above steps in the reverse direction of the reduction process until the input graph is derived and the layout ends.
[0061] In one embodiment, an automatic layout system for graph models is provided, the system comprising:
[0062] The first module is used to design a set of production rules based on the specific application domain and graph model category, and to perform local layout of the nodes contained in the production rules.
[0063] The second module is used to take any input graph model as the main graph, perform a reduction operation on the main graph using the production rules, determine the legality of its syntactic structure, and record the reduction process.
[0064] The third module is used to perform derivation operations on the input graph by taking the initial graph as the main graph and following the reverse process of the reduction process recorded above. In the derivation operation, the input graph is rearranged.
[0065] For specific limitations regarding the automatic layout system for graphical models, please refer to the limitations of the automatic layout method for graphical models mentioned above, which will not be repeated here. Each module in the aforementioned automatic layout system for graphical models can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or they can be stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0066] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0067] S1. Design a set of production rules based on the specific application domain and graph model category, and perform local layout for the nodes contained in the production rules.
[0068] S2, take any input graph model as the main graph, use the production rules to perform a reduction operation on the main graph, determine the validity of its syntactic structure, and record the reduction process; Note: In this step, only its syntactic structure is considered, and no layout operation is performed;
[0069] S3: Using the initial graph as the main graph, perform the derivation operation in the reverse direction of the reduction process recorded above. During the derivation operation, the input graph is rearranged. In each step of the graph transformation process in the derivation operation, the global coordinates of the main graph nodes are adjusted according to the spatial orientation relationship between the main graph nodes and the embedded graph.
[0070] The specific limitations of this step can be found in the limitations of the automatic layout method for graph models mentioned above, and will not be repeated here.
[0071] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0072] S1. Design a set of production rules based on the specific application domain and graph model category, and perform local layout for the nodes contained in the production rules.
[0073] S2, take any input graph model as the main graph, use the production rules to perform a reduction operation on the main graph, determine the validity of its syntactic structure, and record the reduction process; Note: In this step, only its syntactic structure is considered, and no layout operation is performed;
[0074] S3: Using the initial graph as the main graph, perform the derivation operation in the reverse direction of the reduction process recorded above. During the derivation operation, the input graph is rearranged. In each step of the graph transformation process in the derivation operation, the global coordinates of the main graph nodes are adjusted according to the spatial orientation relationship between the main graph nodes and the embedded graph.
[0075] The specific limitations of this step can be found in the limitations of the automatic layout method for graph models mentioned above, and will not be repeated here.
[0076] As a specific example, the present invention will be further verified and illustrated. Figure 2 It is a set of production rules for the EGG (Graphical Image Generator). As can be seen, the left and right ends of its production rules contain local coordinates, representing the layout specifications. Figure 3It is an input graph model, and its layout is obviously cluttered and lacks intuitiveness. Figure 4 Yes Figure 3 The graphical model shown uses Figure 2 The reduction process of production rules involves continuously replacing the handle of the right-hand side of the production rule in the main graph with the left-hand side. The handle of the right-hand side of the production rule is shown within the dashed box. It can be seen that the input graph can be reduced to the initial graph λ, indicating that its syntax structure is valid and the layout method of this invention can be executed. Figure 5 This invention relates to a process of rearranging the graphical model. Based on graphical derivation operations and combined with layout planning, each derivation step adjusts the layout according to the global spatial orientation of the main graph and the local spatial orientation of the production rules. Compared to... Figure 3 The appearance of the input image shown. Figure 5 The newly redesigned main image at the bottom is clearly more intuitive and easier to read.
[0077] In summary, this invention proposes a novel graph model layout technique within the framework of graph grammar. For the input graph model, a reduction operation is performed using graph grammar. During the reduction process, the spatial layout can be disregarded, and only the syntactic structure information is analyzed. The reduction process is recorded. Secondly, based on the reverse process of graph reduction, a derivation operation is performed starting from the initial graph. During the derivation process, the graph model is redrawn until the required standard layout is obtained. The drawing process considers both global and local layout effects and ensures the consistency of the layout effect.
[0078] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention without departing from its spirit and scope should be included within the protection scope of the present invention.
Claims
1. An automatic layout method for graph models, characterized in that, The method includes the following steps: Design a set of production rules based on the specific application domain and graph model category, and perform local layout for the nodes contained in the production rules; Take any input graph model as the main graph, use the production rules to perform a reduction operation on the main graph, determine the legality of its syntactic structure, and record the reduction process; The initial graph is used as the main graph, and the derivation operation is performed in the reverse direction of the reduction process recorded above. The input graph is rearranged during the derivation operation. The derivation operation, which uses the initial graph as the main graph and follows the reverse process of the reduction process recorded above, involves rearranging the input graph during the derivation operation. The specific process includes: The left and right ends of the production are shifted by the coordinate difference between the handle and the left end of the production, that is: the coordinates of the left end node of the production are equal to those of the handle. In the X-axis translation of the main graph, all nodes whose coordinate values are greater than the coordinates of the left-hand node of the production rule are translated by an amount of X. rmax - X l , where X rmax X is the maximum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule; For nodes whose coordinate values in the main graph are less than the coordinates on the left side of the production rule, the translation amount is X. rmin - X l , where X rmin Let X be the minimum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule; In the Y-axis translation of the main graph, all nodes whose X-coordinate is equal to the X-coordinate of the left-hand node of the production rule are translated. If the Y-coordinate of a node in the main graph is greater than the Y-coordinate of the left-hand node, the translation amount is Y. rmax - Y l If the Y-coordinate of the main node is less than the Y-coordinate of the left node, the translation amount is Y. rmin - Y l , where Y rmax and Y rmin Let Y be the maximum and minimum Y coordinates of the right-hand node of the production equation, respectively. l The Y-coordinate of the left-hand node of the production rule; Replace the graph handle in the main graph using the right-hand side of the production rule according to the context of the production rule; Repeat the above steps in the reverse direction of the reduction process until the input graph is derived and the layout is complete.
2. The automatic layout method for graph models according to claim 1, characterized in that, In each step of the derivation process, the global coordinates of the main graph node are adjusted according to the spatial orientation relationship between the main graph node and the embedded graph.
3. The automatic layout method for graph models according to claim 1, characterized in that, The process of designing a set of production rules based on the specific application domain and graph model category, and performing local layout of the nodes contained in the production rules, includes: Design production rules based on the grammatical structure of the specified category graph model, and the production rules must satisfy the context-independent condition, that is, the left-hand side of the production rule is only a non-terminal point; Set the primary and secondary drawing directions for the production method according to the display terminal and layout requirements; Perform local layout on the graphs at both ends of the production rule, with both ends of the production rule located in the same local coordinate system, and assign a local coordinate to each node of the production rule graph; Record the minimum and maximum coordinate values of the right-hand side based on the node coordinates on the right-hand side of the production rule.
4. The automatic layout method for graph models according to claim 3, characterized in that, The drawing primary and secondary directions are set according to the display terminal and layout requirements. Specifically, the X-axis is the primary direction and the Y-axis is the secondary direction. The minimum and maximum coordinate values are the minimum and maximum X and Y coordinate values, respectively.
5. The automatic layout method for graph models according to claim 3, characterized in that, The production rules are automatically generated using production rule extraction technology.
6. The automatic layout method for graph models according to claim 4, characterized in that, The process of taking any input graph model as the main graph, performing a reduction operation on the main graph using the production rules, determining the validity of its syntactic structure, and recording the reduction process includes: Determine whether the current main image is the initial image. If so, perform the derivation operation by taking the initial image as the main image and following the reverse process of the reduction process recorded above. In the derivation operation, the input image is rearranged. Otherwise, proceed to the next step. Select a production right-hand side and search for the graph handle in the main graph. If the graph handle exists, proceed to the next step; if the graph handle does not exist, it means that the input graph is invalid, prompt an error, and the process terminates. Based on the context of the production, the left-hand side of the production is used to replace the graph handle in the main graph, and the process returns to the first step.
7. An automatic layout system for graphical models based on the method of any one of claims 1 to 6, characterized in that, The system includes: The first module is used to design a set of production rules based on the specific application domain and graph model category, and to perform local layout of the nodes contained in the production rules. The second module is used to take any input graph model as the main graph, perform a reduction operation on the main graph using the production rules, determine the legality of its syntactic structure, and record the reduction process. The third module is used to perform a derivation operation on the initial graph as the main graph, following the reverse process of the reduction process recorded above, and to rearrange the input graph during the derivation operation; the specific process of performing the derivation operation on the initial graph as the main graph, following the reverse process of the reduction process recorded above, and to rearrange the input graph during the derivation operation includes: The left and right ends of the production are shifted by the coordinate difference between the handle and the left end of the production, that is: the coordinates of the left end node of the production are equal to those of the handle. In the X-axis translation of the main graph, all nodes whose coordinate values are greater than the coordinates of the left-hand node of the production rule are translated by an amount of X. rmax - X l , where X rmax X is the maximum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule; For nodes whose coordinate values in the main graph are less than the coordinates on the left side of the production rule, the translation amount is X. rmin - X l , where X rmin Let X be the minimum X-coordinate of the right-hand node of the production rule. l The x-coordinate of the left-hand node of the production rule; In the Y-axis translation of the main graph, all nodes whose X-coordinate is equal to the X-coordinate of the left-hand node of the production rule are translated. If the Y-coordinate of a node in the main graph is greater than the Y-coordinate of the left-hand node, the translation amount is Y. rmax - Y l If the Y-coordinate of the main node is less than the Y-coordinate of the left node, the translation amount is Y. rmin - Y l , where Y rmax and Y rmin Let Y be the maximum and minimum Y coordinates of the right-hand node of the production equation, respectively. l The Y-coordinate of the left-hand node of the production rule; Replace the graph handle in the main graph using the right-hand side of the production rule according to the context of the production rule; Repeat the above steps in the reverse direction of the reduction process until the input graph is derived and the layout is complete.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 6.
Citation Information
Patent Citations
LGG graph grammar-to-RGG graph grammar conversion method
CN102314350A
Method for converting edged graph grammar (EGG) to reserved graph grammar (RGG)
CN102929639A
