Method and system for performing bidirectional data type derivation in graphical programming

By using a two-layer graph tree structure and a bidirectional type inference method, the problem of type determination for nested structures in graphical programming is solved, and intelligent type mapping and back propagation of tunnel nodes are realized, thereby improving the type security and development efficiency of the system.

CN121680822AActive Publication Date: 2026-03-17CHENGDU MAISHUO ELECTRIC CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202610187451.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-10
Publication Date
2026-03-17
Estimated Expiration
2046-02-10

AI Technical Summary

Technical Problem

Existing graphical programming systems only support one-way type inference, making it difficult to correctly handle complex nested structures and the type determination of tunnel exit nodes. In particular, type information is easily lost or erroneous in multi-layered nested control structures.

Method used

It adopts a two-layer graph-tree structure, combining depth-first search (DFS) and post-order traversal (LRD) to realize bidirectional data type derivation from the outside to the inside and from the inside to the outside. The graph structure describes the data flow and the tree structure describes the hierarchical relationship, automatically mapping the tunnel node type and propagating in reverse.

Benefits of technology

It effectively solves the problem of type determination in nested structures, improves the type safety and development efficiency of graphical programming systems, and is particularly suitable for engineering applications with complex nested control structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121680822A_ABST
    Figure CN121680822A_ABST
Patent Text Reader

Abstract

The invention provides a method and a system for performing bidirectional data type derivation in graphical programming, and relates to the technical field of graphical programming, and the method comprises the following steps: S1, analyzing graphical programming data into a graph structure and a tree structure; s2, data type derivation from outside to inside is executed, specifically, on the basis of the tree structure, all graph structures are traversed according to the depth priority sequence, internal nodes of the currently traversed graph structure are traversed according to the topological sequence of a directed acyclic graph, and the data type of downstream nodes is derived according to the data type of upstream nodes in the data flow direction; s3, data type derivation from inside to outside is executed, specifically, on the basis of the tree structure, all graph structures are traversed according to a subsequent sequence, for the currently traversed graph structure, the data type of an output boundary of the currently traversed graph structure is determined according to the data type of internal nodes of the currently traversed graph structure, and the data type is reversely propagated to a corresponding node in a parent graph of the currently traversed graph structure; and S4, automatically generating a type conversion code according to a predefined data type processing rule.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of graphical programming, in particular to a method and system for bidirectional data type derivation in graphical programming. BACKGROUND

[0002] In the technical field of graphical programming, data type derivation is a key link of code generation. Most of the existing graphical programming systems only support unidirectional type derivation, that is, forward derivation from data source to data sink. For example, LabVIEW, as a representative product of graphical programming, but its derivation mechanism is mainly unidirectional, and it has limited support for complex nested structures. This way can maintain normal work in simple linear data flow, but it has obvious defects when facing complex nested structures, especially when there are multiple layers of nested control structures, the type information is easy to lose or error when transmitted between levels.

[0003] Moreover, in graphical programming, tunnel nodes are key elements for connecting different levels of graph structures. When data is transmitted from the outside of the loop structure to the inside of the loop structure through the tunnel node, and then transmitted from the inside to the outside, unidirectional derivation is difficult to correctly determine the type of the tunnel exit node. The reason is that when the input is an array or list type, the collection type needs to be mapped to the element type for the loop body, and the existing system has insufficient support; the type of the tunnel exit node needs to be propagated from the inside to the outside of the subgraph, but the existing unidirectional derivation mechanism cannot achieve this. SUMMARY

[0004] The purpose of the present application is to provide a method for bidirectional data type derivation in graphical programming. Based on the double structure of graph tree, through the bidirectional mechanism of outward-inward derivation and inward-outward derivation, the complete transmission of data type information in nested structures can be ensured.

