A method for processing instance icons, electronic device and storage medium

By establishing the first vector of the instance icon in the topology diagram and performing clustering processing, the problem of low efficiency in querying similar instance icons in the topology diagram is solved, and the function of quickly querying and displaying related instance icons is realized.

CN117216606BActive Publication Date: 2025-02-07MOBILE TECH COMPANY CHINA TRAVELSKY HLDG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311181281.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2025-02-07
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

During the process of program development, when developers need to query multiple similar instance icons in the topology diagram, the query efficiency of the prior art is low and it is necessary to traverse the instances in the topology diagram for viewing.

Method used

By obtaining the ID value list of the instance icon group in the topology diagram, a first vector of the instance icon is established, and the instance icon is clustered using the canopy clustering algorithm and the preset clustering algorithm, and divided into k first vector lists. This allows developers to quickly query and display related instance icons.

Benefits of technology

Improve query efficiency, enable developers to quickly locate and display other instance icons related to the target instance icon, reducing traversal operations during the query process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216606B_ABST
    Figure CN117216606B_ABST
Patent Text Reader

Abstract

The present invention provides an instance icon processing method, an electronic device and a storage medium, which relate to the field of instance icon processing. The method comprises the following steps: obtaining an original topology map; obtaining an ID value list corresponding to each instance icon group corresponding to the original topology map to obtain an instance icon group ID value list set D; establishing A according to D i,r The corresponding first vector QA i,r ; Use the canopy clustering algorithm to cluster the first vectors corresponding to all instance icons in the original topology map into k clusters to obtain the first initial center point vectors corresponding to each of the k clusters and the maximum value n of the number of first vectors in each cluster; cluster the first vectors corresponding to all instance icons in the original topology map according to the k first initial center point vectors and n; display the instance icon corresponding to each first vector in the first vector list containing the first vector corresponding to the target instance icon to improve the query efficiency of the instance icon.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of instance icon processing, and in particular to an instance icon processing method, electronic equipment and storage medium. Background Art

[0002] At present, in the process of program development, many instances with specific functions are usually developed, for example, models or modules with specific functions. There are certain associations between these instances. In order to more conveniently view the relationships between these instances, developers usually display all instances in the form of a topology map, and use the lines between the instances to represent the relationships between the instances; however, when there are many instances, when developers query some similar instances on the corresponding topology map, they need to traverse each instance in the topology map and view them separately, which leads to low query efficiency. Summary of the invention

[0003] In view of the above technical problems, the technical solution adopted by the present invention is:

[0004] According to a first aspect of the present application, a method for processing an instance icon is provided, the method comprising the following steps:

[0005] S100, obtaining an original topology map; the original topology map includes a plurality of instance icons and directed edges connecting the instance icons, the directed edges include a first end and a second end, and the direction of each directed edge is from the first end to the second end; each instance icon corresponds to an instance type; each instance icon has at least one source instance icon and / or at least one target instance icon in the original topology map; any instance icon is located at the second end of a directed edge between its corresponding source instance icons or at the first end of a directed edge between its corresponding target instance icons;

[0006] S200, obtaining the id value list corresponding to each instance icon group corresponding to the original topology map, so as to obtain the instance icon group id value list set D=(D 1 ,D 2 ,…,D i ,…,D m ), i = 1, 2, ..., m; where D i is the id value list of the i-th instance icon group, and m is the number of instance icon group id value lists; D i =(ZD i ,D i,1 ,D i,2 ,…,D i,r ,…,D i,f(i) ), r=1,2,…,f(i); ZD i is the instance icon group ID value of the i-th instance icon group; D i,rA is the rth instance icon in the i-th instance icon group i,r id value, f(i) is the number of instance icons in the i-th instance icon group; the difference between the ID values ​​of any two instance icon groups is used to represent the similarity between the corresponding two instance icon groups; D i,j =D i,j -1+1, j=2,3,…,r; D t,1 =D t -1,f(t-1)+1,t=2,3,…,m; the instance types corresponding to the instance icons in the same instance icon group are the same;

[0007] S300, based on D, establish A i,r The corresponding first vector QA i,r =(SD i,r ,SD i ,D i,r ,ZD i ,TD i,r ,TD i ), where SD i,r A i,r The mean of the id values ​​of all corresponding source instance icons, SD i A i,r The average of the ID values ​​of several instance icon groups corresponding to all source instance icons, TD i,r A i,r The mean of the id values ​​of all corresponding target instance icons, TD i A i,r The average of the ID values ​​of several instance icon groups corresponding to all corresponding target instance icons;

[0008] S400, clustering the first vectors corresponding to all instance icons in the original topology map into k clusters using a canopy clustering algorithm, so as to obtain the first initial center point vectors corresponding to each of the k clusters and the maximum value n of the number of first vectors in each cluster;

[0009] S500, clustering the first vectors corresponding to all instance icons in the original topology map using a preset first clustering algorithm according to the k first initial center point vectors and n, to obtain k first vector lists; wherein the number of first vectors in each first vector list is less than or equal to n;

[0010] S600: In response to a user clicking on any instance icon in the original topology map, an instance icon corresponding to each first vector in a first vector list including the first vector corresponding to the instance icon is displayed.

[0011] According to another aspect of the present application, a non-transitory computer-readable storage medium is also provided, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the processing method of the above-mentioned example icon.

[0012] According to another aspect of the present application, an electronic device is provided, including a processor and the above-mentioned non-transitory computer-readable storage medium.

