Data flow graph layout method and device

By calculating the node density in the data flow graph and adjusting the node position, the problem of slow convergence speed in complex network structures is solved, and the layout efficiency and readability of the data flow graph are improved.

CN113297262BActive Publication Date: 2024-11-26AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110676872.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-18
Publication Date
2024-11-26
Estimated Expiration
2041-06-18

AI Technical Summary

Technical Problem

The existing data flow graph layout method has a low convergence speed in complex network structures, resulting in low layout efficiency and poor readability.

Method used

By constructing each path of the data flow graph, calculate the node density of any two adjacent nodes, and adjust the node position according to the node density, and adjust the node position on the target path to improve layout efficiency and readability.

Benefits of technology

It improves the layout efficiency of data flow graphs, maintains network structure and data flow direction, enhances readability, and improves the utilization, flexibility and configuration flexibility of canvas resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113297262B_ABST
    Figure CN113297262B_ABST
Patent Text Reader

Abstract

The present disclosure provides a layout method and device for a data flow graph, comprising: constructing each target path from the start node to the end node of the data flow graph according to each node in the data flow graph, calculating the node density of each node in the two adjacent nodes for two adjacent nodes on any target path, and determining the moving distance according to the node density of each node in the two adjacent nodes, wherein the moving distance is used to indicate that the position of any node in the two adjacent nodes is adjusted on the target path where the two adjacent nodes are located, and adjusting the position of any node in the adjacent nodes according to the moving distance, thereby avoiding the technical problem of low convergence speed caused by the data dimensionality reduction layout method used in the related technology, achieving the technical effect that the data flow graph can maintain the basic network structure and data flow direction, and can avoid intersection as much as possible, thereby improving the readability of the data flow graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the computer field, and in particular, to a method and device for laying out a data flow graph. Background Art

[0002] A Data Flow Diagram (DFD) is a topological diagram that can be quickly constructed by dragging and dropping graphics.

[0003] When constructing a data flow graph, it often involves drawing a large number of nodes and edges. The location information of the nodes and the dragging of the edges will affect the structure of the entire data flow graph. In the prior art, the commonly used canvas layout method for data flow graphs is the data dimensionality reduction layout method, such as mapping the high-dimensional data of the data flow graph to a low-dimensional space and clustering the data into clusters for layout.

[0004] However, the data dimension reduction layout method is usually used for data flow graphs with complex network structures. When the network structure is complex, the data flow graph has more nodes and the convergence speed is low. Summary of the invention

[0005] The disclosed embodiments provide a data flow graph layout method and device to solve the problem of low convergence speed in related art summary.

[0006] In a first aspect, an embodiment of the present disclosure provides a data flow graph layout method, including:

[0007] According to each node in the data flow graph, construct each target path from the starting node to the ending node of the data flow graph;

[0008] For two adjacent nodes on any target path, the node density of each of the two adjacent nodes is calculated, and a moving distance is determined according to the node density of each of the two adjacent nodes, wherein the moving distance is used to indicate adjusting the position of any node of the two adjacent nodes on the target path where the two adjacent nodes are located;

[0009] The position of any node among the adjacent nodes is adjusted according to the moving distance.

[0010] In some embodiments, for two adjacent nodes on any target path, calculating the node density of each of the two adjacent nodes includes:

[0011] Determine the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and determine the position of each node on the target path where the two adjacent nodes are located;

[0012] The node density of any one of the two adjacent nodes is calculated based on the out-degree and in-degree of any one of the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located.

[0013] In some embodiments, the node density of any one of the two adjacent nodes is calculated based on the out-degree and in-degree of any one of the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located, including:

[0014] Determine the total number of out-degrees and in-degrees of each node on the target path where the two adjacent nodes are located;

[0015] Determine, according to the positions of the nodes on the target path where the two adjacent nodes are located, an average distance between the nodes on the target path where the two adjacent nodes are located, and determine a relative distance between the two adjacent nodes;

[0016] The node density of any node among the two adjacent nodes is calculated according to the out-degree and in-degree of any node among the two adjacent nodes, the total number of out-degrees and in-degrees of each node, the average distance, and the relative distance.

[0017] In some embodiments, determining the moving distance according to the node density of each of the two adjacent nodes includes:

[0018] The attraction and repulsion between the two adjacent nodes are determined according to the node density of each node in the two adjacent nodes, and the moving distance is determined according to the attraction and repulsion.

[0019] In some embodiments, determining the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes includes:

[0020] The relative distance between the two adjacent nodes is determined, and the attraction and the repulsion are determined according to the node density and the relative distance of each of the two adjacent nodes.

[0021] In some embodiments, it also includes:

[0022] Obtaining the coordinates of a cursor on a canvas for drawing a node of the data flow graph, and determining the coordinates of a preset corner point of the canvas;

[0023] The range of the canvas is adjusted according to the coordinates of the cursor and the coordinates of the preset corner point.

[0024] In some embodiments, adjusting the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point includes:

[0025] Determining the right edge of the canvas according to the coordinates of the preset corner point and the preset width of the canvas;

[0026] If the coordinates of the cursor are outside the right border of the canvas, the width of the canvas is adjusted.

[0027] In some embodiments, adjusting the width of the canvas includes:

[0028] The adjusted width of the canvas is determined according to the coordinates of the cursor, the coordinates of the preset corner points, and the width of the preset nodes.

[0029] In some embodiments, the coordinates of the cursor include the horizontal coordinate of the cursor, and the coordinates of the preset corner point include the horizontal coordinate of the preset corner point; the method further includes:

[0030] The difference between the horizontal coordinate of the cursor and the horizontal coordinate of the preset corner point is used as the horizontal coordinate of the node corresponding to the cursor.

[0031] In some embodiments, adjusting the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point includes:

[0032] Determining the lower boundary of the canvas according to the coordinates of the preset corner points and the preset height of the canvas;