[0005] To solve the above technical problems, the present application adopts the following scheme: A method for bidirectional data type derivation in graphical programming, comprising the following steps: S1, receiving graphical programming data, and parsing the graphical programming data into a graph structure and a tree structure; The graph structure is a directed acyclic graph constructed according to each independently executable logical block in the graphical programming data, and the data flow within the logical block is described by the connection relationship between the nodes in the directed acyclic graph; The tree structure describes the hierarchical nested relationship between all graph structures, wherein each tree node uniquely corresponds to a graph structure, the graph structure corresponding to the tree node at the upper level is called the parent graph, and the graph structure corresponding to the tree node at the lower level is called the subgraph; S2, performing data type derivation from outside to inside: based on the tree structure, traversing each graph structure in depth-first order, for the currently traversed graph structure, traversing internal nodes according to the topological order of the directed acyclic graph, and according to the data flow, deriving the data type of the downstream node according to the data type of the upstream node; S3, performing data type derivation from inside to outside: based on the tree structure, traversing each graph structure in postorder, for the currently traversed graph structure, determining the data type of its output boundary according to the data types of its internal nodes, and propagating the data type to the corresponding node in its parent graph in reverse; S4, automatically generating type conversion code according to predefined data type processing rules.

[0006] Further, in S2, the process of deriving the data type of the downstream node according to the data type of the upstream node is specifically: branching according to the type of the upstream node; If the upstream node is a loop structure node, the data type of the downstream node is automatically derived according to the data type of the upstream node and the semantics of the loop structure; if the upstream node is other control structure node, the data type of the upstream node is derived to the downstream node according to the predefined type derivation rule; if the upstream node is a normal node, the data type of the upstream node is directly transmitted to the downstream node.

[0007] Further, when the upstream node is an input tunnel node of a loop structure, the process of automatically deriving the data type of the downstream node according to the data type of the upstream node and the semantics of the loop structure is specifically: determining whether the data type is an array type or a list type; If yes, the data type of the downstream node is automatically derived as the element type of the array or list; if no, the data type of the upstream node is directly transmitted as the data type of the downstream node.

[0008] Further, automatically deriving the data type of the downstream node as the element type of the array or list is embodied as code that accesses a single element in the array or list according to the loop iteration index when code is generated.

[0009] Further, in S3, when the currently traversed graph structure is a loop structure corresponding subgraph, the process of determining the data type of its output boundary according to the data types of its internal nodes is: detecting the data type requirement of the corresponding receiving node in its parent graph, and determining the data type of its output boundary according to the generated data type and the data type requirement.

[0010] Further, the process of determining the data type of its output boundary is specifically: If the data type generated internally is a simple type and the data type of the corresponding receiving node in the parent graph is a set type, then the data type of its output boundary is deduced to be a list type with that simple type as its element; otherwise, the data type generated internally is directly determined as the data type of its output boundary.

[0011] Furthermore, the data type of its output boundary is deduced to be a list type with this simple type as its elements. This is reflected in the code generation process by generating code that creates a cached list, appends data in each loop iteration, and outputs the complete list after the loop ends.

[0012] Furthermore, the process of automatically generating type conversion code based on predefined data type processing rules is as follows: Obtain predefined numeric type priority rules and display type conversion rules; wherein, the numeric types include integer type, floating-point type and high-precision type; Detect all data connections. When the data types at both ends of the connection do not match, determine whether a display conversion is needed based on the display type conversion rules. If so, generate the corresponding code.

[0013] A system for performing bidirectional data type deduction in graphical programming, using the aforementioned method for performing bidirectional data type deduction in graphical programming, includes: Graph structure parsing module: Receives graphical programming data and parses it into graph and tree structures; The graph structure is a directed acyclic graph constructed based on each independently executable logic block in the graphical programming data. The data flow within the logic block is described by the connection relationship between nodes in the directed acyclic graph. The tree structure describes the hierarchical nesting relationship between all graph structures. Each tree node uniquely corresponds to a graph structure. The graph structure corresponding to the tree node at the upper level is called the parent graph, and the graph structure corresponding to the tree node at the lower level is called the child graph. The data type derivation module from the outside to the inside: Based on the tree structure, each graph structure is traversed in depth-first order. For the currently traversed graph structure, the internal nodes are traversed according to the topological order of the directed acyclic graph, and the data type of the downstream node is deduced according to the data flow direction based on the data type of the upstream node. Data type derivation module from the inside out: Based on the tree structure, traverse each graph structure in post-order. For the currently traversed graph structure, determine the data type of its output boundary based on the data type of its internal nodes, and propagate the data type back to the corresponding node in its parent graph. Display type conversion module: Automatically generates type conversion code based on predefined data type processing rules.