[0013] The present invention has at least the following beneficial effects:

[0014] The processing method of instance icons of the present invention divides each instance icon into a corresponding instance icon group according to the instance type of each instance icon in the topological map, and then sets the ID value of each instance icon and the instance icon group. At this time, the similarity of each instance icon in the same instance icon group is relatively high; then, according to the ID values ​​of the instance icons and the instance icon group set above, the source instance icons corresponding to each instance icon and the instance icon group ID values ​​corresponding to the source instance icons, and the target instance icons corresponding to each instance icon and the instance icon group ID values ​​corresponding to the target instance icons, the source instance icon and the target instance icon of any instance icon are instance icons with a certain association relationship with the instance icon; then, according to the first vectors corresponding to each instance icon and the first initial center point vectors corresponding to k clusters, the first vectors with higher similarity are divided into the same first vector list, so that each first vector is divided into k first vector lists. When a developer views a certain instance icon, he can display all the instance icons corresponding to each first vector in the first vector list including the first vector corresponding to the target instance icon according to the first vector of the instance icon to be viewed, thereby improving the query efficiency.

[0015] Furthermore, the first vector of each instance icon established includes not only the ID value of the corresponding instance icon itself and the corresponding instance icon group ID value, but also the source instance icon corresponding to the instance icon and the instance icon group ID value corresponding to the source instance icon and the target instance icon and the instance icon group ID value corresponding to the target instance icon. That is, the first vector of each instance icon includes the instance icon itself and the instance icons that have an associated relationship with the instance icon. Therefore, when calculating the similarity between the first vector of the instance icon and the k first initial center point vectors, the impact of inaccurate clustering caused by inaccurate setting of the instance icon's own ID value can be weakened, making the clustering more accurate and reasonable.

[0016] Furthermore, the canopy clustering algorithm uses a method of setting a distance threshold for clustering, so that some of the first vectors in each cluster obtained by clustering are repeated, which can make the number of first vectors in each cluster obtained by clustering more balanced, but the clustering accuracy is poor; when the present application clusters each first vector into k first vector lists, the clustering results of the canopy clustering algorithm are used to set the maximum value n of the number of first vectors that can be accommodated in each first vector list, so that the number of first vectors in each first vector list does not exceed n; thereby, it can avoid the situation where the number of first vectors in a first vector list is extremely large, while the number of first vectors in other first vector lists is extremely small, so that the number of first vectors in each first vector list is relatively balanced, and the similarity between each first vector in each first vector list is relatively high. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 The present invention is a flowchart of a method for processing an example icon provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0020] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0021] See also Figure 1, is a flow chart of a method for processing an example icon provided in this embodiment, the method comprising the following steps:

[0022] S100, obtaining an original topology map; the original topology map includes a plurality of instance icons and directed edges connecting the instance icons, the directed edges include a first end and a second end, and the direction of each directed edge is from the first end to the second end; each instance icon corresponds to an instance type; each instance icon has at least one source instance icon and / or at least one target instance icon in the original topology map; any instance icon is located at the second end of a directed edge between its corresponding source instance icon or the first end of a directed edge between its corresponding target instance icon.

[0023] In this embodiment, each instance icon corresponds to an instance. An instance is a model or module with specific functions developed by a program developer when developing a program. There is a certain association relationship between some instances. Therefore, the instance icons corresponding to each instance can be displayed in the form of a topological diagram. The topological diagram contains several instance icons. Some instance icons are connected by directed edges. Two instance icons connected by a directed edge are associated with each other. It should be noted that for any instance icon, there is at least one source instance icon or a target instance icon for the instance icon. The source instance icon and the target instance icon express a relative concept. For example, instance icon A points to instance icon B through the directed edge connected to it, and instance icon B points to instance icon C through the directed edge connected to it. In this relationship, instance icon B is the target instance icon of instance icon A, and instance icon B is also the source instance icon of instance icon C. Therefore, the same instance icon can be both a target instance icon and a source instance icon. The instance corresponding to any instance icon is controlled by the instance corresponding to the corresponding target instance icon. The original topological diagram is obtained, that is, each instance icon in the topological diagram can be obtained, and each instance icon has an instance type.

[0024] S200, obtaining the id value list corresponding to each instance icon group corresponding to the original topology map, so as to obtain the instance icon group id value list set D=(D 1 ,D 2 ,…,D i ,…,D m ), i = 1, 2, ..., m; where D i is the id value list of the i-th instance icon group, m is the number of instance icon group id value lists; D i =(ZD i ,D i,1 ,D i,2 ,…,D i,r ,…,D i,f(i) ), r=1,2,…,f(i); ZDi is the instance icon group ID value of the i-th instance icon group; D i,r A is the rth instance icon in the i-th instance icon group i,r id value, f(i) is the number of instance icons in the i-th instance icon group; the difference between the ID values ​​of any two instance icon groups is used to represent the similarity between the corresponding two instance icon groups; D i,j =D i,j-1 +1, j = 2, 3, ..., r; D t,1 =D t-1,f(t-1) +1, t=2, 3, ..., m; the instance icons in the same instance icon group correspond to the same instance type.

