CN113204678A - Loop detection method, device, system, equipment and medium of directed graph - Google Patents

Loop detection method, device, system, equipment and medium of directed graph Download PDF

Info

Publication number
CN113204678A
CN113204678A CN202110587862.9A CN202110587862A CN113204678A CN 113204678 A CN113204678 A CN 113204678A CN 202110587862 A CN202110587862 A CN 202110587862A CN 113204678 A CN113204678 A CN 113204678A
Authority
CN
China
Prior art keywords
data
node
linked list
directed graph
loop
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110587862.9A
Other languages
Chinese (zh)
Other versions
CN113204678B (en
Inventor
唐世昊
姚积全
何雨伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110587862.9A priority Critical patent/CN113204678B/en
Priority claimed from CN202110587862.9A external-priority patent/CN113204678B/en
Publication of CN113204678A publication Critical patent/CN113204678A/en
Application granted granted Critical
Publication of CN113204678B publication Critical patent/CN113204678B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9035Filtering based on additional data, e.g. user or group profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a loop detection method for a directed graph, which can be applied to the technical fields of information security and big data, and includes: according to the data relationship between the stack structure and the linked list structure, the pointing node of the current node in the directed graph is traversed; storing the linked list data in the linked list structure acquired in the traversal process into a loop storage set; and determining the linked list data in the loop storage set as loop data. Therefore, compared with the existing loop detection technology, the loop detection method does not depend on actual scenes and deployment equipment, has wider application scenes, and can directly detect all loops existing in the directed graph within limited time. In addition, the present disclosure also provides a loop detection apparatus of a directed graph, a loop detection system of a directed graph, an electronic device, and a computer-readable storage medium.

Description

Loop detection method, device, system, equipment and medium of directed graph
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a loop detection method, an apparatus, a system, a device, and a medium for a directed graph.
Background
The graph has very wide application in many fields, such as decision flow in the field of financial wind control, and a set of effective decision links are formed finally by constructing a series of decision nodes in a self-defined manner and organizing the decision nodes together by using a directed graph; for example, in some complex task scenes, the complex task is split into simple tasks with smaller granularity by splitting the complex task, and the simple tasks are constructed into a directed graph, so that the execution flow of the original complex task is more specific and clear. In summary, the directed graph can be used to describe almost all application scenarios with flow characteristics, and is a very excellent solution for expressing flow scenarios.
The process has the greatest characteristic of being carried out all the time, namely, the process finally goes to the end node regardless of the trend of the next step. In many application scenarios, a loop in the graph is not allowed to exist, because the directed graph with the loop may be trapped in a dead loop in the actual execution process, and thus the directed graph can never go to the end node. Therefore, the loop detection technique is an important issue in the field of directed graph research.
Disclosure of Invention
Technical problem to be solved
In order to solve at least one of the technical problems of the loop detection technology in the prior art, the present disclosure provides a loop detection method, apparatus, system, device and medium for a directed graph.
(II) technical scheme
One aspect of the present disclosure provides a loop detection method for a directed graph, including: according to the data relationship between the stack structure and the linked list structure, the pointing node of the current node in the directed graph is traversed; storing the linked list data in the linked list structure acquired in the traversal process into a loop storage set; and determining the linked list data in the loop storage set as loop data.
According to an embodiment of the present disclosure, before traversing a pointing node of a current node in a directed graph according to a data relationship in a stack structure and a linked list structure, the method further includes: and based on a key-value data structure rule, performing storage structure definition on the directed graph, and realizing that the directed graph is stored in a data form of a key-value key value pair.
According to an embodiment of the present disclosure, before traversing a pointing node of a current node in a directed graph according to a data relationship in a stack structure and a linked list structure, the method further includes: initializing the stack structure, the linked list structure and the loop storage set to ensure that the data in the stack structure, the linked list structure and the loop storage set are all empty; and in response to the end of the initialization process, inserting starting binary group data corresponding to a starting node in the directed graph into the stack structure.
According to the embodiment of the disclosure, in a pointing node traversing a current node in a directed graph according to a data relationship between a stack structure and a linked list structure, the method includes: when the data in the stack structure is not empty, stack popping operation is carried out on the stack structure to obtain stack top data corresponding to the current node; deleting all linked list data with index positions more than or equal to the traversal hierarchy depth in the stack top data in the linked list structure; and inserting the current node to the end of the linked list structure after the deletion operation is performed.
According to the embodiment of the present disclosure, in the pointing node that traverses the current node in the directed graph according to the data relationship between the stack structure and the linked list structure, the method further includes: when the tail end is inserted into the linked list structure of the current node and no repeated node data exists, removing stack top data in the stack structure; inquiring a pointing node corresponding to the current node according to a node pointing rule of the directed graph; and when the pointing node corresponding to the current node is not empty, inserting the pointing binary group data corresponding to the pointing node into the stack structure with the stack top data removed.
According to the embodiment of the disclosure, storing the linked list data in the linked list structure obtained in the traversal process into the loop storage set includes: and when repeated node data exists in the linked list structure with the tail inserted into the current node, storing the linked list data acquired in the linked list structure in the traversal process into a loop storage set.
According to the embodiment of the present disclosure, storing the linked list data in the linked list structure obtained in the traversal process into the loop storage set further includes: deleting the node inserted last in the chain table structure; and removing the stack top data in the stack structure to further judge whether the data in the stack structure is empty.
According to the embodiment of the disclosure, in determining that the linked list data in the loop storage set is the loop data, the method includes: and when the data in the stack structure is empty, determining the loop data in the loop storage set.
Another aspect of the present disclosure provides a loop detection apparatus for a directed graph, which includes a node traversing module, a data storing module, and a loop data determining module. The node traversal module is used for traversing the pointing node of the current node in the directed graph according to the data relationship between the stack structure and the linked list structure; the data storage module is used for storing the linked list data in the linked list structure acquired in the traversal process into a loop storage set; and the loop data determining module is used for determining the linked list data in the loop storage set as the loop data.
Another aspect of the present disclosure provides a loop detection system for a directed graph, including: a database and the above-mentioned apparatus. The database is used for storing and updating the structural data of the directed graph; the device is used for reading the structural data in the database so as to realize the method.
Another aspect of the present disclosure provides an electronic device comprising one or more processors and memory; the memory is used for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of the embodiments of the present disclosure.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, implement the method of embodiments of the present disclosure.
Another aspect of the present disclosure provides a computer program comprising computer executable instructions that when executed perform the method of embodiments of the present disclosure.
(III) advantageous effects
The present disclosure provides a loop detection method of a directed graph, which includes: according to the data relationship between the stack structure and the linked list structure, the pointing node of the current node in the directed graph is traversed; storing the linked list data in the linked list structure acquired in the traversal process into a loop storage set; and determining the linked list data in the loop storage set as loop data. Therefore, compared with the existing loop detection technology, the loop detection method does not depend on actual scenes and deployment equipment, has wider application scenes, and can directly detect all loops existing in the directed graph within limited time. In addition, the present disclosure also provides a loop detection apparatus of a directed graph, a loop detection system of a directed graph, an electronic device, and a computer-readable storage medium.
Drawings
For a more complete understanding of the present disclosure and the advantages thereof, reference is now made to the following descriptions taken in conjunction with the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which a loop detection method of a directed graph may be applied, according to an embodiment of the disclosure;
FIG. 2 schematically illustrates a flow chart of a loop detection method of a directed graph according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates another flow diagram of a loop detection method of a directed graph according to an embodiment of the present disclosure;
FIG. 4 schematically shows a flow chart of an application example of the loop detection method of the directed graph according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a component diagram of a directed graph of a loop detection method of the directed graph in accordance with an embodiment of the present disclosure;
FIG. 6 schematically illustrates another flow diagram of a loop detection method of a directed graph according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates another flow diagram of a loop detection method of a directed graph according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates another flow diagram of a loop detection method of a directed graph according to an embodiment of the present disclosure;
FIG. 9 schematically illustrates a component diagram of another directed graph of a loop detection method of the directed graph in accordance with an embodiment of the present disclosure;
FIG. 10 schematically illustrates an exemplary architecture of a loop detection apparatus of a directed graph according to an embodiment of the present disclosure;
FIG. 11 schematically illustrates an exemplary architecture of a loop detection system of a directed graph according to an embodiment of the present disclosure;
FIG. 12 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Some block diagrams and/or flow diagrams are shown in the figures. It will be understood that some blocks of the block diagrams and/or flowchart illustrations, or combinations thereof, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the instructions, which execute via the processor, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks. The techniques of this disclosure may be implemented in hardware and/or software (including firmware, microcode, etc.). In addition, the techniques of this disclosure may take the form of a computer program product on a computer-readable storage medium having instructions stored thereon for use by or in connection with an instruction execution system.
The existing loop detection technology is mostly applied to the field of computer networks, each node in a graph corresponds to one device in the network, and whether a loop exists in the computer network is identified through communication between the devices and transmission of a loop detection message. The loop detection technology has narrow application range, can only be applied to the field of network communication, and must ensure that all networks are smooth and have no fault during measurement. Moreover, the biggest problem is that the detection mode can not detect whether a loop exists in the network design stage in advance, and the loop can not be detected until the equipment is deployed in the actual network.
As mentioned above, the directed graph loop detection technology has a wide application field, and in many practical application scenarios, loops are not allowed to appear in the directed graph, and the appearance of the loops will cause the execution flow to fall into a dead loop. The simple directed graph can find whether a loop exists through observation, but when the directed graph has more and more nodes and more complex structures, judgment cannot be achieved through observation.
In order to solve at least one of the technical problems of the directed graph loop detection technology in the prior art and provide a novel effective loop detection scheme, so that the detection scheme can perform loop detection on directed graphs in all scenes compared with the prior loop detection technology, does not depend on actual scenes and deployment equipment, has wider application range, and can detect all loops in a designed graph at the initial directed graph design stage.
It should be noted that the loop detection method and apparatus for the directed graph in the embodiments of the present disclosure may be applied to the technical field of information security and the technical field of internet of things, and may also be applied to any fields other than the technical field of information security and the technical field of internet of things, such as the field of financial services.
Fig. 1 schematically illustrates an exemplary system architecture to which a loop detection method of a directed graph may be applied, according to an embodiment of the present disclosure.
It should be noted that fig. 1 is only an application example to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, but does not mean that the loop detection method of the directed graph of the embodiments of the present disclosure may not be used in other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to the embodiment may include a data request system 110, and a server system 120 that establishes data communication with the data request system 110, wherein the server system includes servers M, 121, 122, 123, 124, and 125 that establish a data transmission channel with the data request system 110, and the server M is a main access server and may obtain instruction information from a user. The servers 121, 122, 123, 124 and 125 are secondary access servers, and the data request system 110 and the servers M, 121, 122, 123, 124 and 125 can be implemented based on an internal cloud network server C. Alternatively, when the main server M of the servers M, 121, 122, 123, 124 and 125 is a network server, that is, an intranet of the other terminal devices 111, 112, 113, 114 and 115, the main server M of the server system 120 may be located in an extranet. At this time, the cloud network server C is used here as a medium for providing communication links between the other terminal devices 111, 112, 113, 114 and 115. The data transmission path between the server system 120 and the plurality of terminal devices may be implemented by various communication connection types, such as wired, wireless communication links, or fiber optic cables.
It should be noted that, according to the embodiment of the present disclosure, the servers 121, 122, 123, 124, and 125 may implement a seamless interconnection.
The user may use the terminal devices 111, 112, 113, 114 and 115 to interact with the server system 120 to receive or send messages or the like for enabling data transmission or processing, in particular relating to access to a database in the main server M in the server system. For example, the terminal device 111 sends service data to the terminal device 112, and after receiving a data request from the terminal device 111, the server system 120 performs forwarding processing on the corresponding service data, and encrypts the service data according to specific requirements, so that the service data finally reaching the terminal device 112 is ensured. Various messenger client applications, such as management-type applications, web browser applications, search-type applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on terminal devices 111, 112, 113, 114, and 115.
The terminal devices 111, 112, 113, 114, and 115 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop and desktop computers, and various types of application servers, and so on.
The server system 120 may include various types of firewalls that provide various services, such as filtering-type firewalls (by way of example only) that provide support for websites browsed by users using the terminal devices 111, 112, 113, 114, and 115. The filtering firewall can analyze and process the received data such as the user request, analyze the data based on the address of the data source, the protocol type and other mark characteristics, and determine whether the data can pass through, so that unsafe factors are filtered or blocked.
It should be noted that the loop detection method of the directed graph provided by the embodiment of the present disclosure may be generally performed by the server system 120. Accordingly, the loop detection apparatus or system of the directed graph provided by the embodiments of the present disclosure may be generally disposed in the server system 120. The loop detection method of the directed graph provided by the embodiment of the present disclosure may also be performed by other server systems 120 different from the server system 120 and capable of communicating with the terminal devices 111, 112, 113, 114, and 115 and/or the server system 120. Accordingly, the loop detection apparatus or system of the directed graph provided by the embodiment of the present disclosure may also be disposed in other server systems different from the server system 120 and capable of communicating with the terminal devices 111, 112, 113, 114, and 115 and/or the server system 120.
It should be understood that the number of terminal devices and servers in fig. 1 is merely illustrative. Any number of terminal devices and servers may be provided according to implementation needs.
The loop detection method of the directed graph, the loop detection apparatus of the directed graph, the loop detection system of the directed graph, the electronic device, and the computer-readable storage medium according to an embodiment of the present disclosure are further described in detail below with reference to fig. 2 to 12.
Fig. 2 schematically shows a flow chart of a loop detection method of a directed graph according to an embodiment of the present disclosure.
As shown in fig. 2, an aspect of the present disclosure provides a loop detection method of a directed graph, which includes steps S201 to S203.
In step S201, according to the data relationship between the stack structure and the linked list structure, the pointing node of the current node in the directed graph is traversed;
in step S202, the linked list data in the linked list structure obtained in the traversal process is stored in the loop storage set; and
in step S203, the linked list data in the loop storage set is determined to be loop data.
In an embodiment of the present disclosure, a stack structure (stack) is a data structure that can be applied to a storage system or a data processing system, and generally processes node data in a last-in first-out manner, where the stack structure can only operate at an operation end, the operation end is a stack top, and a non-operation end opposite to the other end is a stack bottom. Therefore, in the stack structure, only the top data can be accessed or read, which is mainly reflected in the pushing and the popping of the top data.
The linked list structure (list) is another data forwarding structure that can be applied to a storage system or a data processing system, and the data stored in the linked list structure can form linked list data with a specific data sequence according to the characteristics of the time, the order and the like when the data enters the linked list structure, so that the linked list data in the linked list structure can be sequentially processed when being called.
The data relationship between the stack top data in the stack structure and the linked list data in the linked list structure, such as the existence and the repetition of the stack top data, the existence and the repetition of the linked list data, and the like, is used for setting the traversal of the pointing node of the current node in the directed graph.
The directed graph is composed of two parts, namely nodes and directed line segments, wherein the directed line segments are responsible for connecting two adjacent nodes and defining the direction from one node to the other node, and when the directed graph walks, the directed line segments can only walk from one node to the other node according to the direction of the directed line segments. When the starting node moves to the pointing node and finally points to the starting node from the pointing node of the pointing node, the nodes form a loop. Therefore, for these nodes, the corresponding traversal data can be determined according to the next traversal of the node direction.
The traversal data for the nodes is stored in a linked list structure to form linked list data in sequence. When the traversal is finished, the linked list data can be directly stored in the loop storage set. The loop storage set (set) can be used for simultaneously storing a plurality of linked list data and ensuring that the stored linked list data are different.
When each link list data is stored in the loop storage set, a corresponding loop data is formed. That is, how much loop data is stored in the loop storage set, that is, how many loops are detected by the detection method according to the embodiment of the present disclosure, and each loop data is different from each other, that is, each loop of the directed graph detected in the traversal process can be accurately determined, and meanwhile, it is ensured that the detection time has a finite property.
Therefore, compared with the existing loop detection technology, the loop detection method does not depend on actual scenes and deployment equipment, has wider application scenes, and can detect all loops existing in the directed graph within limited time.
Fig. 3 schematically shows another flowchart of a loop detection method of a directed graph according to an embodiment of the present disclosure.
As shown in fig. 3, according to the embodiment of the present disclosure, before traversing the pointing node of the current node in the directed graph according to the data relationship in the stack structure and the linked list structure in step S201, the method further includes step S301.
In step S301, based on the key-value data structure rule, a storage structure definition is performed on the directed graph, so that the directed graph is stored in a data format of a key-value key value pair.
Fig. 4 schematically shows a flowchart of an application example of the loop detection method of the directed graph according to the embodiment of the present disclosure.
As shown in fig. 4, in step S401, a storage structure of the directed graph is defined, the directed graph is stored in a form of key-value key value pairs, so as to implement parameterization of the directed graph, and the directed graph is presented and expressed in a data form, which is convenient for storing the directed graph into a storage medium and is beneficial to data call of the directed graph.
Fig. 5 schematically illustrates a component diagram of a directed graph of a loop detection method of the directed graph according to an embodiment of the present disclosure.
As shown in fig. 5, the directed graph is composed of two parts, i.e., nodes 1 to 5 and directed line segments, where a directed line segment is responsible for connecting two adjacent nodes, and defines a direction from one node to another node, e.g., node1 points to node 3 and node 2, and can only point from node1 to node 3 and node 2 according to the direction of the directed line segment.
The key-value data structure has high availability, high expandability and good fault recovery and operation performance through a corresponding mode of keywords and numerical values, can ensure that data is not easy to lose and services are not easy to be terminated, can sense and automatically recover and optimize faults, and has extremely high read-write performance.
In the embodiment of the present disclosure, the directed graph is saved by means of a key-value data structure, where a key represents a number of a node, a value is a list structure, and all other nodes pointed by the key node are stored in the key-value data structure, for example, the stored data of the key-value of the directed graph corresponding to fig. 5 is as follows:
{
"node 1": [ "node 2", "node 3" ],
"node 2": [ "node 5" ],
"node 3": [ "node 4" ],
"node 4": [ "node 5" ],
"node 5": []
}
That is, a total of 5 pairs of key-value key pairs are included, such as the key being "node 1" and its corresponding value being "node 2" and "node 3". Therefore, through the data storage technology in the form of the key-value structure, persistent directed graph storage can be performed by using a storage medium related to the key-value structure.
As shown in fig. 3, according to the embodiment of the present disclosure, before traversing the pointing node of the current node in the directed graph according to the data relationship in the stack structure and the linked list structure in step S201, the method further includes steps S302-S303.
In step S302, initializing the stack structure, the linked list structure, and the loop storage set, so that data in the stack structure, the linked list structure, and the loop storage set are all empty; and
in step S303, in response to the end of the initialization process, start binary group data corresponding to the start node in the directed graph is inserted into the stack structure.
As shown in fig. 4, in step S402, an empty stack [ ], an empty linked list [ ], and an empty loop storage set { }, where the data states in the stack, the linked list, and the loop storage set are all empty.
Further, in step S403,from the starting node of the directed graphS(the start node1 shown in FIG. 5) starts, and starts the nodeSCorresponding initial binary group data (node)SAnd 1) insert into a stack. The starting node refers to a node which is not pointed to by any other node. Furthermore, (node)SAnd 1) in 1) represents the hierarchical depth of nodes of the traversal graph, the hierarchical depth of a starting node is 1, and the following nodes are gradually increased along with the deepening of the traversal hierarchical depth.
Fig. 6 schematically shows another flowchart of a loop detection method of a directed graph according to an embodiment of the present disclosure.
As shown in fig. 6, according to the embodiment of the present disclosure, in step S201, according to the data relationship in the stack structure and the linked list structure, the steps S601 to S603 are included to traverse the pointing node of the current node in the directed graph.
In step S601, when the data in the stack structure is not empty, a pop operation is performed on the stack structure to obtain stack top data corresponding to the current node;
in step S602, deleting all linked list data in the linked list structure whose index position is greater than or equal to the traversal hierarchy depth in the stack top data; and
in step S603, the current node is inserted to the end of the linked list structure after the deletion operation is performed.
As shown in fig. 4, in step S404, it is determined whether the stack is empty, and if not, step S405 is executed.
As shown in fig. 4, in step S405, stack performs pop operation to obtain a top element, i.e. top data (node)tAnd c), wherein c is the traversal hierarchy depth of the current node. And simultaneously deleting all data with index positions larger than or equal to c in list, and converting the nodetInserted at the end of list. Note that the index position is incremented from 1 in list.
Fig. 7 schematically illustrates another flowchart of a loop detection method of a directed graph according to an embodiment of the present disclosure.
As shown in fig. 7, according to the embodiment of the present disclosure, in step S201, according to the data relationship between the stack structure and the linked list structure, the method further includes steps S701 to S703.
In step S701, when no duplicate node data exists in the linked list structure with the end inserted into the current node, removing the stack top data in the stack structure;
in step S702, according to the node pointing rule of the directed graph, a pointing node corresponding to the current node is queried; and
in step S703, when the pointing node corresponding to the current node is not empty, the pointing binary group data corresponding to the pointing node is inserted into the stack structure from which the stack top data is removed.
As shown in fig. 4, in step S406, it is determined whether duplicate data exists in the list, where the duplicate data is the mutually overlapping node name data existing in the list. If the list linked list does not have repeated data, the stack top data of the stack is removed, and step S408 is executed.
In step S408, a key node is queried from the storage medium of the key-value data structuretCorresponding value, execute step S409. The node pointing rule is a corresponding relation between a current node and a pointed node defined by pointing to the current node according to the current node in the directed graph. When the Key word defined in the Key-value data structure is the current node, the value corresponds to the pointing node pointed by the current node, that is, the Key value defined in the Key-value data structure parameterizes the node pointing rule of the directed graph.
In step S409, it is determined whether the value is null. And, if value is empty, go back to and execute step S404; if value is not empty, execution continues with step S410.
In step S410, value is not null, i.e., there is a data node, assuming value is [ node1, node2,...,noden]Then the binary group data (node) corresponding to these node nodes is used1,c+1),(node2C +1), (noden, c +1) are all inserted into the stack, and the process continues to step S404.
Fig. 8 schematically illustrates another flowchart of a loop detection method of a directed graph according to an embodiment of the present disclosure.
As shown in fig. 8, according to the embodiment of the present disclosure, in step S202, the linked list data in the linked list structure obtained in the traversal process is stored in the loop storage set, including step S801.
In step S801, when there is repeated node data in the linked list structure with the end inserted into the current node, the linked list data acquired in the linked list structure in the traversal process is stored in the loop storage set.
As shown in fig. 4, in step S406, when it is determined that there is duplicate data in the list, which indicates that there is a loop in the directed graph, the process continues to step S407.
In step S407, the linked list data stored in the list at this time is put into the loop storage set.
As shown in fig. 8, according to the embodiment of the present disclosure, in step S202, the linked list data in the linked list structure obtained in the traversal process is stored in the loop storage set, which further includes steps S802 to S803.
In step S802, the last inserted node in the linked list structure is deleted; and
in step S803, the top data in the stack structure is removed to further determine whether the data in the stack structure is empty.
Referring to step S406, if there is duplicate data in the list, which indicates that there is a loop in the directed graph, it is necessary to continue deleting the node inserted last in the listtAnd (6) a data node.
In addition, the stack top data of stack needs to be further removed, and step S404 is executed again.
According to the embodiment of the present disclosure, determining that the linked list data in the loop storage set is the loop data in step S203 includes: and when the data in the stack structure is empty, determining the loop data in the loop storage set.
As shown in fig. 4, in step S404, when it is determined that the stack is empty, step S411 is performed.
In step S411, until all nodes of the directed graph have been traversed, the linked list data stored in the set is all loop data existing in the traversed directed graph, and how much loop data represents how many loops.
In order to make those skilled in the art understand the loop detection method of the directed graph according to the embodiment of the present disclosure, another specific implementation case is specifically mentioned to describe the loop detection method of the directed graph in detail as follows:
fig. 9 schematically shows a component diagram of another directed graph of a loop detection method of the directed graph according to an embodiment of the present disclosure.
As shown in fig. 9, the directed graph is composed of two parts, i.e., nodes 1 to 5 and directed line segments, where a directed line segment is responsible for connecting two adjacent nodes, and defines a direction from one node to the other node, and for example, a node directing rule can be formed in sequence by directing the directed line segment from node1 to node 3 and node 2, from node 2 to node 5, from node 5 to node 4, from node 4 to node 3, and from node 3 to node 5, and then sequentially forming the directed graph shown in fig. 9.
Therefore, the above directed graph can be converted into a key-value storage structure according to the data structure form of the key-value as follows:
{
“1”:[“2”,“3”],
“2”:[“5”],
“3”:[“5”],
“4”:[“3”],
“5”:[“4”]
}
based on the parameterized storage form of the key-value data structure for the directed graph shown in fig. 9 (which is equivalent to step S401 shown in fig. 4), the loop detection method according to the above-described embodiment of the present disclosure performs the following detection procedures on all loops present in the directed graph shown in fig. 9:
step s 1: starting from the initial node1, (1, 1) is put into the stack. At this time, the stack [ (1, 1) ], and the list [ ]. Here, the step S1 actually corresponds to the step S403 shown in fig. 4, and details about the initialization process in the step S402 are not described herein.
Step s 2: the stack performs pop operation to obtain the top data (1, 1), and inserts node1 into list, where the stack is gate and the list is [1 ].
Step s 3: check if duplicate data, here not included, is included in the list. All next nodes to node1, here node 2 and node 3, are retrieved from the key-value store, and (2,2) and (3, 2) are inserted into the stack. At this time, the stack is [ (2,2), (3, 2) ], and the list is [1 ].
Step s 4: and stack executes the pop operation to obtain the top data (3, 2), and the node 3 is inserted into the list. At this time, the start is [ (2,2) ] and the list is [1,3 ].
Step s 5: check if the list contains duplicate data, which is not contained here. All next nodes to node 3, here 5, are retrieved from the key-value store and (5,3) is inserted into the stack. At this time, the stack is [ (2,2), (5,3) ], and the list is [1,3 ].
Step s 6: stack performs pop operation to obtain the top of stack data (5,3), and inserts node 5 into list. At this time, the start is [ (2,2) ], and the list is [1,3,5 ].
Step s 7: check if the list contains duplicate data, which is not contained here. All next nodes of node 5, here 4, are fetched from the key-value store, and (4,4) is inserted into the stack, which is then [ (2,2), (4,4) ] and list [1,3,5 ].
Step s 8: the stack performs pop operation to obtain the top data (4,4), and inserts the node 4 into the list, where the stack is [ (2,2) ] and the list is [1,3,5,4 ].
Step s 9: check if the list contains duplicate data, which is not contained here. All next nodes of node 4, here 3, are fetched from the key-value store, and (3, 5) is inserted into the stack, where stack ═ 2, (3, 5) and list ═ 1,3,5, 4.
Step s10-stack performs a pop operation to obtain the top of stack data (3, 5), and inserts node 3 into list. At this time, the stack is [ (2,2) ], and the list is [1,3,5,4,3 ].
Step s 11: checking whether the list contains repeated data or not, wherein the repeated data is contained, putting the content in the list into a set, and deleting the last data of the list. At this time, set { [1,3,5,4,3] }, list { [1,3,5, 4], and stack { (2,2) ].
Wherein, the above steps S2 and S3, S4 and S5, S6 and S7, S8 and S9 correspond to the loop operation in the node traversal process of the steps S405-S406-S407-S408-S409-S410-S404-S405 shown in FIG. 4, wherein, the steps S2, S4, S6, S8 and S10 correspond to the step S405 shown in FIG. 4, the steps S3, S5, S7 and S9 correspond to the operations of the steps S406-S407-S408-S409-S410 shown in FIG. 4, step S11, in turn, corresponds to steps S406-S407, illustrating that a loop in the directed graph has been detected, and the loop storage set is set { [1,3,5,4,3] } is obtained, that is, the loop data is [1,3,5,4,3], meaning that the first loop that the directed graph is examined for is 1- > 3- > 5- > 4- > 3.
Step s 12: and stack executes the stack popping operation to obtain the stack top data (2,2), wherein the data with the index larger than or equal to 2 is deleted from the list, and then the node 2 is inserted into the list. At this time, the stack [ ], and the list [1, 2 ].
Step s 13: check if the list contains duplicate data, which is not contained here. All next nodes of node 2 are fetched from the key-value store, here 5, (5,3) is inserted into the stack, which is then [ (5,3) ] and list [1, 2 ].
Step s 14: stack performs pop operation to obtain the top of stack data (5,3), and inserts node 5 into list. At this time, the stack [ ], and the list [1, 2,5 ].
Step s 15: check if there is duplicate data contained in listF, not contained here. All next nodes of node 5, here 4, are fetched from the key-value store, and (4,4) is inserted into the stack, where the stack is [ (4,4) ] and the list is [1, 2,5 ].
Step s 16: stack performs pop operation to get the top of stack data (4,4), and inserts node 4 into list. At this time, the stack [ ], and the list [1, 2,5,4 ].
Step s 17: check if the list contains duplicate data, which is not contained here. All next nodes of node 4, here 3, are fetched from the key-value store, and (3, 5) is inserted into the stack, where the stack is [ (3, 5) ] and the list is [1, 2,5,4 ].
Step s 18: stack executes pop operation to obtain stack top data (3, 5), and inserts node 3 into list. At this time, the stack [ ], and the list [1, 2,5,4,3 ].
Step s 19: check if the list contains duplicate data, which is not contained here. All next nodes of node 3 are fetched from the key-value store, here 5, (5,6) is inserted into the stack, where stack [ (5,6) ] and list [ (1, 2,5,4,3 ].
Step s 20: stack performs pop operation to get the top of stack data (5,6), and inserts node 5 into list. At this time, the stack [ ], and the list [1, 2,5,4,3, 5 ].
Step s 21: and checking whether the list contains repeated data or not, wherein the repeated data is contained. Putting the content in the list into a set, deleting the last data of the list, and removing the stack top data of the stack. At this time, set { [1,3,5,4,3], [1, 2,5,4,3, 5] }, list { [1, 2,5,4,3], and stack [ ].
Similarly, the above steps S12 and S13, S14 and S15, S16 and S17, S18 and S19 correspond to loop operations in the node traversal process of the above steps S405-S406-S407-S408-S409-S410-S404-S405 shown in fig. 4, wherein the steps S12, S14, S16, S18 and S20 correspond to the above step S405 shown in fig. 4, the steps S13, S15, S17, S19 correspond to the above operations of the above steps S406-S407-S408-S409-S410 shown in fig. 4, and the step S21 corresponds to the steps S406-S407, which indicates that another loop in the figure has been detected, and the obtained loop storage set is { [1,3,5,4,3], [1, 2,5,4,3, 5], [1,3, 5],5 ] that is detected data [1, 2, 3, 4],4 ],3 ],4 ],3 ',4', and 5] relative to the first loop data, the data is [1,3,5,4,3], namely the second loop detected by the directed graph is 1- > 2- > 5- > 4- > 3- > 5.
Step s 22: since the stack is empty at this time, referring to steps S404-S411 shown in fig. 4, the whole traversal process is ended.
Finally, based on the implementation of the directed graph loop detection method of the above steps s1-s22, a loop storage set is { [1,3,5,4,3], [1, 2,5,4,3, 5] }, which indicates that two loops exist in the directed graph shown in fig. 9, and are respectively 1- > 3- > 5- > 4- > 3 and 1- > 2- > 5- > 4- > 3- > 5.
Therefore, compared with the prior art in which most of the loop detection technologies can only detect whether a loop exists in a network or only detect one or a part of the loops, the loop detection method according to the embodiments of the present disclosure can detect all the loops existing in a directed graph within a limited time, and obviously, has more important practical application meaning for accurately eliminating the loop structure in the directed graph. In addition, the loop detection method can be applied to any application or directed graph detection under the scene capable of being abstracted into the directed graph, and has higher universality compared with the loop detection method proposed for a specific application or environment in the prior art.
FIG. 10 schematically illustrates an exemplary architecture of a loop detection apparatus of a directed graph according to an embodiment of the present disclosure;
another aspect of the present disclosure provides a loop detection apparatus 1000 of a directed graph, which includes a node traversing module 1010, a data storing module 1020, and a loop data determining module 1030. The node traversal module 1010 is configured to traverse a pointing node of a current node in the directed graph according to a data relationship between the stack structure and the linked list structure; the data storage module 1020 is configured to store linked list data in a linked list structure obtained in the traversal process into a loop storage set; and the loop data determining module 1030 is configured to determine the linked list data in the loop storage set as loop data.
The node traversing module 1010, the data storage module 1020, and the loop data determining module 1030 may be respectively configured to implement the methods of steps S201, S202, and S203 in the flow shown in fig. 2, that is, the embodiment of the loop detection apparatus portion of the directed graph is similar to the embodiment of the loop detection method portion of the directed graph, and the achieved technical effects are also similar to each other, which is not described herein again.
It should be noted that fig. 10 is only an example of a system architecture 1000 to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
Fig. 11 schematically illustrates an exemplary architecture of a loop detection system of a directed graph according to an embodiment of the present disclosure.
As shown in fig. 11, another aspect of the present disclosure provides a loop detection system 1100 of a directed graph, including: a database 1110 and a loop detection device 1120 of the directed graph described above. The database 1110 is used for storing and updating the structural data of the directed graph; the loop detection device 1120 of the directed graph is used for reading the structural data in the database to implement the method.
The loop detection apparatus 1120 of the directed graph may be configured to implement the methods of steps S201, S202, and S203 in the flow shown in fig. 2, that is, the embodiment of the loop detection apparatus 1120 of the directed graph is similar to that of the loop detection method of the directed graph, and the achieved technical effects are also similar to each other, which is not described herein again.
It should be noted that fig. 11 is only an example of a system architecture 1100 to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 11, based on the above-mentioned detection method applied to all loops existing in the directed graph disclosed in the embodiment of the present disclosure, the present disclosure further provides a loop detection system 1100 of the directed graph, which mainly includes: a database 1110 and a loop detection device 1120.
Database 1110 is responsible for storing and maintaining the structural data of the directed graph, such as the structural data of the directed graph as embodied by the key-value storage data described above. The database 1110 is also used to store and maintain a set of data that can be used to store all the starting nodes of the directed graph (a starting node refers to a node that is not pointed to by any other node). Wherein, when the network structure of the directed graph changes, the database 1110 can implement adaptive data update on the stored data structure. The loop detection device 1120, specifically referring to the device 1000, is mainly responsible for reading the latest structure data of the directed graph from the database 1110, and accordingly implementing the loop detection method of the directed graph to obtain all loops existing in the detected directed graph.
Therefore, no matter how the directed graph changes, as long as the directed graph can be abstracted into the application or the scene of the directed graph, the loop detection method of the directed graph proposed in the above embodiments of the present disclosure is applicable, and has greater universality compared with the loop detection method proposed in the prior art for a specific application or environment.
FIG. 12 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure.
Another aspect of the present disclosure provides an electronic device comprising one or more processors and memory; the memory is used for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of the embodiments of the present disclosure.
FIG. 12 schematically shows a block diagram of an electronic device according to an embodiment of the disclosure. The electronic device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 12, a computer system 1200 according to an embodiment of the present disclosure includes a processor 1201, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. The processor 1201 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1201 may also include on-board memory for caching purposes. The processor 1201 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 1203, various programs and data necessary for the operation of the system 1200 are stored. The processor 1201, the ROM1202, and the RAM 1203 are connected to each other by a bus 1204. The processor 1201 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM1202 and/or the RAM 1203. Note that the programs may also be stored in one or more memories other than the ROM1202 and the RAM 1203. The processor 1201 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
System 1200 may also include an input/output (I/O) interface 1205, according to an embodiment of the disclosure, input/output (I/O) interface 1205 also connected to bus 1204. The system 1200 may also include one or more of the following components connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A drive 1210 is also connected to the I/O interface 1208 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program, when executed by the processor 1201, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM1202 and/or the RAM 1203 and/or one or more memories other than the ROM1202 and the RAM 1203 described above.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, implement the method of embodiments of the present disclosure.
Specifically, the computer-readable storage medium may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The above-mentioned computer-readable storage medium carries one or more programs which, when executed, implement a loop detection method of a directed graph according to an embodiment of the present disclosure.
Alternatively, the computer-readable storage medium may be included in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
Another aspect of the present disclosure provides a computer program including computer-executable instructions, which when executed, implement a loop detection method of a directed graph according to an embodiment of the present disclosure.
So far, the embodiments of the present disclosure have been described in detail with reference to the accompanying drawings.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It will be understood by those skilled in the art that while the present disclosure has been shown and described with reference to certain exemplary embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure as defined by the appended claims and their equivalents. Accordingly, the scope of the present disclosure should not be limited to the above-described embodiments, but should be defined not only by the appended claims, but also by equivalents thereof.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A loop detection method of a directed graph comprises the following steps:
traversing the pointing node of the current node in the directed graph according to the data relationship between the stack structure and the linked list structure;
storing the linked list data in the linked list structure acquired in the traversal process into a loop storage set; and
and determining the linked list data in the loop storage set as loop data.
2. The method of claim 1, wherein prior to said traversing a pointing node of a current node in the directed graph according to data relationships in a stack structure and a linked list structure, further comprising:
and based on a key-value data structure rule, performing storage structure definition on the directed graph, and realizing the storage of the directed graph in a data form of a key-value key value pair.
3. The method of claim 2, wherein prior to said traversing a pointing node of a current node in the directed graph according to data relationships in a stack structure and a linked list structure, further comprising:
initializing the stack structure, the linked list structure and the loop storage set to ensure that the data in the stack structure, the linked list structure and the loop storage set are all empty; and
in response to the initialization process ending, inserting starting binary group data corresponding to a starting node in the directed graph into the stack structure.
4. The method of claim 1, wherein traversing a pointing node of a current node in the directed graph according to a data relationship in a stack structure and a linked list structure comprises:
when the data in the stack structure is not empty, stack popping operation is carried out on the stack structure so as to obtain stack top data corresponding to the current node;
deleting all linked list data of which the index positions are greater than or equal to the traversal hierarchy depth in the stack top data in the linked list structure; and
and inserting the current node to the end of the linked list structure after the deletion operation is executed.
5. The method of claim 4, wherein traversing a pointing node of a current node in the directed graph according to a data relationship in a stack structure and a linked list structure, further comprises:
when no repeated node data exists in the linked list structure with the tail inserted into the current node, stack top data in the stack structure is removed;
inquiring a pointing node corresponding to the current node according to the node pointing rule of the directed graph; and
and when the pointing node corresponding to the current node is not empty, inserting the pointing binary group data corresponding to the pointing node into the stack structure from which the stack top data is removed.
6. The method according to claim 5, wherein storing the linked list data in the linked list structure obtained in the traversal process into a loop storage set comprises:
and when repeated node data exists in the linked list structure with the tail inserted into the current node, storing the linked list data acquired in the traversal process in the linked list structure into the loop storage set.
7. The method according to claim 6, wherein storing the linked list data in the linked list structure obtained in the traversal process into a loop storage set further comprises:
deleting the node inserted last in the linked list structure; and
and removing the stack top data in the stack structure to further judge whether the data in the stack structure is empty.
8. The method of claim 7, wherein the determining that the linked list data in the loop storage set is loop data comprises:
and when the data in the stack structure is empty, determining the loop data in the loop storage set.
9. A loop detection apparatus of a directed graph, comprising:
the node traversing module is used for traversing the pointing node of the current node in the directed graph according to the data relationship between the stack structure and the linked list structure;
the data storage module is used for storing the linked list data in the linked list structure acquired in the traversal process into a loop storage set; and
and the loop data determining module is used for determining the linked list data in the loop storage set as loop data.
10. A loop detection system for a directed graph, comprising:
the database is used for storing and updating the structural data of the directed graph;
the apparatus of claim 9, configured to read the structural data in the database to implement the method of any one of claims 1-8.
11. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-8.
12. A computer-readable storage medium storing computer-executable instructions for implementing the method of any one of claims 1 to 8 when executed.
CN202110587862.9A 2021-05-27 Loop detection method, device, system, equipment and medium of directed graph Active CN113204678B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110587862.9A CN113204678B (en) 2021-05-27 Loop detection method, device, system, equipment and medium of directed graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110587862.9A CN113204678B (en) 2021-05-27 Loop detection method, device, system, equipment and medium of directed graph