[0033] If the coordinates of the cursor are outside the lower boundary of the canvas, the height of the canvas is adjusted.

[0034] In some embodiments, adjusting the height of the canvas includes:

[0035] The adjusted height of the canvas is determined according to the coordinates of the cursor, the coordinates of the preset corner points, and the heights of the preset nodes.

[0036] In some embodiments, according to each node in the data flow graph, constructing each target path from the start node to the end node of the data flow graph includes:

[0037] Determine the next node connected to the starting node, and determine the next node connected to the next node, and so on, until the next node is the ending node, to obtain multiple initial paths;

[0038] For any initial path, the center of gravity position of the arbitrary initial path is determined according to the position information of each node in the arbitrary initial path, and the target path corresponding to the arbitrary initial path is determined according to the center of gravity position of the arbitrary initial path.

[0039] In a second aspect, an embodiment of the present disclosure provides a data flow graph layout device, including:

[0040] A construction unit, configured to construct each target path from a start node to an end node of the data flow graph according to each node in the data flow graph;

[0041] A calculation unit, configured to calculate the node density of each of two adjacent nodes on any target path;

[0042] A first determining unit, configured to determine a moving distance according to a node density of each of the two adjacent nodes, wherein the moving distance is used to indicate adjusting a position of any node of the two adjacent nodes on a target path where the two adjacent nodes are located;

[0043] The first adjustment unit is used to adjust the position of any node among the adjacent nodes according to the moving distance.

[0044] In some embodiments, the computing unit comprises:

[0045] A first determination subunit is used to determine the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and determine the position of each node on the target path where the two adjacent nodes are located;

[0046] A calculation subunit is used to calculate the node density of any node among the two adjacent nodes based on the out-degree and in-degree of any node among the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located.

[0047] In some embodiments, the calculation subunit is used to determine the total number of out-degrees and in-degrees of each node on the target path where the two adjacent nodes are located;

[0048] Determine, according to the positions of the nodes on the target path where the two adjacent nodes are located, an average distance between the nodes on the target path where the two adjacent nodes are located, and determine a relative distance between the two adjacent nodes;

[0049] The node density of any node among the two adjacent nodes is calculated according to the out-degree and in-degree of any node among the two adjacent nodes, the total number of out-degrees and in-degrees of each node, the average distance, and the relative distance.

[0050] In some embodiments, the first determining unit is used to determine the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes, and determine the moving distance according to the attraction and repulsion.

[0051] In some embodiments, the first determining unit is used to determine the relative distance between the two adjacent nodes, and determine the attractive force and the repulsive force respectively according to the node density and the relative distance of each of the two adjacent nodes.

[0052] In some embodiments, it also includes:

[0053] An acquisition unit, used to acquire the coordinates of a cursor on a canvas for drawing a node of the data flow graph;

[0054] A second determining unit, used to determine the coordinates of a preset corner point of the canvas;

[0055] The second adjustment unit is used to adjust the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point.

[0056] In some embodiments, the second adjustment unit includes:

[0057] A second determining subunit, configured to determine a right edge of the canvas according to the coordinates of the preset corner point and a preset width of the canvas;

[0058] The adjusting subunit is used to adjust the width of the canvas if the coordinates of the cursor are outside the right border of the canvas.

[0059] In some embodiments, the adjustment subunit is used to determine the adjusted width of the canvas according to the coordinates of the cursor, the coordinates of the preset corner points, and the width of the preset nodes.

[0060] In some embodiments, the second adjustment unit further includes:

[0061] The third determining subunit is used to use the difference between the horizontal coordinate of the cursor and the horizontal coordinate of the preset corner point as the horizontal coordinate of the node corresponding to the cursor.

[0062] In some embodiments, in some embodiments, the second adjustment unit includes:

[0063] A second determining subunit, configured to determine a lower boundary of the canvas according to the coordinates of the preset corner point and a preset height of the canvas;

[0064] The adjusting subunit is used to adjust the height of the canvas if the coordinates of the cursor are outside the lower boundary of the canvas.

[0065] In some embodiments, the adjustment subunit is used to determine the adjusted height of the canvas according to the coordinates of the cursor, the coordinates of the preset corner point, and the height of the preset node.

[0066] In some embodiments, the building block comprises:

[0067] A fourth determination subunit is used to determine the next node connected to the starting node, and determine the next node connected to the next node, and so on, until the next node is the ending node, to obtain multiple initial paths;

[0068] The fifth determination subunit is used to determine the center of gravity position of any initial path according to the position information of each node in the arbitrary initial path, and determine the target path corresponding to the arbitrary initial path according to the center of gravity position of the arbitrary initial path.

[0069] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including: a memory, a processor;

[0070] Memory; Memory for storing instructions executable by the processor;

[0071] The processor is configured to execute the method as described in the first aspect.

[0072] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0073] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0075] Figure 1 A schematic diagram of a data flow graph layout method according to an embodiment of the present disclosure;

[0076] Figure 2 A schematic diagram of a data flow graph layout method according to another embodiment of the present disclosure;

[0077] Figure 3 A schematic diagram of nodes of a data flow graph disclosed herein;

[0078] Figure 4 A schematic diagram of a target path of a data flow graph disclosed herein;

[0079] Figure 5 A schematic diagram of a data flow graph layout device according to an embodiment of the present disclosure;

[0080] Figure 6 A schematic diagram of a data flow graph layout device according to another embodiment of the present disclosure;

[0081] Figure 7 A block diagram of an electronic device for the data flow graph layout method of an embodiment of the present disclosure.

[0082] The above drawings have shown clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0083] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0084] The nouns involved in the embodiments of the present disclosure are explained as follows:

[0085] Data flow diagram: refers to the graphical expression of the system's logical functions, the logical flow of data within the system, and the logical transformation process from the perspective of data transmission and processing. It is the main expression tool of structured system analysis methods and a graphical method for representing software models.