[0025] In this embodiment, each instance icon corresponds to an instance type, for example, the instance type of instance icon 1 is host, and the instance type of instance icon 2 is php application; each instance icon can be divided into a corresponding instance icon group according to the instance type corresponding to each instance icon, for example, the instance types of instance icon 1, instance icon 3 and instance icon 5 are all host, then instance icon 1, instance icon 3 and instance icon 5 are divided into the host instance icon group; it can be understood that if only the instance type of the instance icon is considered, the similarity between the instance icons with the same instance type is relatively high; therefore, this step makes the instance icons in the same instance icon group more similar, thereby realizing the initial classification of each instance icon.

[0026] In this embodiment, each instance icon group corresponds to a preset instance model, and each instance model is preset with a corresponding id value. The id value of the instance model is used to characterize the similarity between each instance model, and the difference between the id values ​​of two adjacent instance models is less than or equal to 3. The id value of the instance model ranked first ranges from 1 to 10. For example, the id value of instance model 1 is 1, the id value of instance model 2 is 3, and the id value of instance model 3 is 4. It can be seen that the difference in id values ​​between instance model 1 and instance model 2 is 2, the difference in id values ​​between instance model 1 and instance model 3 is 3, and the difference in id values ​​between instance model 2 and instance model 3 is 1. It can be seen that the similarity between instance model 1 and instance model 2 is less than the similarity between instance model 2 and instance model 3. After setting the id value of each instance model, it is necessary to set the id value of each instance in each instance model. The setting method can be as follows:

[0027] Sort each instance model in ascending order according to the size of the corresponding id value, and then set the id value of each instance in the instance model ranked first. When setting the id value in the instance model, set the id value of each instance icon in the instance model in turn. For example, there are 10 instance icons in instance model 1, and the id values ​​of these 10 instance icons are set to 1 to 10 in turn; thereby, the setting of the id value of each instance icon and the id value of the instance icon group corresponding to each instance icon is realized; the difference between the id values ​​of two adjacent instance models is small, which can ensure that the two adjacent instance models have a certain similarity; the id values ​​of the instance icons in each instance icon group are different, and increase by 1 in turn, thereby ensuring that the instance icons in the same instance icon group have a certain similarity.

[0028] S300, based on D, establish A i,r The corresponding first vector QA i,r =(SD i,r ,SD i ,D i,r ,ZD i ,TD i,r ,TD i ), where SD i,r A i,r The mean of the id values ​​of all corresponding source instance icons, SD i A i,r The average of the ID values ​​of several instance icon groups corresponding to all source instance icons, TD i,r A i,r The mean of the id values ​​of all corresponding target instance icons, TD i A i,r The average of the ID values ​​of several instance icon groups corresponding to all corresponding target instance icons.

[0029] In this embodiment, for any instance icon, the instance icon may correspond to one or more source instance icons, and may also correspond to one or more target instance icons. When there are multiple source instance icons, the average of the ID values ​​of the corresponding multiple source instance icons is used as the SD i,r , S.D. i A i,r The average of the ID values ​​of several instance icon groups corresponding to all source instance icons. If there is only one instance icon group, then SD i Equal to the instance icon group ID value; for example, instance A i,r There are two source instance icons, with id values ​​of 2 and 4 respectively. Then, the SD of the instance icon is i,r=(2+4) / 2=3; if there is only one source instance icon, the id value of the corresponding source instance icon is used as SD i,r If the instance icon does not have a corresponding source instance icon, then SD i,r =0; TD i,r The value method and SD i,r The value of TD is the same as i The value method and SD i The method of obtaining the value of is the same and will not be repeated here.

[0030] In the present embodiment, the first vector of each instance icon established includes not only the ID value of the corresponding instance icon itself and the corresponding instance icon group ID value, but also includes the source instance icon corresponding to the instance icon and the instance icon group ID value corresponding to the source instance icon and the target instance icon and the instance icon group ID value corresponding to the target instance icon. That is, the first vector of each instance icon includes the instance icon itself and the instance icons associated with the instance icon. Therefore, when calculating the similarity between the first vector of the instance icon and each first initial center point vector, the influence of inaccurate clustering caused by inaccurate setting of the instance icon's own ID value can be weakened, making the clustering more accurate and reasonable.

[0031] S400, clustering the first vectors corresponding to all instance icons in the original topology map into k clusters using a canopy clustering algorithm, so as to obtain first initial center point vectors corresponding to each of the k clusters and a maximum value n of the number of first vectors in each cluster.

[0032] In this embodiment, the above steps S100-S300 establish the first vector of each instance icon, and can use the preset canopy clustering algorithm to cluster the first vectors corresponding to all instance icons in the original topology map into k clusters, and can determine the cluster containing the most instance icons from the k clusters, obtain the number of instance icons in the cluster, and obtain n.

[0033] It should be noted that the canopy clustering algorithm uses a distance threshold setting method to perform clustering, so that some of the first vectors in each cluster obtained by clustering are repeated, which can make the number of first vectors in each cluster obtained by clustering more balanced, but the clustering accuracy is poor; this embodiment uses the clustering results of the canopy clustering algorithm to determine k and n; so that the number of first vectors in each first vector list obtained by subsequent clustering will not exceed n; thereby, it can avoid the situation where the number of first vectors in a first vector list is extremely large, while the number of first vectors in other first vector lists is extremely small, so that the number of first vectors in each first vector list is relatively balanced.

[0034] S500, clustering the first vectors corresponding to all instance icons in the original topology map according to k first initial center point vectors and n, using a preset first clustering algorithm to obtain k first vector lists; wherein the number of first vectors in each first vector list is less than or equal to n.