[0014] The beneficial effects of this invention are: 1. Two-way type inference mechanism: It innovatively combines the inference from the outside to the inside of depth-first search (DFS) with the inference from the inside to the outside of post-order traversal (LRD), which effectively solves the problem of type determination in nested structures.

[0015] 2. Graph-Tree Two-Layer Data Structure: The two-layer structure, which uses a graph to describe the data flow and a tree to describe the hierarchical relationship, provides a solid data organization foundation for bidirectional type inference.

[0016] 3. Intelligent type mapping for tunnel nodes: Implements automatic mapping of arrays / lists to element types for tunnel entrance nodes, as well as a type backpropagation mechanism for tunnel exit nodes.

[0017] 4. Priority-based automatic type conversion: Define a complete type priority system and explicit conversion rules to achieve automatic generation of type conversion code.

[0018] In summary, this invention significantly improves the type safety and development efficiency of graphical programming systems, and is particularly suitable for engineering application scenarios involving complex nested control structures. It can be widely used in fields such as industrial automation, test and measurement, and data analysis. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the architecture of the graphical programming system in Embodiment 1 of the present invention.

[0020] Figure 2 This is a schematic diagram of the two-layer tree structure in Embodiment 1 of the present invention.

[0021] Figure 3 This is a flowchart illustrating the method in Embodiment 1 of the present invention. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of the invention.

[0024] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0025] Furthermore, for clarity and brevity, descriptions of well-known structures, functions, and configurations may have been omitted. Those skilled in the art will recognize that various changes and modifications can be made to the examples described herein without departing from the spirit and scope of this disclosure.

[0026] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0027] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0028] The present invention will now be described in detail with reference to the accompanying drawings and embodiments: Example 1 In this embodiment, a graphical programming system may be provided, the architecture of which is as follows: Figure 1 As shown, the system includes a front-end diagram editor, a graph structure parsing module, a bidirectional type inference module, and a code generation module. Specifically, the front-end diagram editor is used by users to build program diagrams by dragging and dropping nodes and connecting data lines. The graph structure parsing module is used to parse JSON into Graph objects and build graph and tree structures, i.e., directed acyclic graphs and tree structures. The bidirectional type inference module includes an outside-in data type inference module, an inside-out data type inference module, and a display type conversion module. The outside-in data type inference module is mainly used for DFS inference from the outside to the inside, and its process can be topological sorting traversal, tunnel entry processing, and array index mapping in sequence. The inside-out data type inference module is mainly used for LRD inference from the inside to the outside, and its process can be subsequent traversal processing, tunnel exit propagation, and control node update in sequence. The display type conversion module is mainly used for display type conversion processing, and its process can be type priority judgment, conversion rule matching, and Convert code generation in sequence. The code generation module is used to generate type-safe C# code from the inferred type information.

[0029] The graph structure and tree structure constitute a two-layer data structure to represent the graphical program. Specifically, the graph structure refers to constructing each independently executable logical block in the graphical programming data into a directed acyclic graph (DAG). Each DAG includes a unique graph identifier, a graph name, the control node, a node set, and DAG data flow relationships, and is divided into a main graph and subgraphs. The tree structure is based on the hierarchical nesting relationship between all extracted graph structures. Each tree node uniquely corresponds to a graph structure, with the main graph as the root node of the tree. The graph structure corresponding to the upper-level tree node is called the parent graph, and the graph structure corresponding to the lower-level tree node is called the subgraph.

[0030] Specifically, the graph tree two-layer structure is as follows: Figure 2 As shown, this includes a tree structure and its corresponding graph structure. The graph structure represents a data flow DAG, which includes a ForLoop subgraph DAG and a main graph DAG connected to it. Data flows from the ForLoop subgraph DAG to the main graph DAG. The tree structure represents a hierarchical relationship, recursively forming multiple levels of trees in a nested structure. The first level is the main graph Main, with Main as the root node, corresponding to the main graph DAG. The second level consists of ForLoop and WhileLoop subgraphs, which are the lower-level tree nodes. The ForLoop subgraphs correspond to the ForLoop subgraph DAG, and at this point, the main graph Main is the parent graph of the ForLoop and WhileLoop subgraphs. The third level consists of Branch-True, Branch-False, and inner ForLoop subgraphs, which are the lower-level tree nodes. At this point, the ForLoop subgraph is the parent graph of the Branch-True and Branch-False subgraphs, and the WhileLoop subgraph is the parent graph of the inner ForLoop subgraph.