[0086] Node density: refers to the density of nodes in a path (such as the target path in the present disclosure).

[0087] The out-degree of a node refers to the number of edges that depart from the node.

[0088] The in-degree of a node refers to the number of edges pointing to the node from other nodes.

[0089] Canvas: Generally refers to the drawing area, here it refers to the drawing area of ​​the data flow diagram.

[0090] Combined with the above description, we can know that the data flow diagram refers to a graphical expression of the logical functions of the system, the logical flow of data within the system and the logical transformation process from the perspective of data transmission and processing. It is the main expression tool of the structured system analysis method and a graphical method for representing software models.

[0091] Among them, a data flow graph is a topological structure graph that can be quickly constructed by dragging and dropping graphics. When constructing a data flow graph, it often involves drawing a large number of nodes and edges. The location information of the nodes and the dragging of the edges will affect the structure of the entire data flow graph.

[0092] For example, in an auditing business scenario, users (such as staff) often need to use a tool that uses graphical dragging to quickly build models. This tool uses auditing accounts and tables and data set (such as Spark) operators as nodes for modeling and analysis, and uses the flow of data as edges to construct a data processing process. This visual data flow constructed based on the business scenario is a data flow graph.

[0093] In the process of drawing a data flow diagram, the dragging and placement of nodes are often arbitrary. When the amount of data is large, that is, there are a large number of nodes, the structure of the data flow diagram is very complex, which will cause technical problems such as chaotic layout of the data flow diagram and poor readability of the data flow diagram.

[0094] In the prior art, a commonly used canvas layout method for a data flow graph is a data dimensionality reduction layout method, such as mapping the high-dimensional data of the data flow graph to a low-dimensional space and clustering the data into clusters for layout.

[0095] Exemplarily, the data dimension reduction layout method can be implemented by using different data dimension reduction algorithms, which may include principal component analysis, isometric mapping, local linear embedding and unsupervised learning (t-distributed stochastic neighbor embedding, t-SNE) algorithm, etc.

[0096] These algorithms are generally used for data visualization in complex network structures, by mapping high-dimensional data to low-dimensional space and clustering the data into clusters for display. Among them, principal component analysis is rarely used because it cannot solve the linear inseparability problem, while the t-SNE algorithm is widely used in data visualization analysis of complex networks.

[0097] However, the data dimension reduction layout method is usually used for data flow graphs with complex network structures. When the network structure is complex, the data flow graph has more nodes and the convergence speed is low.

[0098] In order to solve at least one of the above-mentioned technical problems, the inventors of the present disclosure, through creative work, obtained the inventive concept of the present disclosure: construct each path of the data flow graph, for each path, calculate the node density of each node in any two adjacent nodes in the path, and determine the moving distance of the adjustment node according to the two node densities, so as to adjust the position of the node based on the moving distance.

[0099] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0100] See also Figure 1 , Figure 1 A schematic diagram of a data flow graph layout method according to an embodiment of the present disclosure.

[0101] like Figure 1 As shown, the method includes:

[0102] S101: According to each node in the data flow graph, construct each target path from the start node to the end node of the data flow graph.

[0103] Exemplarily, the execution subject of this embodiment can be a layout device of the data flow graph (hereinafter referred to as the layout device), and the layout device can be a server, a terminal device, a processor, a chip, etc., which is not limited in this embodiment.

[0104] It should be understood that the “target” in the target path is used to distinguish it from the initial path in the following text, and should not be understood as a limitation of the target path.

[0105] The data flow graph includes multiple nodes, and generally includes a starting node and an ending node. This step can be understood as: the layout device determines multiple target paths based on each node, each target path starts from the starting node and ends at the ending node, and includes at least one node between the starting point and the end point (that is, a node other than the starting node and the ending node).

[0106] S102: For two adjacent nodes on any target path, the node density of each of the two adjacent nodes is calculated, and the moving distance is determined according to the node density of each of the two adjacent nodes.

[0107] The moving distance is used to indicate adjusting the position of any node between two adjacent nodes on the target path where the two adjacent nodes are located.

[0108] Exemplarily, if the first node and the second node are two adjacent nodes on a target path, the layout device may calculate the node density of the first node and the node density of the second node, so as to determine the moving distance based on the node density of the first node and the node density of the second node.

[0109] S103: Adjust the position of any node among the adjacent nodes according to the moving distance.

[0110] In combination with the above analysis, the layout device can adjust the position of the first node on the target path to which the first node belongs according to the moving distance; and / or, the layout device can adjust the position of the second node on the target path to which the second node belongs according to the moving distance.

[0111] Based on the above analysis, it can be known that an embodiment of the present disclosure provides a layout method for a data flow graph, including: constructing each target path from the start node to the end node of the data flow graph according to each node in the data flow graph, calculating the node density of each node in the two adjacent nodes for two adjacent nodes on any target path, and determining the moving distance according to the node density of each node in the two adjacent nodes, wherein the moving distance is used to indicate that on the target path where the two adjacent nodes are located, the position of any node in the two adjacent nodes is adjusted, and the position of any node in the adjacent nodes is adjusted according to the moving distance. In this embodiment, the following is introduced: constructing each target path of the data flow graph, calculating the node density of each node in the two adjacent nodes on any target path, and determining the moving distance based on the node density of each node in the two adjacent nodes, so as to The feature of adjusting the position of any node between two adjacent nodes on any target path based on the moving distance, on the one hand, avoids the technical problem of low convergence speed caused by the data dimensionality reduction layout method adopted in the related technology, and improves the efficiency of data flow graph layout; on the other hand, by adjusting the position of the node within any target path, the data flow graph can maintain the basic network structure and data flow direction while avoiding intersection as much as possible, thereby improving the readability of the data flow graph; on the other hand, by adjusting the position of any node between two adjacent nodes on any target path based on the moving distance, the nodes between each target path can be made more discrete, while the nodes within the target path can be more clustered, thereby improving the utilization rate of canvas resources and further improving the readability of the data flow graph; on the other hand, there is no need for the user to set the initial node for layout, thereby improving the flexibility of the configuration of the data flow graph.

