Directed Graph Algorithm Grouping for Program Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current methods for analyzing program performance are inefficient due to the need for method-by-method analysis, which fails to detect similar logics and often results in suboptimal performance improvements, especially in large programs where no frequently used methods exist.
Innovation Solution
A method that converts algorithms into directed graphs, compares them to representative graphs to determine similarity, and groups them based on execution frequency, allowing for the identification and optimization of similar logics within the program context.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If program performance analysis is performed on a method-by-method basis, then detailed analysis of each method is achieved, but the analysis becomes inefficient and fails to detect similar logics in large programs
Solution Approach 1:
The patent merges multiple algorithms into algorithm groups based on structural similarity. By converting algorithms to directed graphs and comparing their structures, the system combines algorithms with similar control flow patterns into groups, enabling analysis at the group level rather than individual method level, thus improving efficiency while maintaining detection capability
Solution Approach 2:
The patent creates representative directed graphs that copy the essential structural characteristics of algorithm groups. These representative graphs serve as templates for comparing new algorithms, allowing the system to detect similar logics without examining every algorithm in detail, thereby resolving the contradiction between analysis depth and efficiency
2Manufacturing precision
If traditional code similarity methods (e.g., CCFinder) are used to detect similar codes, then token-level matching is achieved, but differences in logic (e.g., for loop vs. while loop) cannot be handled
Solution Approach 1:
The patent transitions from token-level one-dimensional matching to graph-structure multi-dimensional comparison. By representing algorithms as directed graphs with nodes and edges capturing control flow relationships, the system can detect structural similarities even when surface-level tokens differ, thus handling logic variations like different loop constructs
Solution Approach 2:
The patent changes the comparison parameters from lexical tokens to structural graph features. By focusing on the topological structure of directed graphs (nodes representing basic blocks and edges representing control flow), the system becomes adaptable to different programming constructs that implement the same logic, resolving the limitation of traditional token-based methods
3Loss of information
If all algorithms in large programs are analyzed individually, then comprehensive performance data is obtained, but the analysis time and computational resources increase significantly
Solution Approach 1:
The patent segments the set of all algorithms into algorithm groups based on structural similarity. By dividing the analysis task into group-level analysis rather than individual algorithm analysis, the system reduces the total number of analysis units while maintaining comprehensive coverage through representative sampling within each group
Solution Approach 2:
The patent creates a universal analysis approach that works across different algorithm types by using directed graph representation. The same graph comparison methodology can analyze any algorithm regardless of its specific structure, enabling efficient batch processing of algorithm groups while maintaining comprehensive performance data collection
Data Source
AI summary
A method for grouping algorithms included in a program into groups and thus for assisting in analyzing the program. The method includes the steps of: converting each of the algorithms into a directed graph; judging, as to each representative directed graph stored in a storage unit of a computer system, whether or not the directed graph obtained by the conversion is similar to the representative directed graph; and determining a group to which the directed graph obtained by the conversion belongs from among groups stored in the storage unit in accordance with the similarity judgment. A computer system for performing the above method and a computer program for causing a computer system to perform the above method are also described.