[0035] In this embodiment, the preset first clustering algorithm can perform clustering by calculating the similarity between the first vector and each first initial center point vector, obtain the first initial center point vector with the highest similarity between the first vector and each first initial center point vector, and divide the first vector into the first vector list corresponding to the first initial center point vector; thereby, it can be ensured that the first vectors in each cluster will not overlap, and the number of first vectors in each cluster does not exceed n, thereby avoiding the situation where the number of first vectors in a certain first vector list is extremely large, while the number of first vectors in other first vector lists is extremely small, so that the number of first vectors in each first vector list is relatively balanced.

[0036] S600: In response to a user clicking on any instance icon in the original topology map, an instance icon corresponding to each first vector in a first vector list including the first vector corresponding to the instance icon is displayed.

[0037] In this embodiment, when the user clicks on any instance icon, the first vector of the instance icon is obtained, the first vector list including the first vector of the instance icon is used as the target first vector list, and the instance icon corresponding to each first vector in the target first vector list is displayed.

[0038] The processing method of the instance icons of the present embodiment is to divide each instance icon into a corresponding instance icon group according to the instance type of each instance icon in the topological map, and then set the ID value of each instance icon and the instance icon group. At this time, the similarity of each instance icon in the same instance icon group is relatively high; then, according to the ID values ​​of the instance icons and the instance icon group set above, the source instance icons corresponding to each instance icon and the instance icon group ID values ​​corresponding to the source instance icons, and the target instance icons corresponding to each instance icon and the instance icon group ID values ​​corresponding to the target instance icons, the source instance icon and the target instance icon of any instance icon are instance icons with a certain association relationship with the instance icon; then, according to the first vectors corresponding to each instance icon and the first initial center point vectors corresponding to the k clusters, the first vectors with higher similarity are divided into the same first vector list, so that each first vector is divided into k first vector lists. When the developer views a certain instance icon, he can display all the instance icons corresponding to each first vector in the first vector list including the first vector corresponding to the target instance icon according to the first vector of the instance icon to be viewed, thereby improving the query efficiency.

[0039] Furthermore, the first vector of each instance icon established includes not only the ID value of the corresponding instance icon itself and the corresponding instance icon group ID value, but also the source instance icon corresponding to the instance icon and the instance icon group ID value corresponding to the source instance icon and the target instance icon and the instance icon group ID value corresponding to the target instance icon. That is, the first vector of each instance icon includes the instance icon itself and the instance icons that have an associated relationship with the instance icon. Therefore, when calculating the similarity between the first vector of the instance icon and the k first initial center point vectors, the impact of inaccurate clustering caused by inaccurate setting of the instance icon's own ID value can be weakened, making the clustering more accurate and reasonable.

[0040] Furthermore, the canopy clustering algorithm uses a method of setting a distance threshold for clustering, so that some of the first vectors in each cluster obtained by clustering are repeated, which can make the number of first vectors in each cluster obtained by clustering more balanced, but the clustering accuracy is poor; when the present application clusters each first vector into k first vector lists, the clustering results of the canopy clustering algorithm are used to set the maximum value n of the number of first vectors that can be accommodated in each first vector list, so that the number of first vectors in each first vector list does not exceed n; thereby, it can avoid the situation where the number of first vectors in a first vector list is extremely large, while the number of first vectors in other first vector lists is extremely small, so that the number of first vectors in each first vector list is relatively balanced, and the similarity between each first vector in each first vector list is relatively high.

[0041] In an exemplary embodiment, step S500 includes the following steps:

[0042] S510, preset k first original sets, obtain a first original set list S 1 =(S 1 1 ,S 1 2 ,…,S 1 e ,…,S 1 k ), e=1,2,…,k; where S 1 e is the e-th first original set; each first original set in the initial state is an empty set; each first original set corresponds to a first initial center point vector, and the first initial center point vectors corresponding to any two first original sets are different;

[0043] S511, obtain j0=1; wherein j0 is the first variable.

[0044] S512, obtaining the j0th first vector.

[0045] S513, obtaining a first set currently including a first vector number less than n, and obtaining a first set list LS 1 =(LS 1 1 ,LS 1 2 ,…,LS 1 p ,…,LS 1 q ), p=1,2,…,q; q≤k; LS 1 p For LS 1 The pth first set in the pth first set, q is the number of the first original sets whose number of first vectors currently contained is less than n.

[0046] In this embodiment, it can be understood that LS 1 The number of first vectors in each first set is less than n; thus, it can be ensured that when the j0th first vector is divided, the number of first vectors in any first set will not be greater than n.

[0047] S514, obtaining the similarity between the j0th first vector and the first initial center point vector corresponding to each first set, and obtaining a first similarity set TLS 1 =(TLS 1 j0,1 ,TLS 1 j0,2 ,…,TLS 1 j0,p ,…,TLS 1 j0,q ), where TLS 1 j0,p is the similarity between the j0th first vector and the first initial center point vector corresponding to the pth first set.

[0048] The similarity between the first vector and the first initial center point vector corresponding to the first original set can be expressed by the Euclidean distance between the two. The smaller the Euclidean distance between the first vector and the first initial center point vector corresponding to the first original set, the greater the similarity between the first vector and the first initial center point vector corresponding to the first original set; conversely, the smaller the similarity between the first vector and the first initial center point vector corresponding to the first original set.

[0049] S515, add the j0th first vector to TLS 1 max The corresponding first original set, where TLS 1 max =MAX(TLS 1j0,1 ,TLS 1 j0,2 ,…,TLS 1 j0,p ,…,TLS 1 j0,q ); MAX() is the maximum value function.

[0050] Add the j0th first vector to TLS 1 max In the corresponding first original sets, it can be ensured that the same first vector will not be added to two or more first original sets.

[0051] S516, if j0<Y, obtain j0=j0+1 and go to step S512, otherwise, go to step S517; wherein Y is the number of instance icons in the original topology map.

[0052] S517, updating the first initial center point vector corresponding to each first original set, and entering step S510, until a preset end condition is met, to obtain a list of k first vectors.

[0053] The preset end condition may be the number of clustering times, or may be that the center point vector obtained by the last clustering is the same as the center point vector obtained by the previous clustering.

[0054] In an exemplary embodiment, after step S500 and before step S600, the method includes the following steps:

[0055] S520, if u<k, obtain QA i,r The corresponding second vector EA i,r =(SD i -ZD i ,ZD i ,ZD i -TD i ), where u is the number of first vector lists preset by the user.

[0056] In this embodiment, when the user does not set the number of first vector lists, the above embodiment can cluster each first vector into k first vector lists; and when the user sets the number of clusters u, it is necessary to judge the size of k and u; if u<k, it means that the number of first vector lists obtained by clustering is large, and it is necessary to perform secondary clustering on each first vector in the obtained k clusters; firstly, vector conversion is performed on each first vector to obtain a second vector corresponding to each instance icon; it can be understood that the first vectors in the k first vector lists obtained in the above steps are already relatively similar, so if a more detailed clustering is performed on each instance in the k clusters, it is necessary to group the first vectors corresponding to the instance icons of the corresponding instance icon groups that are relatively similar together; therefore, each parameter in the above second vector only considers the instance icon group ID value, so as to cluster the first vectors corresponding to the instance icons of the corresponding instance icon groups that are relatively similar together in the subsequent clustering process.

[0057] S521, obtaining the average vector of each second vector corresponding to each first vector in each first vector list, so as to obtain an average vector set Z=(Z 1 ,Z 2 ,…,Z a ,…,Z k ), a=1,2,…,k; where Z a is the average vector corresponding to the a-th first vector list.

[0058] In this embodiment, the method for obtaining the average vector of the second vectors corresponding to all instance icons in the first target cluster is as follows:

[0059] The average value of the first parameters of each second vector corresponding to each first vector in any first vector list is obtained as the first parameter of the average vector corresponding to the first target cluster. The method for obtaining the second parameter and the third parameter of the average vector corresponding to the first vector list is the same as the method for obtaining the first parameter, which will not be repeated here; thereby obtaining Z.

[0060] S522, randomly select an average vector from Z as the second initial center point vector.

[0061] S523, determining u third initial center point vectors according to the second initial center point vector and the k-means++ algorithm.

[0062] Those skilled in the art may use the existing k-means++ algorithm and the second initial center point vector to determine u third initial center point vectors according to actual needs, which will not be elaborated here.

[0063] S524, preset u second original sets, obtain a second original set list S 2 =(S2 1 ,S 2 2 ,…,S 2 e0 ,…,S 2 u ), e0=1,2,…,u; where S 2 e0 is the e0th second original set; each second original set in the initial state is an empty set; each second original set corresponds to a third initial center point vector, and the third initial center point vectors corresponding to any two second original sets are different.

[0064] S525, obtaining g=1; wherein g is the second variable.

[0065] S526, obtaining the similarity between the g-th second vector and the third initial center point vector corresponding to each second original set, and obtaining a second similarity set TLS 2 =(TLS 2 g,1 ,TLS 2 g,2 ,…,TLS 2 g,e0 ,…,TLS 2 g,u ), where TLS 2 g,e0 is the similarity between the e0th second vector and the third initial center point vector corresponding to the e0th second original set.

[0066] The similarity between the second vector and the third initial center point vector corresponding to the second original set can be expressed by the Euclidean distance between the two. The smaller the Euclidean distance between the second vector and the third initial center point vector corresponding to the second original set, the greater the similarity between the second vector and the third initial center point vector corresponding to the second original set; conversely, the smaller the similarity between the second vector and the third initial center point vector corresponding to the second original set.

[0067] S527, add the g-th second vector to TLS 2 max The corresponding second original set, where TLS 2 max =MAX(TLS 2 g,1 ,TLS 2 g,2 ,…,TLS 2 g,e ,…,TLS 2 g,u ); MAX() is the maximum value function.

[0068] S528, if g<Y, obtain g=g+1 and go to step S526; otherwise, go to step S529; wherein Y is the number of instance icons in the original topology map.

[0069] S529, updating the third initial center point vectors corresponding to each second original set, and entering step S524, until a preset end condition is met, to obtain u first vector lists.

[0070] In this embodiment, the second vectors are clustered to obtain u second vector lists, and then according to the corresponding relationship between the second vectors and the first vectors, u first vector lists can be obtained.

[0071] Therefore, when u<k, the k first vector lists are clustered twice to obtain the number u of first vector lists set by the user; and in the secondary clustering process, clustering is performed according to the second vector, and based on the results of the first clustering, the instance models corresponding to the first vectors that are relatively similar can be clustered together.

[0072] If m=n, steps S520-S529 need not be performed.

[0073] In an exemplary embodiment, after step S500 and before step S600, the method further includes the following steps:

[0074] S530, obtaining L=0; wherein L is a third variable.

[0075] S531, if u>2 L ×k, obtain the two first vectors with the smallest similarity in each first vector list as the two fourth initial center point vectors corresponding to each first vector list; wherein u is the number of first vector lists preset by the user.

[0076] If u>2 L ×k, it means that the number of first vector lists obtained by clustering is small and fails to meet the number of first vector lists set by the user. It is necessary to first divide more first vector lists, determine two first vectors with the smallest similarity from one first vector list, and then divide the corresponding vector list into two first vector lists according to the two first vectors.

[0077] S532, preset two third original sets; each third original set in an initial state is an empty set; each third original set corresponds to a fourth initial center point vector.

[0078] S533, get H y =1, y = 1; where H y is the fourth variable.

[0079] S534, obtain the Hth vector in the yth first vector list y The similarities λ1 and λ2 between the first vector and the two fourth initial center point vectors.

[0080] The similarity between the first vector and the fourth initial center point vector can be represented by the Euclidean distance between the two. The smaller the Euclidean distance between the first vector and the fourth initial center point vector, the greater the similarity between the first vector and the fourth initial center point vector; conversely, the smaller the similarity between the first vector and the fourth initial center point vector.

[0081] S535, the H y The first vector is added to λ max The corresponding third original set; where λ max =MAX(λ1,λ2);

[0082] S536, if H y <H 0 y , then H y =H y +1, and go to step S534, otherwise, execute S537; wherein H 0 y is the number of first vectors in the yth first vector list.

[0083] S537, if y<k, then y=y+1, and go to step S534.

[0084] S538, if u>2 L+1 ×k, then L=L+1, and the process goes to step S531 until each first vector list is divided into W target vector lists, and W≥u.

[0085] In this embodiment, the purpose of the above steps is to divide the k first vector lists into a larger number of target vector lists to satisfy W≥u, so that the steps in step S520 can be executed to finally obtain u first vector lists.

[0086] S539, replace the value of k with the value of W and use the target vector list as the first vector list, and go to step S520 to obtain u first vector lists.

[0087] In this embodiment, when u>k, the u first vector lists that the user wants to obtain can also be obtained to meet the user's requirement on the number of clusters.

[0088] Further, QA i,r With LS 1 p The similarity between the corresponding first initial center point vectors satisfies the following formula:

[0089] d i,r =(k 1 (SD i,r -C p 1 ) 2 +k 2 (SD i -C p 2 ) 2 +k 1 (D i,r -C p 3 ) 2 +k 2 (D i -C p 4 ) 2 +k 1 (TD i,r -C p 5 ) 2 +k 2 (TD i -C p 6 )) 1 / 2 ;

[0090] Among them, d i,r For QA i,r With LS 1 p The similarity between the corresponding first initial center point vectors, C p 1 For LS 1 p The corresponding first initial center point vector corresponds to the mean of the id values ​​of all source instance icons corresponding to the instance icon, C p 2 For LS 1 p The first initial center point vector corresponds to the mean of the ID values ​​of several instance icon groups corresponding to the instance icon, C p 3 For LS 1 p The corresponding first initial center point vector corresponds to the id value of the instance icon, C p 4 For LS 1 p The first initial center point vector corresponds to the instance icon group ID value corresponding to the instance icon, C p 5 For LS 1 pThe mean of the id values ​​of all target instance icons corresponding to the instance icon corresponding to the first initial center point vector, C p 6 For LS 1 p The first initial center point vector corresponds to the instance icon corresponding to the mean of the ID values ​​of the instance icon groups corresponding to all the target instance icons; k 1 is the preset first weight, k 2 is the preset second weight, k 1 <k 2 , k 1 +k 2 =1;QA i,r With LS 1 p The similarity between the corresponding first initial center point vector and d i,r The values ​​are negatively correlated.

[0091] In this embodiment, when the instance models corresponding to several instance icons are the same, it can be considered that these instance icons should belong to one category; therefore, the weight k of the instance icon group corresponding to the instance icon is set. 2 Greater than the weight k of the instance icon 1 , making the calculation of Euclidean distance more reasonable and accurate.

[0092] Preferably, k 1 =0.35, k 2 =0.65; According to the analysis of multiple test results, when k 1 =0.35, k 2 When =0.65, the clustering effect of the topological graph clustering method of the present application is the best.

[0093] Furthermore, before step S100, the method further includes the following steps:

[0094] S010, obtaining the number M of instance icons in the original topology map.

[0095] S020, if M ≥ M 0 , then execute step S100; wherein, M 0 It is the preset instance icon quantity threshold.

[0096] In this embodiment, for multiple original topology maps, for any original topology map obtained, the number of instance icons in the original topology map is first obtained. If W ≥ W 0 , only then will the subsequent clustering be performed; thereby, it can be avoided that the clustering step is also performed when the number of instance icons in the original topology diagram is small, resulting in a waste of resources.

[0097] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0098] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to implementing a method in a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiment.

[0099] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0100] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0101] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0102] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0103] An embodiment of the present invention further provides an electronic device, comprising a processor and the aforementioned non-transitory computer-readable storage medium.

[0104] The electronic device according to this embodiment of the present application is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0105] The electronic device is presented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: the at least one processor mentioned above, the at least one storage device mentioned above, and a bus connecting different system components (including storage devices and processors).