[0112] See also Figure 2 , Figure 2 A schematic diagram of a data flow graph layout method according to another embodiment of the present disclosure.

[0113] like Figure 2 As shown, the method includes:

[0114] S201: Obtain the coordinates of the cursor on the canvas for drawing the nodes of the data flow graph, and determine the coordinates of the preset corner points of the canvas.

[0115] In this embodiment, the nodes in the data flow graph can be laid out using absolute positioning CSS. Absolute positioning makes the position of each node in the data flow graph independent of the document flow, the horizontal coordinate of the node is the horizontal distance of the upper left corner of the node relative to the upper left corner of the canvas, and the vertical coordinate of the node is the vertical distance of the upper left corner of the node relative to the upper left corner of the canvas.

[0116] Exemplarily, when a user (such as a staff member, i.e., a staff member who draws a data flow diagram) drags a node, the cursor is placed on the node to be dragged, and the mouse is released when the dragging is finished. The coordinates of the cursor of the node at this time are recorded, which are the coordinates (x, y) of the cursor in the Cartesian coordinate system.

[0117] The coordinates of the preset corner point refer to the coordinates (x', y') of the upper left corner of the canvas in the Cartesian coordinate system.

[0118] Specifically, x is the horizontal distance of the node's cursor relative to the origin of the coordinate system (i.e., the canvas coordinate system), y is the vertical distance of the node's cursor relative to the origin of the coordinate system, x' is the horizontal distance of the upper left corner of the canvas relative to the origin of the coordinate system, and y' is the vertical distance of the upper left corner of the canvas relative to the origin of the coordinate system.

[0119] Among them, the Cartesian coordinate system is also called the rectangular coordinate system, which is an orthogonal coordinate system. There is also a corresponding coordinate system in the web page. In the Cartesian coordinate system, the origin is located in the upper left corner of the object (such as the browser) that displays the Cartesian coordinate system. The entire browser screen is the first quadrant, and only positive values ​​are displayed, and negative values ​​are hidden. This is true for both plane coordinates and three-dimensional coordinates, except that since the browser screen is a plane, the Z axis in the three-dimensional coordinates runs through the browser.

[0120] S202: Adjusting the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner points.

[0121] In combination with the above example, when the coordinates (x, y) of the cursor and the coordinates (x', y') of the preset corner point are determined, the range of the canvas can be adjusted based on the coordinates (x, y) of the cursor and the coordinates (x', y') of the preset corner point.

[0122] It is worth mentioning that in the related art, the user displays the canvas through the zoom function. This method cannot solve the problem of insufficient canvas size. Reducing the size of the node to achieve zoom layout and display the topology diagram easily leads to unreadable node information, and due to the small canvas, all nodes cannot be laid out, and some nodes cannot be laid out. In this embodiment, by combining the node in the dragging process, the range of the canvas is adaptively and dynamically adjusted, which can avoid the above-mentioned technical problems caused by zooming in the related art, improve the flexibility and diversity of the layout of the data flow graph, and improve the integrity and readability of the data flow graph.

[0123] In some embodiments, S202 may include the following steps:

[0124] Step 1: Determine the right edge of the canvas based on the coordinates of the preset corner points and the preset width of the canvas.

[0125] Second step: If the cursor coordinates are outside the right border of the canvas, adjust the width of the canvas.

[0126] Exemplarily, the coordinates of the preset corner point include a horizontal coordinate of the preset corner point and a vertical coordinate of the preset corner point, and the right boundary of the canvas is determined based on the horizontal coordinate of the preset corner point and a preset width of the canvas.

[0127] For example, the right edge of the canvas = the horizontal coordinate of the preset corner point + the preset width of the canvas. If the preset width of the canvas is w canvas , then the right edge of the canvas = x'+w canvas .

[0128] After determining the right border of the canvas, the layout device can determine whether the coordinates of the cursor are outside the right border of the canvas, that is, whether the coordinates of the cursor exceed the right border of the canvas. If the coordinates of the cursor have exceeded the right border of the canvas, the width of the canvas is adjusted.

[0129] For example, if x>x'+w canvas , it means that the coordinates of the cursor have exceeded the right border of the canvas, so the width of the canvas is increased, thereby achieving adaptive adjustment of the canvas and improving the accuracy and reliability of the data flow graph layout.

[0130] In some embodiments, the second step may include: determining the adjusted width of the canvas according to the coordinates of the cursor, the coordinates of the preset corner points, and the widths of the preset nodes.

[0131] For example, the width of a node is w node , the adjusted width of the canvas w" = x-x' + w node .

[0132] It is worth noting that, in this embodiment, by determining the adjusted width of the canvas based on the coordinates of the cursor, the coordinates of the preset corner points, and the width of the preset nodes, the adjusted width of the canvas can be highly aligned with the nodes of the data flow graph, thereby avoiding the waste of resources caused by excessively increasing the width of the canvas and improving the technical effect of the applicability and accuracy of the adjusted width of the canvas.

[0133] In some embodiments, the coordinates of the cursor include the horizontal coordinate of the cursor, and the coordinates of the preset corner point include the horizontal coordinate of the preset corner point. The difference between the horizontal coordinate of the cursor and the horizontal coordinate of the preset corner point can be used as the horizontal coordinate of the node corresponding to the cursor.

[0134] Exemplarily, the horizontal coordinate of the node is left=x-x'.

[0135] In some other embodiments, if the cursor coordinates exceed the left border of the canvas but do not exceed the right border of the canvas, that is, x'<x<x'+w canvas , there is no need to adjust the width of the canvas, that is, the width of the canvas remains w canvas , and the horizontal coordinate of the node is left = x-x'.