Publications (2)

Publication Number Publication Date
CN113204678A true CN113204678A (en) 2021-08-03
CN113204678B CN113204678B (en) 2024-10-29

Family

ID=

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113672369A (en) * 2021-08-20 2021-11-19 北京明略软件系统有限公司 Method and device for verifying ring of directed acyclic graph, electronic equipment and storage medium
CN114172795A (en) * 2021-11-17 2022-03-11 苏州浪潮智能科技有限公司 Method and system for detecting network loop in linked list
CN116094989A (en) * 2021-11-05 2023-05-09 达发科技(苏州)有限公司 Mesh network loop detection method and loop elimination method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339501A (en) * 2008-08-12 2009-01-07 北京航空航天大学 WS-BPEL control loop detection method based on directed graph
CN103838811A (en) * 2012-11-20 2014-06-04 Sap股份公司 Circular transaction path detection
CN105721297A (en) * 2016-01-28 2016-06-29 北京国电通网络技术有限公司 Routing loop detecting method and system based on SDN
CN109669858A (en) * 2018-11-22 2019-04-23 新华三技术有限公司合肥分公司 Test method, device and the equipment of program deadlock
CN110968429A (en) * 2019-12-20 2020-04-07 北京百度网讯科技有限公司 Method, device, equipment and storage medium for loop detection in directed graph

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339501A (en) * 2008-08-12 2009-01-07 北京航空航天大学 WS-BPEL control loop detection method based on directed graph
CN103838811A (en) * 2012-11-20 2014-06-04 Sap股份公司 Circular transaction path detection
CN105721297A (en) * 2016-01-28 2016-06-29 北京国电通网络技术有限公司 Routing loop detecting method and system based on SDN
CN109669858A (en) * 2018-11-22 2019-04-23 新华三技术有限公司合肥分公司 Test method, device and the equipment of program deadlock
CN110968429A (en) * 2019-12-20 2020-04-07 北京百度网讯科技有限公司 Method, device, equipment and storage medium for loop detection in directed graph

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113672369A (en) * 2021-08-20 2021-11-19 北京明略软件系统有限公司 Method and device for verifying ring of directed acyclic graph, electronic equipment and storage medium
CN116094989A (en) * 2021-11-05 2023-05-09 达发科技(苏州)有限公司 Mesh network loop detection method and loop elimination method
CN114172795A (en) * 2021-11-17 2022-03-11 苏州浪潮智能科技有限公司 Method and system for detecting network loop in linked list
CN114172795B (en) * 2021-11-17 2023-08-11 苏州浪潮智能科技有限公司 Method and system for detecting network loop in linked list