[0031] Furthermore, a Depth-First Search (DFS) approach is proposed for graph structures, starting from the root graph and deriving the type along the data flow direction. Specifically, assuming the current input is the root graph Graph8, g.DeclType is called to derive the current graph type. All nodes in the graph are traversed. When a node is found, its type is determined, and then the node's own type can be used for type deduction. If the node type is ForLoopNode, which is a For loop structure node, the subgraph SubGraph is obtained; if the node type is WhileLoopNode, which is a While loop structure node, the subgraph SubGraph is obtained; if the node type is GraphControlNode, which is another control structure node, all subgraphs are traversed; if the node type is a normal node, the next node is traversed until no more nodes are found.

[0032] When performing type inference for the type of the calling node itself, special node type propagation needs to be handled, such as input tunnel nodes in a loop structure node. For input tunnel nodes, the conversion from array type or list type to element type needs to be handled. The specific process is as follows: when the current node is an input tunnel node, the data type of the input tunnel node is obtained, and it is checked whether it is an array type or list type. If it is, the data type of the downstream node is automatically inferred to the element type of the array or list, that is, a single element in the array or list, and array index access code is generated; if not, it is passed directly.

[0033] Furthermore, for tree structures, an inside-out type derivation (LRD) approach is proposed, employing a post-order traversal strategy to ensure that subgraphs are processed before parentgraphs, thereby updating the connection type of the control node's output ports, i.e., the type of the output boundary. Specifically, assuming the post-order traversal result of SortedTreeNodes is obtained, each graph name is traversed to obtain a Graph object. It is then determined whether the graph has a ControlNode. If so, the OutputPorts of the ControlNode are traversed, and each output port is traversed. If an output port exists, the Connections of the port are traversed, and the output port is determined to have a type. If a type exists, it is assigned to Connection.DataType.

[0034] When updating the connection type of the output port of the control node, special output ports need to be handled, such as output tunnel nodes in a loop structure. The type of the output tunnel node needs to be propagated back to the control node. Then, the input port of the output tunnel node is obtained, the corresponding tunnel exit node of the control node is found, and the tunnel exit node type of the control node is updated.

[0035] By integrating the above-mentioned outward-to-inward and inward-to-outward type deductions to form a complete bidirectional type deduction, this invention proposes a method for bidirectional data type deduction in graphical programming. It ensures the correctness of the deduction order through topological sorting and post-order traversal. Within a single graph, DAG topological sorting is used to determine the node processing order, ensuring that upstream nodes are processed first. Between graph trees, post-order traversal is used to determine the graph processing order, ensuring that subgraphs are processed first. This invention overcomes the limitations of traditional unidirectional type deduction, supports multiple structures such as multi-level nested loops, complex branches, and hybrid control, and achieves automatic mapping from array or list types of input tunnel nodes to element types, as well as backpropagation of data types of output tunnel nodes. It can automatically detect set types and extract element types, generating array index access code without requiring manual addition by the user.

[0036] like Figure 3 As shown, the method mainly includes the following steps S1-S4.

[0037] Step S1: Receive graphical programming data and parse the graphical programming data into graph structure and tree structure.

[0038] Step S2: Perform data type derivation from the outside in: Based on the tree structure, traverse each graph structure in depth-first order. For the currently traversed graph structure, traverse the internal nodes according to the topological order of the directed acyclic graph, and deduce the data type of the downstream node according to the data flow direction based on the data type of the upstream node.

[0039] In S2, the process of deriving the data type of the downstream node based on the data type of the upstream node mainly involves branching based on the node's own data type. The specific branching process is as follows: If the upstream node is a circular node, the data type of the downstream node will be automatically deduced based on the data type of the upstream node and the semantics of the circular structure. If the upstream node is another control structure node, the data type of the upstream node will be deduced to the downstream node according to the predefined type deduction rules; If the upstream node is a regular node, the data type of the upstream node will be directly passed to the downstream node.

[0040] When the upstream node is an input tunnel node with a loop structure, the input tunnel node is processed as follows: it is determined whether the data type is an array type or a list type; if so, the data type of the downstream node is automatically deduced to be the element type of the array or list, which is reflected in the code generation as code that accesses a single element of the array or list according to the loop iteration index; if not, the data type of the upstream node is directly passed to the data type of the downstream node.

[0041] Step S3: Perform data type derivation from the inside out: Based on the tree structure, traverse each graph structure in postorder. For the currently traversed graph structure, determine the data type of its output boundary based on the data type of its internal nodes, and propagate this data type back to the corresponding node in its parent graph.

[0042] In S3, when the current traversed graph structure is a subgraph corresponding to a cyclic structure, it is necessary to check the data type requirements of the corresponding receiving node in its parent graph. Based on the data type generated internally and the data type requirements, the data type of its output boundary is determined. The process is as follows: if the data type generated internally is a simple type and the data type of the corresponding receiving node in the parent graph is a set type, then the data type of its output boundary is deduced to be a list type with that simple type as its element. In code generation, this is reflected in the generation of code that creates a cached list, appends data in each loop iteration, and outputs the complete list after the loop ends; otherwise, the data type generated internally is directly determined as the data type of its output boundary.

[0043] Step S4: Automatically generate type conversion code based on predefined data type processing rules.

[0044] The process of automatically generating type conversion code based on predefined data type handling rules is as follows: Obtain predefined numeric type priority rules and display type conversion rules; wherein, the numeric types include integer type, floating-point type and high-precision type; Detect all data connections. When the data types at both ends of the connection do not match, determine whether a display conversion is needed based on the display type conversion rules. If so, generate the corresponding code.

[0045] The numeric type priority rule determines the output type of multiple input nodes by defining the priority of numeric types. The display type conversion rule determines whether a display conversion is required by defining the mapping relationship between different types that need to be displayed, such as the display conversion target for signed integer types, the display conversion target for unsigned integer types, and the display conversion target for floating-point types.

[0046] Using the above method, the process of deriving bidirectional data types based on a two-layer graph tree structure includes the following three stages: Phase 1: DFS deduces the main graph; at this point, the input is the main graph containing the ForLoop, and the deduced array input node type is Double[]; the deduced ForLoop node count port type is Int32, i.e., the element type, and this type is passed to the tunnel entrance; Phase 2: DFS derivation of the subgraph; At this stage, the TunnelEnterNode is derived. First, it checks whether the input is a set type, which is either an array type or a list type. If it is Double[], i.e., a set type, then the element type is Double, and a single element is extracted from the set data. Then, the output port is set to Double[], the connection type is set to Double, and array[i], i.e., the index code, is generated. If it is not Double[], the type is passed directly. Then, the iterator node type is derived as Int32. Then, the operator node type is derived as Double. Then, the TunnelLeaveNode input type is derived as Double. Phase 3: LRD reverse derivation; at this point, post-order traversal is used: first process the subgraph; for the subgraph, first obtain the tunnel exit type: Double; then, update the corresponding output port of ControlNode: Double; then, post-order traversal is used again: process the main graph again; update the output connection type of ForLoop to: Double.

[0047] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Based on the technical essence of the present invention, any simple modifications, equivalent substitutions, and improvements made to the above embodiments within the spirit and principles of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method of bidirectional data type derivation in graphical programming, characterized in that, The method comprises the following steps: S1, receiving graphical programming data, and parsing the graphical programming data into a graph structure and a tree structure; The graph structure is a directed acyclic graph constructed according to each independently executable logic block in the graphical programming data, and the data flow direction inside the logic block is described through the connection relationship between the nodes in the directed acyclic graph; The tree structure describes the hierarchical nesting relationship between all graph structures, wherein each tree node uniquely corresponds to a graph structure, the graph structure corresponding to a tree node at an upper layer is referred to as a parent graph, and the graph structure corresponding to a tree node at a lower layer is referred to as a child graph; S2, performing data type deduction from outside to inside: based on the tree structure, traversing each graph structure in a depth-first order, for a currently traversed graph structure, traversing the internal nodes in a topological order of the directed acyclic graph, and according to the data flow direction, deducing the data type of a downstream node according to the data type of an upstream node; S3, performing data type deduction from inside to outside: based on the tree structure, traversing each graph structure in a postorder, for a currently traversed graph structure, determining the data type of an output boundary according to the data types of the internal nodes, and reversely propagating the data type to the corresponding node in the parent graph; S4, automatically generating type conversion code according to a predefined data type processing rule.