[0136] In some other embodiments, if the cursor coordinates do not exceed the left border of the canvas, that is, x<x', there is no need to adjust the width of the canvas, that is, the width of the canvas is still w canvas , and the horizontal coordinate of the node is left=0.

[0137] Based on the above analysis, it can be known that the layout device can adjust the width of the canvas. In other embodiments, the layout device can also adjust the height of the canvas. The adjustment of the height of the canvas by the layout device can include the following steps:

[0138] Step 1: Determine the lower boundary of the canvas according to the coordinates of the preset corner points and the preset height of the canvas.

[0139] Step 2: If the cursor coordinates are outside the lower border of the canvas, adjust the height of the canvas.

[0140] Exemplarily, the coordinates of the preset corner point include a horizontal coordinate of the preset corner point and a vertical coordinate of the preset corner point, and the right boundary of the canvas is determined based on the vertical coordinate of the preset corner point and a preset height of the canvas.

[0141] For example, the bottom edge of the canvas = the vertical coordinate of the preset corner point + the preset height of the canvas. If the preset width of the canvas is h canvas , then the lower boundary of the canvas = y'+h canvas .

[0142] After determining the lower boundary of the canvas, the layout device can determine whether the coordinates of the cursor are outside the lower boundary of the canvas, that is, whether the coordinates of the cursor exceed the lower boundary of the canvas. If the coordinates of the cursor have exceeded the lower boundary of the canvas, the height of the canvas is adjusted.

[0143] Similarly, if y>y'+h canvas , it means that the cursor coordinates have exceeded the lower boundary of the canvas, so the height of the canvas is increased, thereby achieving adaptive adjustment of the canvas and improving the accuracy and reliability of the data flow graph layout.

[0144] In some embodiments, the second step may include: determining the adjusted height of the canvas according to the coordinates of the cursor, the coordinates of the preset corner points, and the heights of the preset nodes.

[0145] For example, the height of the node is h node , the adjusted height of the canvas h" = y-y' + h node .

[0146] Similarly, in this embodiment, by determining the adjusted height of the canvas based on the coordinates of the cursor, the coordinates of the preset corner points, and the height of the preset nodes, the adjusted height of the canvas can be highly aligned with the nodes of the data flow graph, thereby avoiding the waste of resources caused by excessively increasing the height of the canvas and improving the technical effect of the applicability and accuracy of the adjusted height of the canvas.

[0147] In some embodiments, the coordinates of the cursor include the ordinate of the cursor, the coordinates of the preset corner point include the ordinate of the preset corner point, and the difference between the ordinate of the cursor and the ordinate of the preset corner point can be used as the ordinate of the node corresponding to the cursor.

[0148] Exemplarily, the vertical coordinate of the node top=y-y'.

[0149] In some other embodiments, if the cursor coordinates exceed the upper boundary of the canvas but do not exceed the lower boundary of the canvas, that is, y'<y<y'+h canvas , there is no need to adjust the height of the canvas, that is, the height of the canvas is still h canvas , and the horizontal coordinate of the node top = y-y'.

[0150] In other embodiments, if the cursor coordinates do not exceed the upper boundary of the canvas, that is, y<y', there is no need to adjust the height of the canvas, that is, the width of the canvas is still h. canvas , and the horizontal coordinate of the node top = 0.

[0151] Combined with the above analysis, it can be seen that in this embodiment, each node is marked with a relative position to the canvas and a two-tuple recording the horizontal and vertical coordinates, so that each target path is saved as a complete vector. This representation method records the data flow direction in the data flow graph, which can ensure the technical effect that the data flow direction of the data flow graph remains unchanged.

[0152] S203: Determine the next node connected to the start node, and determine the next node connected to the next node, and so on, until the next node is the end node, and obtain multiple initial paths.

[0153] S204: for any initial path, determine the centroid position of any initial path according to the position information of each node in the any initial path, and determine the target path corresponding to the any initial path according to the centroid position of the any initial path.

[0154] After each node in the data flow graph is drawn based on the method from S201 to S202, multiple target paths of the data flow graph can be determined.

[0155] For example, if the relative position (left, top) of each node in the data flow graph to the canvas and the position sequence are [(left1, top1), (left2, top2), ..., (left n ,top n )].

[0156] like Figure 3 As shown, the data flow graph includes 9 nodes, the starting node is (left0, top0), and the ending node is (left n ,top n ), the start node and the end node are common nodes, that is, each initial path or target path includes a start node and an end node.

[0157] In such Figure 3 In the data flow diagram shown, there are 4 initial paths, namely:

[0158] Initial path 1: start node → process node 1 → process node 3 → process node 7 → end node, expressed by position:

[0159] [(left0,top0),(left1,top1),(left3,top3),(left7,top7),(left n ,top n )];

[0160] Initial path 2: start node → process node 2 → process node 7 → end node, expressed by position:

[0161] [(left0,top0),(left2,top2),(left7,top7),(left n ,top n )];

[0162] Initial path 3: start node → process node 5 → process node 7 → end node, expressed by position:

[0163] [(left0,top0),(left5,top5),(left7,top7),(left n ,top n )];

[0164] Initial path 4: start node → process node 4 → process node 6 → process node 7 → end node, expressed by position:

[0165] [(left0,top0),(left1,top1),(left4,top4),(left6,top6),(left7,top7),(left n ,top n )].

[0166] For any initial path, calculate the reposition of any initial path to obtain the target path, where the center position

[0167] Where m represents the number of nodes in any initial path.

[0168] For example, Figure 3 The corresponding target path can be found in Figure 4 .

[0169] In some embodiments, after determining the center of gravity position of any initial path, the arbitrary initial path can be sorted according to the center of gravity position, and the nodes on the arbitrary initial path can be top-aligned with the center of gravity position as a reference (left, top) according to the high and low sorting, so as to obtain the target path corresponding to the arbitrary initial path.

[0170] It is worth noting that if a node belongs to a different initial path, only the first top alignment is performed on the node.

[0171] It is worth noting that, in the present embodiment, by starting from the starting node and sequentially connecting the next node until the ending node, a plurality of initial paths are obtained, and the center of gravity position is determined on this basis, so that the top alignment processing is performed on each node in each initial path based on the center of gravity position, so as to obtain the target path, and the technical effect of obtaining the accuracy and reliability of the target path can be achieved, and by converting each node into a node within the cluster (a target path is equivalent to a cluster), so that the layout of the data flow graph can be realized based on the subsequent adjustment of each node within the cluster, the technical effect of improving the flexibility and reliability of the data flow graph layout can be achieved.

[0172] S205: For two adjacent nodes on any target path, the node density of each of the two adjacent nodes is calculated, and the moving distance is determined according to the node density of each of the two adjacent nodes.

[0173] The moving distance is used to indicate adjusting the position of any node between two adjacent nodes on the target path where the two adjacent nodes are located.

[0174] For example, the description of S205 may refer to the previous embodiment, which will not be repeated here.

[0175] In some embodiments, for two adjacent nodes on any target path, calculating the node density of each of the two adjacent nodes includes the following steps:

[0176] The first step is to determine the out-degree and in-degree of each node on the target path where two adjacent nodes are located, and determine the position of each node on the target path where two adjacent nodes are located.

[0177] The second step: Calculate the node density of any node between two adjacent nodes based on the out-degree and in-degree of any node between two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located.

[0178] For example, if a target path includes a total of n nodes, and one of the two adjacent nodes is the first node, the node density of the first node can be determined based on the out-degree and in-degree of the first node, the out-degree and in-degree of each of the n nodes, and the position of each of the n nodes.

[0179] Accordingly, the node density of the first node may be determined according to the in-degree and out-degree of the second node, the in-degree and out-degree of each of the n nodes, and the position of each of the n nodes.

[0180] It is worth noting that, in this embodiment, by determining the node density of each node in the two adjacent nodes based on the out-degree and in-degree of each node on the target path where the two adjacent nodes are located and the position of each node on the target path where the two adjacent nodes are located, the node density of the node can be highly correlated with the target path where the node is located, thereby achieving the technical effect of higher reliability and accuracy of the node density.

[0181] In some embodiments, the second step may include the following sub-steps:

[0182] The first sub-step: determine the total number of out-degrees and in-degrees of each node on the target path where two adjacent nodes are located.

[0183] Second sub-step: according to the positions of the nodes on the target path where the two adjacent nodes are located, determine the average distance between the nodes on the target path where the two adjacent nodes are located, and determine the relative distance between the two adjacent nodes.

[0184] The third sub-step: Calculate the node density of any node between two adjacent nodes according to the out-degree and in-degree of any node between two adjacent nodes, the total number of out-degree and in-degree of each node, the average distance, and the relative distance.

[0185] Exemplarily, one of the two adjacent nodes is the first node, and the in-degree of the first node is λ o , the out-degree of the first node is λ o , the sum of the in-degree and out-degree of all nodes (including the first node) on the target path where the first node is located is λ, and the average distance between all nodes on the target path where the first node is located is d c , the other node among the two adjacent nodes is the second node, and the distance (i.e., relative distance) between the first node and the second node is d ij , then the node density of the first node is ρ i It can be expressed by formula 1:

[0186]

[0187] Where χ(x) represents a binary function, and

[0188] Similarly, the node density of the second node can also be obtained based on the above method, which will not be described in detail here.

[0189] It is worth noting that, in this embodiment, by combining the out-degree and in-degree, average distance, and relative distance of each node to determine the node density of each node between two adjacent nodes, the node density can have a technical effect of high accuracy and reliability.

[0190] In some embodiments, determining the moving distance according to the node density of each of the two adjacent nodes may include: determining the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes, and determining the moving distance according to the attraction and repulsion.

[0191] It is worth noting that, in the present embodiment, the gravitational force and repulsive force between two adjacent nodes can characterize the interaction relationship of attraction and repulsion between the two adjacent nodes, and by determining the moving distance based on the gravitational force and the repulsive force, the possibility of movement between the two adjacent nodes is fully considered, thereby achieving a technical effect of high accuracy and reliability of the moving distance.

[0192] In some embodiments, the attraction and repulsion between two adjacent nodes are determined based on the node density of each of the two adjacent nodes: the relative distance between the two adjacent nodes is determined, and the attraction and repulsion are determined respectively based on the node density and relative distance of each of the two adjacent nodes.

[0193] Exemplarily, in combination with the above example, if two adjacent nodes include a first node and a second node, the node density of the first node is ρ i , the node density of the second node is ρ j , the relative distance (i.e. the distance between the first node and the second node) is d ij , then the gravitational force F between the first node and the second node in It can be expressed by formula 2:

[0194]

[0195] The repulsive force between the first node and the second node can be expressed by equation 3:

[0196]

[0197] In some embodiments, determining the moving distance according to the attractive force and the repulsive force may include: determining a resultant force according to the attractive force and the repulsive force, and determining the moving distance according to the resultant force.

[0198] Exemplarily, the resultant force may be expressed by Formula 4:

[0199] F=F in +αF out

[0200] Among them, α is the preset experimental parameter.

[0201] In some embodiments, the attraction and repulsion can be normalized separately, such as obtaining values ​​between zero and one respectively, and the resultant force can be determined based on the normalized attraction and repulsion to avoid the disadvantages of uneven force on the nodes and difficulty in reaching a stable state, thereby improving the accuracy and reliability of the determined resultant force.

[0202] For example, the moving distance can be expressed by Formula 5:

[0203]

[0204] Among them, t is the preset experimental parameter.

[0205] S206: Adjust the position of any node among the adjacent nodes according to the moving distance.

[0206] For example, the description of S206 can be found in the above embodiment, which will not be described in detail here.