Similar Documents

Publication Publication Date Title
US11171982B2 (en) Optimizing ingestion of structured security information into graph databases for security analytics
KR102154757B1 (en) Callpath finder
US9275422B2 (en) Distributed k-core view materialization and maintenance for graphs
US20190095284A1 (en) Enhanced application write performance
US9706003B2 (en) Bulk uploading of multiple self-referencing objects
US20160321254A1 (en) Unsolicited bulk email detection using url tree hashes
US12013843B2 (en) Automatic creation and synchronization of graph database objects
CN113961510B (en) File processing method, device, equipment and storage medium
US11243882B2 (en) In-array linked list identifier pool scheme
CN112131181B (en) Display method and device of storage path and electronic equipment
CN110489158A (en) Method, apparatus, medium and the electronic equipment that code hosted platform is optimized
US20160092521A1 (en) Policy driven contextual search
CN110674082B (en) Method and device for removing online document, electronic equipment and computer readable medium
CN113204678B (en) Loop detection method, device, system, equipment and medium of directed graph
CN113204678A (en) Loop detection method, device, system, equipment and medium of directed graph
CN110413207B (en) Method, apparatus and program product for reducing data recovery time of a storage system
US20160359714A1 (en) Notifying original state listeners of events in a domain model
CN115510016A (en) Client response method, device and medium based on directory fragmentation
US11651030B2 (en) Delta-based conflict-free replicated data type arrays using dot stores that map dots to dot stores
CN110941683B (en) Method, device, medium and electronic equipment for acquiring object attribute information in space
CN113741951B (en) Local packing method and device
CN111625500B (en) File snapshot method and device, electronic equipment and storage medium
US10212116B2 (en) Intelligently condensing transcript thread history into a single common reduced instance
CN110442403B (en) Method, device, electronic equipment and medium for calling functional component
CN113127416A (en) Data query method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant