The present invention relates generally to the field of computing, and more particularly to data processing. Specifically, the present disclosure relates to methods, systems and products for graph data processing.
Nowadays, graphs are getting more popular in various application environments. As application environments become complicated, scales of the graphs also grow and thus result in a challenge in graph computation. Sometimes, a large scale graph may comprise millions of nodes and tens of millions of edges.
Embodiments of the present invention disclose a method, computer system, and a computer program product for data processing. In one aspect, a computer-implemented method is disclosed. According to the method, an adjacency graph of a source graph may be determined by traversing the source graph based on a deep first search rule. Subgraphs may be extracted from the determined adjacency graph based on a predefined shape. Respective subgraph nodes may be built based on nodes in the respective subgraphs. Then the adjacency graph may be updated based on the respective subgraph nodes.
In another aspect, a computer-implemented system is disclosed. The computing system comprises a computer processor coupled to a computer-readable memory unit, where the memory unit comprises instructions that when executed by the computer processor implements a method. According to the method, an adjacency graph of a source graph may be determined by traversing the source graph based on a deep first search rule. Subgraphs may be extracted from the determined adjacency graph based on a predefined shape. Respective subgraph nodes may be built based on nodes in the respective subgraphs. Then the adjacency graph may be updated based on the respective subgraph nodes.
In another aspect, a computer program product is disclosed. The computer program product comprises a computer readable storage medium having program instructions embodied therewith. The program instructions is executable by an electronic device to cause the electronic device to perform actions of: determining an adjacency graph of the source graph by traversing a source graph based on a deep first search rule; extracting subgraphs from the determined adjacency graph based on a predefined shape; building respective subgraph nodes based on nodes in the respective subgraphs; and updating the adjacency graph based on the respective subgraph nodes.
It is to be understood that the summary is not intended to identify key or essential features of implementations of the present disclosure, nor is it intended to be used to limit the scope of the present disclosure. Other features of the present disclosure will become easily comprehensible through the description below.
These and other objects, features and advantages of the present invention will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings. The various features of the drawings are not to scale as the illustrations are for clarity in facilitating one skilled in the art in understanding the invention in conjunction with the detailed description. In the drawings:
Throughout the drawings, same or similar reference numerals represent the same or similar elements.
Detailed embodiments of the claimed structures and methods are disclosed herein; however, it can be understood that the disclosed embodiments are merely illustrative of the claimed structures and methods that may be embodied in various forms. This invention may, however, be embodied in many different forms and should not be construed as limited to the exemplary embodiments set forth herein. Rather, these exemplary embodiments are provided so that this disclosure will be thorough and complete and will fully convey the scope of this invention to those skilled in the art. In the description, details of well-known features and techniques may be omitted to avoid unnecessarily obscuring the presented embodiments.
The present invention may be a system, a method, and/or a computer program product at any possible technical detail level of integration. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: 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 static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, configuration data for integrated circuitry, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++, or the like, and procedural programming languages, such as the “C” programming language, Python programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
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 invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the blocks 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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
It is understood in advance that although this disclosure includes a detailed description on cloud computing, implementation of the teachings recited herein are not limited to a cloud computing environment. Rather, embodiments of the present invention are capable of being implemented in conjunction with any other type of computing environment now known or later developed.
Cloud computing is a model of service delivery for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, network bandwidth, servers, processing, memory, storage, applications, virtual machines, and services) that can be rapidly provisioned and released with minimal management effort or interaction with a provider of the service. This cloud model may include at least five characteristics, at least three service models, and at least four deployment models.
Characteristics are as follows:
On-demand self-service: a cloud consumer can unilaterally provision computing capabilities, such as server time and network storage, as needed automatically without requiring human interaction with the service's provider.
Broad network access: capabilities are available over a network and accessed through standard mechanisms that promote use by heterogeneous thin or thick client platforms (e.g., mobile phones, laptops, and PDAs).
Resource pooling: the provider's computing resources are pooled to serve multiple consumers using a multi-tenant model, with different physical and virtual resources dynamically assigned and reassigned according to demand. There is a sense of location independence in that the consumer generally has no control or knowledge over the exact location of the provided resources but may be able to specify location at a higher level of abstraction (e.g., country, state, or datacenter).
Rapid elasticity: capabilities can be rapidly and elastically provisioned, in some cases automatically, to quickly scale out and rapidly released to quickly scale in. To the consumer, the capabilities available for provisioning often appear to be unlimited and can be purchased in any quantity at any time.
Measured service: cloud systems automatically control and optimize resource use by leveraging a metering capability at some level of abstraction appropriate to the type of service (e.g., storage, processing, bandwidth, and active user accounts). Resource usage can be monitored, controlled, and reported providing transparency for both the provider and consumer of the utilized service.
Service Models are as follows:
Software as a Service (SaaS): the capability provided to the consumer is to use the provider's applications running on a cloud infrastructure. The applications are accessible from various client devices through a thin client interface such as a web browser (e.g., web-based e-mail). The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited user-specific application configuration settings.
Platform as a Service (PaaS): the capability provided to the consumer is to deploy onto the cloud infrastructure consumer-created or acquired applications created using programming languages and tools supported by the provider. The consumer does not manage or control the underlying cloud infrastructure including networks, servers, operating systems, or storage, but has control over the deployed applications and possibly application hosting environment configurations.
Analytics as a Service (AaaS): the capability provided to the consumer is to use web-based or cloud-based networks (i.e., infrastructure) to access an analytics platform. Analytics platforms may include access to analytics software resources or may include access to relevant databases, corpora, servers, operating systems or storage. The consumer does not manage or control the underlying web-based or cloud-based infrastructure including databases, corpora, servers, operating systems or storage, but has control over the deployed applications and possibly application hosting environment configurations.
Infrastructure as a Service (IaaS): the capability provided to the consumer is to provision processing, storage, networks, and other fundamental computing resources where the consumer is able to deploy and run arbitrary software, which can include operating systems and applications. The consumer does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, deployed applications, and possibly limited control of select networking components (e.g., host firewalls).
Deployment Models are as follows:
Private cloud: the cloud infrastructure is operated solely for an organization. It may be managed by the organization or a third party and may exist on-premises or off-premises.
Community cloud: the cloud infrastructure is shared by several organizations and supports a specific community that has shared concerns (e.g., mission, security requirements, policy, and compliance considerations). It may be managed by the organizations or a third party and may exist on-premises or off-premises.
Public cloud: the cloud infrastructure is made available to the general public or a large industry group and is owned by an organization selling cloud services.
Hybrid cloud: the cloud infrastructure is a composition of two or more clouds (private, community, or public) that remain unique entities but are bound together by standardized or proprietary technology that enables data and application portability (e.g., cloud bursting for load-balancing between clouds).
A cloud computing environment is service oriented with a focus on statelessness, low coupling, modularity, and semantic interoperability. At the heart of cloud computing is an infrastructure comprising a network of interconnected nodes.
The following described exemplary embodiments provide a system, method and program product for data processing. As such, the present embodiment has the capacity to improve the technical field of data processing by reducing the scale of the graph and increasing the graph computation in a fast and convenient way. More specifically, the invention operates a graph computation directly on a compressed graph with non-decompression or partial decompression, cluster the graph before compression and encode the clustered graph to reduce the graph size (e.g., compression).
As previously described, nowadays, graphs are getting more popular in various application environments. As application environments become complicated, scales of the graphs also grow and thus result in a challenge in graph computation. Sometimes, a large scale graph may comprise millions of nodes and tens of millions of edges. At this point, how to reduce the scale the graph and increase the graph computation in a fast and convenient way becomes a focus.
Therefore, it may be advantageous to, among other things, utilize compression to cut the space cost of large-scale graphs, since compression may reduce graph size to fit in memory and thus help to reduce overhead of the Input/Output (I/O) operation. In addition, the optimization of computation may lay on the I/O efficiency and query process. Decompression may be necessary when adopting some compression approach (e.g., zip), and may comprise the I/O reduction achieved by compression. As such, to save time, non-decompression or partial decompression may be utilized, if possible. Furthermore, indexing may be useful to reduce the querying time.
Referring now to
In cloud computing node, there is a computer system/server 12 or a portable electronic device such as a communication device, which is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and/or configurations that may be suitable for use with computer system/server 12 include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments that include any of the above systems or devices, and the like.
Computer system/server 12 may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, and so on that perform particular tasks or implement particular abstract data types. Computer system/server 12 may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices.
As shown in
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer system/server 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer system/server 12, and it includes both volatile and non-volatile media, removable and non-removable media.
System memory 28 can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and/or cache memory 32. Computer system/server 12 may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system 34 can be provided for reading from and writing to a non-removable, non-volatile magnetic media (not shown and typically called a “hard drive”). Although not shown, a magnetic disk drive for reading from and writing to a removable, non-volatile magnetic disk (e.g., a “floppy disk”), and an optical disk drive for reading from or writing to a removable, non-volatile optical disk such as a CD-ROM, DVD-ROM or another optical media can be provided. In such instances, each can be connected to bus 18 by one or more data media interfaces. As will be further depicted and described below, memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
Program/utility 40, having a set (at least one) of program modules 42, may be stored in memory 28 by way of example, and not limitation, as well as an operating system, one or more application programs, other program modules, and program data. Each of the operating system, one or more application programs, other program modules, and program data or some combination thereof, may include an implementation of a networking environment. Program modules 42 generally carry out the functions and/or methodologies of embodiments of the invention as described herein.
Computer system/server 12 may also communicate with one or more external devices 14 such as a keyboard, a pointing device, a display 24, etc.; one or more devices that enable a user to interact with computer system/server 12; and/or any devices (e.g., network card, modem, etc.) that enable computer system/server 12 to communicate with one or more other computing devices. Such communication can occur via Input/output (I/O) interfaces 22. Still yet, computer system/server 12 can communicate with one or more networks such as a local area network (LAN), a general wide area network (WAN), and/or a public network (e.g., the Internet) via network adapter 20. As depicted, network adapter 20 communicates with the other components of computer system/server 12 via bus 18. It should be understood that although not shown, other hardware and/or software components could be used in conjunction with computer system/server 12. Examples, include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
Referring now to
Referring now to
Hardware and software layer 60 includes hardware and software components. Examples of hardware components include: mainframes 61; RISC (Reduced Instruction Set Computer) architecture based servers 62; servers 63; blade servers 64; storage devices 65; and networks and networking components 66. In some embodiments, software components include network application server software 67 and database software 68.
Virtualization layer 70 provides an abstraction layer from which the following examples of virtual entities may be provided: virtual servers 71; virtual storage 72; virtual networks 73, including virtual private networks; virtual applications and operating systems 74; and virtual clients 75.
In one example, management layer 80 may provide the functions described below. Resource provisioning 81 provides dynamic procurement of computing resources and other resources that are utilized to perform tasks within the cloud computing environment. Metering and Pricing 82 provide cost tracking as resources are utilized within the cloud computing environment, and billing or invoicing for consumption of these resources. In one example, these resources may include application software licenses. Security provides identity verification for cloud consumers and tasks, as well as protection for data and other resources. User portal 83 provides access to the cloud computing environment for consumers and system administrators. Service level management 84 provides cloud computing resource allocation and management such that required service levels are met. Service Level Agreement (SLA) planning and fulfillment 85 provides pre-arrangement for, and procurement of, cloud computing resources for which a future requirement is anticipated in accordance with an SLA.
Workloads layer 90 provides examples of functionality for which the cloud computing environment may be utilized. Examples of workloads and functions which may be provided from this layer include: mapping and navigation 91; software development and lifecycle management 92; virtual classroom education delivery 93; data analytics processing 94; transaction processing 95; and graph data processing 96. Hereinafter, reference will be made to
Graphs are widely used in various environments. For example, a social network that describes various users and association relationships among the users may be represented by a graph, where a node in the graph may indicate a user and an edge between two nodes may indicate an association between the two users indicated by the two nodes. For another example, in a graph representing a geographic information system, a node may indicate an intersection, and an edge may indicate a road between two intersections. For the sake of description, implementations of the present disclosure will be described in an environment of a social network. In the social network, the association between two users may indicate that the users know each other. Although the present disclosure describes implementations by an example graph representing the social network, in another implementation, the graph may represent another application environment such as a topology of a city road network or a communication network.
There have been provided several approaches in the field of graph data processing. According to one approach, the graph may be compressed to reduce the data amount of the graph. Although this approach may lower the data amount for storing the graph, before the compressed graph is accessed, the compressed graph should be subject to a decompressing procedure to recover the original graph. In this situation, the decompressing procedure will result in extra computation and Input/Output overhead. According to another approach, the graph may be divided into various portions and these portions may be compressed separately. Although this approach may avoid decompressing the whole graph and may only needs to decompress a target portion of the graph, extra overhead may be caused in coordinating the various portions.
In order to at least partially solve the above and other potential problems, a new method for processing a graph is disclosed according to implementations of the present disclosure. Hereinafter, reference will be made to
Here, the source graph 410 may be converted into a destination graph 420, where a group of subgraphs with a predefined shape (such as a triangle) in the source graph 410 may be replaced with respective subgraph nodes (as shown in shaded patterns) in the destination graph 420. For example, a triangle 412 which is a subgraph comprising the nodes L, J, M may be replaced by a node T1 with a reference number 422 in the destination graph 420. Similarly, other subgraphs may be replaced by other nodes T2, T3, T4 and T5 to form the destination graph 420. With this implementation, by replacing subgraphs that comprising multiple nodes in the source graph with respective subgraph nodes, the source graph 410 having a great number of nodes may be converted to the destination graph 420 that have a reduced number of nodes and edges. Therefore, the complexity of the source graph 410 may be simplified, which may result in a more efficient performance in the graph computation. Having provided a general description of the implementations, reference will be made to
At a block 520, subgraphs may be extracted from the determined adjacency graph based on shapes of the subgraphs. In according to an embodiment of the present invention, the subgraphs may be extracted based on a predefined shape. In the present disclosure, details of the implementations will be described by taking a triangle as an example of the subgraph. It is to be understood that the predefined shape may include a triangle, a square, or a connected square. Here, the connected square may refer to a square where all the four nodes in the square are connected with edges. Based on the descriptions about the triangle subgraph, details about the implementation when the subgraph has another shape may be determined by those skilled in the art.
Once the adjacency graph is determined, the adjacency graph may be searched to determine the subgraphs. Depending on the application environment of the graph, the shape of the subgraph may be selected differently. For example, if the source graph 410 represents the social network, then a triangle may be selected because the relationship indicated by a triangle in the graph (where three users shown by the triangle know each other) is very common in the social network. In another example, if the source graph 410 represents the road network in a city, a square may be selected as the subgraph because most of the road network around a block in the city shows a square pattern.
At a block 530, respective subgraph nodes may be built based on nodes in the respective subgraphs. Here, the association relationship between the subgraph nodes and nodes in the subgraph may be recorded. Referring back to
Here, the number near a given node in the adjacency graph 600 is a sequence number indicating when the given node is reached based on the DFS rule. For example, the traversing starts at the node A, and thus the node A is the first node reached in the traversing, where the node A is labeled by a sequence number “1.” Then, based on the DFS rule, the traversing goes along an arrow 610, and then the node L is the second one reached in the traversing, where the node L is labeled by a sequence number “2.” Next, nodes M, J may be reached subsequently along arrows 612 and 614. As the above nodes are reached in going through the source graph 410 in the forward direction, the edges between the nodes A, L, M and J are shown by the solid lines. After the node J, based on the DFS rule, the node L is the next node reached in the backtracking, and thus the edge between the nodes J and L are shown by the dashed line. Based on the DFS rule, the source graph 410 may be traversed and the adjacency graph 600 may be determined.
In according to an embodiment of the present invention, with respect to one subgraph in the group of subgraphs, a relationship among edges in the subgraph may be determined based on the shapes of the subgraphs. Next, the adjacency graph may be traversed to determine edges satisfying the relationship, and then a subgraph may be extracted based on the group of edges. With this implementation, the extracting the subgraph may be simplified into an easy procedure, where the edges that satisfy the relationship for defining the subgraph may be found by traversing the adjacency graph.
Hereinafter, reference will be made to
With respect to a triangle, the relationships may be: (1) if the subgraph is defined by two forward edges and one backward edge, then the subgraph may be determined as a triangle; and (2) if the subgraph is defined by one forward edge and two backward edges, then the subgraph may be determined as a triangle. The adjacency graph 600 may be traversed to determine edges satisfying the relationship, and then the subgraph(s) based on may be determined based on the determined edges. Referring to
Referring to
In according to an embodiment of the present invention, a node association may be built for describing relationship between the respective subgraph nodes and regular nodes. Here, the node association may be stored in various data structures such as a table, a list, an array and the like. In one implementation, the following Table 1 may be adapted for storing the node association. Hereinafter, in order to highlight the difference between the subgraph node and the node that exists in the original adjacency graph 600, the latter node may be called as a regular node.
In the above Table 1, the first column may indicate the serial number of the subgraph, the second column may indicate the identification of the subgraph node, and the third column may indicate regular nodes comprised in the subgraph corresponding to the subgraph node. The first entry in Table 1 shows the situation of the subgraph in the area 710 in
In according to an embodiment of the present invention, the updating the adjacency graph 600 may relate to updating both of the nodes and the edges in the adjacency graph 600. First, the respective subgraphs in the adjacency graph 600 may be replaced with the respective subgraph nodes as shown in Table 1. Then, edges in the replaced adjacency graph may be updated based on edges between regular nodes in the adjacency graph 600 to form the destination graph 420.
With this implementation, as the respective subgraphs are replaced with the respective subgraph nodes, the number of the nodes in the replaced adjacency graph may be greatly reduced. Taking the triangle as the example of the subgraph, the number of the subgraph nodes may be reduced to about ⅓ of the number of the nodes that are originally comprised in the subgraphs. In another implementation where the subgraph is a square, the number of the subgraph nodes may be reduced to about ¼ of the number of the original number. Clearly, the present implementation may lower the number of the nodes in the destination graph 420 significantly.
In order to update the nodes, the subgraphs in the adjacency graph 600 may be replaced with the respective subgraph nodes. Still referring to
Once the respective subgraphs are replaced with the respective subgraph nodes, edges in the replaced adjacency graph 800 may be updated. Reference will be made to
In according to an embodiment of the present invention, with respect to a first subgraph node and a second subgraph node in the replaced adjacency graph, an edge may be added between the first subgraph node and the second subgraph node in response to an edge existing between a node comprised in a first subgraph indicated by the first subgraph node and a node comprised in a second subgraph indicated by the second subgraph node. Reference will be made to
In according to an embodiment of the present invention, with respect to a first subgraph node and a second subgraph node in the replaced adjacency graph, an edge may be added between the first subgraph node and the second subgraph node in response to a node being shared by a first subgraph indicated by the first subgraph node and a second subgraph indicated by the second subgraph node. Reference will be made to
In according to an embodiment of the present invention, with respect to a subgraph node and a regular node in the replaced adjacency graph, an edge may be added between the subgraph node and the regular node in response to the regular node being connected to a node comprised a subgraph indicated by the subgraph node. Reference will be made to
Based on the procedures described in the above paragraphs, edges in the replaced graph 800 as shown in
In the above Table 2, the first column may indicate the serial number of the edge, the second column may indicate two ends of the edge, and the third column may indicate the type of the edge. Taking the first entry in Table 2 as an example, edges exist between the subgraph nodes T1 and T5. The edges comprise two edges: one edge is between the regular nodes A and L; and another edge is between the regular nodes B and M. Taking the second entry in Table 2 as an example, one edge exists between the subgraph nodes T3 and T5 because the two subgraph nodes T3 and T5 share a common node B.
In the above Table 3, the first column may indicate the serial number of the edge, and the second column may indicate two ends of the regular edge. Taking the first entry in Table 3 as an example, an edge exists between the regular nodes A and F. It is to be understood that the above Tables 2 and 3 are only example data structures for storing the edges between subgraph nodes and the regular nodes. In another implementation, another data structure such as an array may be adopted.
The above paragraphs have described the detailed implementation about how to convert the source graph 410 into the destination graph 420. Hereinafter, reference will be made to
In according to an embodiment of the present invention, the destination graph 420 may be traversed from a beginning node specified by the request. If the beginning node is a subgraph node, nodes in a subgraph indicated by the subgraph node may be traversed based on the node association. Then, the traversing may move to a next node from the beginning node based on the first edge set and the second edge set.
Hereinafter, the traversing may start from the node M and details of the procedure may be similar as those when the traversing starts from the beginning node B. In according to an embodiment of the present invention, if the beginning node is a regular node, the traversing may move to a next node from the beginning node based on the second edge set. In one example, if the node F is determined as the beginning node, the node A may be determined as the next node based on Table 3. After several rounds, the traversing path 1020 may comprise the nodes as shown in
In according to an embodiment of the present invention, a request for clustering nodes in the source graph may be converted into a request for clustering nodes in the destination graph. Here, the nodes (comprising the subgraph nodes and regular nodes) in the destination graph 420 may be clustered based on the first edge set and the second edge set. Reference will be made to
Usually, the clustering operation is based on the closeness between nodes. As nodes in the subgraph often have great closeness degree, these nodes should be clustered into a same classification. Based on this, the subgraph nodes in the destination graph 420 may be considered regular nodes and the all the nodes in the destination graph 420 may be clustered based on closeness degrees among them. Referring to
It is to be understood that the above paragraphs have described implementations by taking an undirected graph as the source graph 410. In another implementation, the source graph 410 may be a directed graph. At this point, during traversing the source graph 410, nodes in the source graph 410 may be reached along the direction of the edge. Further, the relationship among edges in a subgraph may be determined based on both the shape and the direction of the edges in the subgraph. Based on the description of the present disclosure, those skilled in the art may modify the implementations for an undirected graph to a directed graph.
The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.