[0207] It should be noted that, in some embodiments, the adjustment of the canvas may be a separate embodiment, the position adjustment of the node may also be a separate embodiment, or Figure 2 As shown, the embodiment of adjusting the canvas and the embodiment of adjusting the position of the node are combined into one embodiment, which is not limited in this embodiment.

[0208] According to another aspect of the embodiments of the present disclosure, the embodiments of the present disclosure also provide a layout device for a data flow graph.

[0209] See also Figure 5 , Figure 5 A schematic diagram of a data flow graph layout device according to an embodiment of the present disclosure.

[0210] like Figure 5 As shown, the data flow graph layout device 500 includes:

[0211] The construction unit 501 is used to construct each target path from the starting node to the ending node of the data flow graph according to each node in the data flow graph.

[0212] The calculation unit 502 is used to calculate the node density of each of two adjacent nodes on any target path.

[0213] The first determination unit 503 is used to determine a moving distance according to a node density of each of the two adjacent nodes, wherein the moving distance is used to indicate adjusting a position of any node of the two adjacent nodes on a target path where the two adjacent nodes are located.

[0214] The first adjusting unit 504 is configured to adjust the position of any node among the adjacent nodes according to the moving distance.

[0215] See also Figure 6 , Figure 6 A schematic diagram of a data flow graph layout device according to another embodiment of the present disclosure.

[0216] like Figure 6 As shown, the layout device 600 of the data flow graph includes:

[0217] The acquisition unit 601 is used to acquire the coordinates of the cursor on the canvas for drawing the nodes of the data flow graph.

[0218] The second determining unit 602 is configured to determine the coordinates of a preset corner point of the canvas.

[0219] The second adjustment unit 603 is used to adjust the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point.

[0220] Combination Figure 6 It can be seen that, in some embodiments, the second adjustment unit 603 includes:

[0221] The second determining subunit 6031 is used to determine the right edge of the canvas according to the coordinates of the preset corner point and the preset width of the canvas.

[0222] The adjusting subunit 6032 is used to adjust the width of the canvas if the coordinates of the cursor are outside the right border of the canvas.

[0223] In some embodiments, the adjustment subunit 6032 is used to determine the adjusted width of the canvas according to the coordinates of the cursor, the coordinates of the preset corner point, and the width of the preset node.

[0224] The third determining subunit 6033 is configured to use the difference between the horizontal coordinate of the cursor and the horizontal coordinate of the preset corner point as the horizontal coordinate of the node corresponding to the cursor.

[0225] In some other embodiments, the second determining subunit 6031 is used to determine the lower boundary of the canvas according to the coordinates of the preset corner point and the preset height of the canvas.

[0226] The adjusting subunit 6032 is used to adjust the height of the canvas if the coordinates of the cursor are outside the lower boundary of the canvas.

[0227] In some embodiments, the adjusting subunit 6032 is used to determine the adjusted height of the canvas according to the coordinates of the cursor, the coordinates of the preset corner point, and the height of the preset node.

[0228] The construction unit 604 is used to construct each target path from the starting node to the ending node of the data flow graph according to each node in the data flow graph.

[0229] Combination Figure 6 It can be seen that, in some embodiments, the construction unit 604 includes:

[0230] The fourth determining subunit 6041 is used to determine the next node connected to the starting node, and determine the next node connected to the next node, and so on, until the next node is the ending node, thereby obtaining multiple initial paths.

[0231] The fifth determination subunit 6042 is used to determine the center of gravity position of any initial path according to the position information of each node in the arbitrary initial path, and determine the target path corresponding to the arbitrary initial path according to the center of gravity position of the arbitrary initial path.

[0232] The calculation unit 605 is used to calculate the node density of each of two adjacent nodes on any target path.

[0233] Combination Figure 6 It can be seen that, in some embodiments, the computing unit 605 includes:

[0234] The first determining subunit 6051 is used to determine the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and determine the position of each node on the target path where the two adjacent nodes are located.

[0235] The calculation subunit 6052 is used to calculate the node density of any one of the two adjacent nodes based on the out-degree and in-degree of any one of the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located.

[0236] In some embodiments, the calculation subunit 6052 is used to determine the total number of out-degrees and in-degrees of each node on the target path where the two adjacent nodes are located, determine the average distance between each node on the target path where the two adjacent nodes are located based on the positions of each node on the target path where the two adjacent nodes are located, and determine the relative distance between the two adjacent nodes, and calculate the node density of any node of the two adjacent nodes based on the out-degree and in-degree of any node of the two adjacent nodes, the total number of out-degrees and in-degrees of each node, the average distance, and the relative distance.

[0237] The first determination unit 606 is used to determine a moving distance according to a node density of each of the two adjacent nodes, wherein the moving distance is used to indicate adjusting a position of any node of the two adjacent nodes on a target path where the two adjacent nodes are located.

[0238] In some embodiments, the first determining unit 606 is used to determine the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes, and determine the moving distance according to the attraction and repulsion.

[0239] In some embodiments, the first determining unit 606 is used to determine the relative distance between the two adjacent nodes, and determine the attractive force and the repulsive force respectively according to the node density and the relative distance of each of the two adjacent nodes.

[0240] The first adjusting unit 607 is configured to adjust the position of any node among the adjacent nodes according to the moving distance.

[0241] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0242] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, the program product includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0243] like Figure 7 , is a block diagram of an electronic device according to a layout method of a data flow graph of an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0244] like Figure 7As shown, the electronic device includes: one or more processors 701, a memory 702, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 701 is taken as an example.

[0245] The memory 702 is a non-transitory computer-readable storage medium provided by the present disclosure. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the data flow graph layout method provided by the present disclosure. The non-transitory computer-readable storage medium of the present disclosure stores computer instructions, which are used to enable a computer to perform the data flow graph layout method provided by the present disclosure.

[0246] The memory 702 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the data flow graph layout method in the embodiment of the present disclosure. The processor 701 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 702, that is, implements the data flow graph layout method in the above method embodiment.