2. The method for bidirectional data type derivation in graphical programming of claim 1, wherein, In S2, the process of deducing the data type of a downstream node according to the data type of an upstream node is specifically: performing branch processing according to the type of the upstream node; if the upstream node is a loop structure node, automatically deducing the data type of the downstream node according to the data type of the upstream node and the semantics of the loop structure; if the upstream node is another control structure node, deducing the data type of the downstream node from the data type of the upstream node according to a predefined type deduction rule; if the upstream node is a normal node, directly transmitting the data type of the upstream node to the downstream node.

3. The method for bidirectional data type derivation in graphical programming of claim 2, wherein, When the upstream node is an input tunnel node of a loop structure, the process of automatically deducing the data type of the downstream node according to the data type of the upstream node and the semantics of the loop structure is specifically: determining whether the data type is an array type or a list type; if yes, automatically deducing the data type of the downstream node as the element type of the array or list; and if no, directly transmitting the data type of the upstream node to the data type of the downstream node.

4. The method for bidirectional data type derivation in graphical programming of claim 3, wherein, Automatically deducing the data type of the downstream node as the element type of the array or list, which is embodied as a code for accessing a single element in the array or list according to a loop iteration index when code is generated.

5. The method for bidirectional data type deduction in graphical programming of claim 1, wherein, In S3, when the currently traversed graph structure is a loop structure corresponding child graph, the process of determining the data type of the output boundary according to the data types of the internal nodes is: detecting the data type requirement of a corresponding receiving node in the parent graph, and determining the data type of the output boundary according to the generated data type and the data type requirement.

6. The method for bidirectional data type deduction in graphical programming of claim 5, wherein, The process of determining the data type of the output boundary is specifically: When the internally generated data type is a simple type and the data type of the corresponding receiving node in the parent graph is a collection type, the data type of the output boundary of the node is derived as a list type with the simple type as the element; otherwise, the internally generated data type is directly determined as the data type of the output boundary of the node.

7. The method for bidirectional data type deduction in graphical programming of claim 6, wherein, The data type of the output boundary of the node is derived as a list type with the simple type as the element, which is embodied in code generation as generating code for creating a cache list, appending data in each loop iteration, and outputting the complete list after the loop ends.

8. The method for bidirectional data type deduction in graphical programming of claim 1, wherein, The process of automatically generating type conversion code according to the predefined data type processing rules is as follows: Obtain predefined numerical type priority rules and display type conversion rules; wherein the numerical types include integer types, floating point types and high precision types; Detect all data connections, and when the data types at both ends of the connection do not match, determine whether display conversion is needed according to the display type conversion rules, and if so, generate the corresponding code.

9. A system for bidirectional data type inference in graphical programming, characterized in that, The application of the method for bidirectional data type derivation in graphical programming according to any one of claims 1-8 comprises: a graph structure analysis module: receiving graphical programming data and analyzing the graphical programming data into a graph structure and a tree structure; the graph structure is a directed acyclic graph constructed according to each independently executable logic block in the graphical programming data, and the data flow within the logic block is described by the connection relationship between the nodes in the directed acyclic graph; the tree structure describes the hierarchical nesting relationship between all graph structures, wherein each tree node uniquely corresponds to a graph structure, the graph structure corresponding to the tree node at the upper layer is called the parent graph, and the graph structure corresponding to the tree node at the lower layer is called the child graph; an outside-in data type derivation module: based on the tree structure, traversing each graph structure in depth-first order, for the currently traversed graph structure, traversing the internal nodes according to the topological order of the directed acyclic graph, and according to the data flow, deriving the data type of the downstream node according to the data type of the upstream node; an inside-out data type derivation module: based on the tree structure, traversing each graph structure in postorder, for the currently traversed graph structure, determining the data type of the output boundary according to the data types of the internal nodes, and propagating the data type to the corresponding node in the parent graph in reverse; a display type conversion module: automatically generating type conversion code according to predefined data type processing rules.

Citation Information

Patent Citations

  • Multi-script execution method of virtual controller

    CN119356817A

  • Model node execution sequence optimization method and electronic equipment

    CN121166298A

  • Storage structure for pattern mining

    US11531527B1