[0106] The storage stores program codes, which can be executed by the processor, so that the processor executes the steps described in the above “exemplary method” section of this specification according to various exemplary embodiments of the present application.

[0107] The memory may include readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read only memory (ROM).

[0108] The storage may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.

[0109] The bus may represent one or more of several types of bus structures including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.

[0110] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device (e.g., routers, modems, etc.) that enables the electronic device to communicate with one or more other computing devices. Such communication may be performed through an input / output (I / O) interface. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0111] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0112] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.

[0113] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.

Claims

1. A method for processing an instance icon, characterized in that: The method comprises the following steps: S100, obtaining an original topology map; the original topology map includes a plurality of instance icons and directed edges connecting the instance icons, the directed edges include a first end and a second end, and the direction of each directed edge is from the first end to the second end; each instance icon corresponds to an instance type; each instance icon has at least one source instance icon and / or at least one target instance icon in the original topology map; any instance icon is located at the second end of a directed edge between the corresponding source instance icons or the first end of a directed edge between the corresponding target instance icons; an instance is a model or module with a specific function developed by a program developer when developing a program, and an instance icon is an icon corresponding to the instance; S200, obtaining a list of id values ​​corresponding to each instance icon group corresponding to the original topology map, so as to obtain a list set of instance icon group id values ​​D=(D1, D2, ..., D i ,…,D m ), i=1,2,…,m; where D i is the id value list of the i-th instance icon group, m is the number of instance icon group id value lists; D i =(ZD i ,D i,1 ,D i,2 ,…,D i,r ,…,D i,f(i) ), r=1,2,…,f(i); ZD i is the instance icon group ID value of the i-th instance icon group; D i,r A is the rth instance icon in the i-th instance icon group i,r id value, f(i) is the number of instance icons in the i-th instance icon group; the difference between the ID values ​​of any two instance icon groups is used to represent the similarity between the corresponding two instance icon groups; D i,j =D i,j-1 +1, j=2,3,…,r; D t,1 =D t-1,f(t-1) +1, t=2,3,…,m; the instance types corresponding to the instance icons in the same instance icon group are the same; S300, based on D, establish A i,r The corresponding first vector QA i,r =(SD i,r ,SD i ,D i,r ,ZD i ,TD i,r ,TD i ), where SD i,r A i,r The mean of the id values ​​of all corresponding source instance icons, SD i A i,r The average of the ID values ​​of several instance icon groups corresponding to all source instance icons, TD i,r A i,r The mean of the id values ​​of all corresponding target instance icons, TD i A i,r The average of the ID values ​​of several instance icon groups corresponding to all corresponding target instance icons; S400, clustering the first vectors corresponding to all instance icons in the original topology map into k clusters using a canopy clustering algorithm, so as to obtain the first initial center point vectors corresponding to each of the k clusters and the maximum value n of the number of first vectors in each cluster; S500, clustering the first vectors corresponding to all instance icons in the original topology map using a preset first clustering algorithm according to the k first initial center point vectors and n, to obtain k first vector lists; wherein the number of first vectors in each first vector list is less than or equal to n; S600: In response to a user clicking on any instance icon in the original topology map, an instance icon corresponding to each first vector in a first vector list including the first vector corresponding to the instance icon is displayed.

2. The method for processing instance icons according to claim 1, characterized in that: The step S500 includes the following steps: S510, preset k first original sets, obtain a first original set list S 1 =(S 1 1,S 1 2,…,S 1 e ,…,S 1 k ), e=1,2,…,k; where S 1 e is the e-th first original set; each first original set in the initial state is an empty set; each first original set corresponds to a first initial center point vector, and the first initial center point vectors corresponding to any two first original sets are different; S511, obtaining j0=1; wherein j0 is the first variable; S512, obtaining the j0th first vector; S513, obtaining a first set currently including a number of first vectors less than n, and obtaining a first set list LS 1 =(LS 1 1,LS 1 2,…,LS 1 p ,…,LS 1 q ), p=1,2,…,q; q≤k; LS 1 p For LS 1 The pth first set in , q is the number of the first original sets whose number of first vectors currently contained is less than n; S514, obtaining the similarity between the j0th first vector and the first initial center point vector corresponding to each first set, and obtaining a first similarity set TLS 1 =(TLS 1 j0,1 ,TLS 1 j0,2 ,…,TLS 1 j0,p ,…,TLS 1 j0,q ), where TLS 1 j0,p is the similarity between the j0th first vector and the first initial center point vector corresponding to the pth first set; S515, add the j0th first vector to TLS 1 max The corresponding first original set, where TLS 1 max =MAX(TLS 1 j0,1 ,TLS 1 j0,2 ,…,TLS 1 j0,p ,…,TLS 1 j0,q ); MAX() is the maximum value function; S516, if j0<Y, obtain j0=j0+1 and go to step S512, otherwise, go to step S517; wherein Y is the number of instance icons in the original topology map; S517, updating the first initial center point vector corresponding to each first original set, and entering step S510, until a preset end condition is met, to obtain a list of k first vectors.