[0247] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the use of an electronic device according to the layout method of a data flow graph, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 702 may optionally include a memory remotely arranged relative to the processor 701, and these remote memories may be connected to the electronic device of the layout method of a data flow graph via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0248] The electronic device of the data flow graph layout method may further include: an input device 703 and an output device 704. The processor 701, the memory 702, the input device 703 and the output device 704 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0249] The input device 703 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device of the layout method of the data flow graph, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 704 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0250] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0251] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0252] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0253] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0254] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0255] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0256] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A data flow graph layout method, comprising: According to each node in the data flow graph, construct each target path from the starting node to the ending node of the data flow graph; For two adjacent nodes on any target path, the node density of each of the two adjacent nodes is calculated, and a moving distance is determined according to the node density of each of the two adjacent nodes, wherein the moving distance is used to indicate adjusting the position of any node of the two adjacent nodes on the target path where the two adjacent nodes are located; Adjusting the position of any node among the adjacent nodes according to the moving distance; For two adjacent nodes on any target path, the node density of each of the two adjacent nodes is calculated, including: Determine the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and determine the position of each node on the target path where the two adjacent nodes are located; Calculate the node density of any one of the two adjacent nodes according to the out-degree and in-degree of any one of the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located; Determining a moving distance according to the node density of each of the two adjacent nodes includes: Determine the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes, and determine the moving distance according to the attraction and repulsion; Obtaining the coordinates of a cursor on a canvas for drawing a node of the data flow graph, and determining the coordinates of a preset corner point of the canvas; The range of the canvas is adjusted according to the coordinates of the cursor and the coordinates of the preset corner point.

2. The method according to claim 1, wherein: The node density of any one of the two adjacent nodes is calculated according to the out-degree and in-degree of any one of the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent nodes are located, including: Determine the total number of out-degrees and in-degrees of each node on the target path where the two adjacent nodes are located; Determine, according to the positions of the nodes on the target path where the two adjacent nodes are located, an average distance between the nodes on the target path where the two adjacent nodes are located, and determine a relative distance between the two adjacent nodes; The node density of any node among the two adjacent nodes is calculated according to the out-degree and in-degree of any node among the two adjacent nodes, the total number of out-degrees and in-degrees of each node, the average distance, and the relative distance.

3. The method according to claim 1, wherein: Determining the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes includes: The relative distance between the two adjacent nodes is determined, and the attraction and the repulsion are determined according to the node density and the relative distance of each of the two adjacent nodes.

4. The method according to claim 1, wherein: The adjusting the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point includes: Determining the right edge of the canvas according to the coordinates of the preset corner point and the preset width of the canvas; If the coordinates of the cursor are outside the right border of the canvas, the width of the canvas is adjusted.

5. The method according to claim 4, wherein: Adjust the width of the canvas, including: The adjusted width of the canvas is determined according to the coordinates of the cursor, the coordinates of the preset corner points, and the width of the preset nodes.

6. The method according to claim 4, wherein: The coordinates of the cursor include the horizontal coordinate of the cursor, and the coordinates of the preset corner point include the horizontal coordinate of the preset corner point; the method further includes: The difference between the horizontal coordinate of the cursor and the horizontal coordinate of the preset corner point is used as the horizontal coordinate of the node corresponding to the cursor.

7. The method according to claim 1, wherein: The adjusting the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point includes: Determining the lower boundary of the canvas according to the coordinates of the preset corner points and the preset height of the canvas; If the coordinates of the cursor are outside the lower boundary of the canvas, the height of the canvas is adjusted.

8. The method according to claim 7, wherein: Adjust the height of the canvas, including: The adjusted height of the canvas is determined according to the coordinates of the cursor, the coordinates of the preset corner points, and the heights of the preset nodes.

9. The method according to any one of claims 1 to 3, wherein: According to each node in the data flow graph, each target path from the starting node to the ending node of the data flow graph is constructed, including: Determine the next node connected to the starting node, and determine the next node connected to the next node, and so on, until the next node is the ending node, to obtain multiple initial paths; For any initial path, the center of gravity position of the arbitrary initial path is determined according to the position information of each node in the arbitrary initial path, and the target path corresponding to the arbitrary initial path is determined according to the center of gravity position of the arbitrary initial path.

10. A data flow graph layout device, comprising: A construction unit, configured to construct each target path from a start node to an end node of the data flow graph according to each node in the data flow graph; A calculation unit, configured to calculate the node density of each of two adjacent nodes on any target path; A first determining unit, configured to determine a moving distance according to a node density of each of the two adjacent nodes, wherein the moving distance is used to indicate adjusting a position of any node of the two adjacent nodes on a target path where the two adjacent nodes are located; A first adjustment unit, configured to adjust the position of any node among the adjacent nodes according to the moving distance; The calculation unit is specifically used to determine the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and determine the position of each node on the target path where the two adjacent connecting nodes are located; calculate the node density of any node of the two adjacent nodes according to the out-degree and in-degree of any node of the two adjacent nodes, the out-degree and in-degree of each node on the target path where the two adjacent nodes are located, and the position of each node on the target path where the two adjacent connecting nodes are located; The first determining unit is specifically configured to determine the attraction and repulsion between the two adjacent nodes according to the node density of each of the two adjacent nodes, and determine the moving distance according to the attraction and repulsion; An acquisition unit, used to acquire the coordinates of a cursor on a canvas for drawing a node of the data flow graph; A second determining unit, used to determine the coordinates of a preset corner point of the canvas; The second adjustment unit is used to adjust the range of the canvas according to the coordinates of the cursor and the coordinates of the preset corner point.

11. An electronic device, comprising: Memory, processor; Memory; a memory for storing instructions executable by the processor; The processor is configured to execute the method as claimed in any one of claims 1 to 9.

12. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are used to implement the method according to any one of claims 1 to 9 when executed by a processor.

13. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.