3. The method for processing instance icons according to claim 1, characterized in that: After step S500 and before step S600, the method includes the following steps: S520, if u<k, obtain QA i,r The corresponding second vector EA i,r =(SD i -ZD i ,ZD i ,ZD i -TD i ), wherein u is the number of the first vector list preset by the user; S521, obtaining the average vector of each second vector corresponding to each first vector in each first vector list, so as to obtain an average vector set Z=(Z1, Z2, …, Z a ,…,Z k ), a=1,2,…,k; where Z a is the average vector corresponding to the a-th first vector list; S522, randomly selecting an average vector from Z as the second initial center point vector; S523, determining u third initial center point vectors according to the second initial center point vector and the k-means++ algorithm; S524, preset u second original sets, obtain a second original set list S 2 =(S 2 1,S 2 2,…,S 2 e0 ,…,S 2 u ), e0=1,2,…,u; where S 2 e0 is the e0th second original set; each second original set in the initial state is an empty set; each second original set corresponds to a third initial center point vector, and the third initial center point vectors corresponding to any two second original sets are different; S525, obtaining g=1; wherein g is a second variable; S526, obtaining the similarity between the g-th second vector and the third initial center point vector corresponding to each second original set, and obtaining a second similarity set TLS 2 =(TLS 2 g,1 ,TLS 2 g,2 ,…,TLS 2 g,e0 ,…,TLS 2 g,u ), where TLS 2 g,e0 is the similarity between the e0th second vector and the third initial center point vector corresponding to the e0th second original set; S527, add the g-th second vector to TLS 2 max The corresponding second original set, where TLS 2 max =MAX(TLS 2 g,1 ,TLS 2 g,2 ,…,TLS 2 g,e0 ,…,TLS 2 g,u ); MAX() is the maximum value function; S528, if g<Y, obtain g=g+1 and go to step S526; otherwise, go to step S529; wherein Y is the number of instance icons in the original topology map; S529, updating the third initial center point vectors corresponding to each second original set, and entering step S524, until a preset end condition is met, to obtain u first vector lists.

4. The method for processing instance icons according to claim 3, characterized in that: After step S500 and before step S600, the method further includes the following steps: S530, obtaining L=0; wherein L is a third variable; S531, if u>2 L ×k, obtaining two first vectors with the smallest similarity in each first vector list as two fourth initial center point vectors corresponding to each first vector list; wherein u is the number of first vector lists preset by the user; S532, presetting two third original sets; each third original set in an initial state is an empty set; each third original set corresponds to a fourth initial center point vector; S533, get H y =1, y=1; where H y is the fourth variable; S534, obtain the Hth vector in the yth first vector list y Similarities λ1 and λ2 between the first vector and the two fourth initial center point vectors; S535, the H y The first vector is added to λ max The corresponding third original set; where λ max =MAX(λ1,λ2); S536, if H y <H 0 y , then H y =H y +1, and go to step S534, otherwise, execute S537; wherein H 0 y is the number of first vectors in the yth first vector list; S537, if y<k, then y=y+1, and go to step S534; S538, if u>2 L+1 ×k, then L=L+1, and proceed to step S531, until each first vector list is divided into W target vector lists, and W≥u; S539, replace the value of k with the value of W and use the target vector list as the first vector list, and go to step S520 to obtain u first vector lists.

5. The method for processing instance icons according to claim 2, characterized in that: QA i,r With LS 1 p The similarity between the corresponding first initial center point vectors satisfies the following formula: d i,r =(k1(SD i,r -C p 1 ) 2 +k2(SD i -C p 2 ) 2 +k1(D i,r -C p 3 ) 2 +k2(D i -C p 4 ) 2 +k1(TD i,r -C p 5 ) 2 +k2(TD i -C p 6 )) 1 / 2 ; Among them, d i,r For QA i,r With LS 1 p The similarity between the corresponding first initial center point vectors, C p 1 For LS 1 p The corresponding first initial center point vector corresponds to the mean of the id values ​​of all source instance icons corresponding to the instance icon, C p 2 For LS 1 p The first initial center point vector corresponds to the mean of the ID values ​​of several instance icon groups corresponding to the instance icon, C p 3 For LS 1 p The corresponding first initial center point vector corresponds to the id value of the instance icon, C p 4 For LS 1 p The first initial center point vector corresponds to the instance icon group ID value corresponding to the instance icon, C p 5 For LS 1 p The mean of the id values ​​of all target instance icons corresponding to the instance icon corresponding to the first initial center point vector, C p 6 For LS 1 p The first initial center point vector corresponds to the average of the ID values ​​of several instance icon groups corresponding to all target instance icons corresponding to the instance icon; k1 is the preset first weight, k2 is the preset second weight, k1<k2, k1+k2=1; QA i,r With LS 1 p The similarity between the corresponding first initial center point vector and d i,r The values ​​are negatively correlated.

6. The method for processing instance icons according to claim 5, characterized in that: k1=0.35, k2=0.

65.

7. The method for processing instance icons according to claim 1, characterized in that: Before step S100, the method further includes the following steps: S010, obtaining the number M of instance icons in the original topology map; S020, if M≥M0, execute step S100; wherein M0 is a preset instance icon quantity threshold.

8. A non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the storage medium, characterized in that: The at least one instruction or the at least one program is loaded and executed by the processor to implement the method for processing the instance icon as described in any one of claims 1-7.

9. An electronic device, characterized in that: The invention comprises a processor and the non-transitory computer-readable storage medium as claimed in claim 8.

Citation Information

Patent Citations

  • Image clustering method and device, equipment and storage medium

    CN115147633A

  • Abnormal data determination method, electronic equipment and storage medium

    CN115238234A