Source Code Edit Recommendation via Graph Traversal

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Source code migration between different versions is often time-consuming, expensive, and prone to errors due to the tedious and cumbersome nature of identifying and implementing related source code edits.

Innovation Solution

A method that analyzes source code edits to identify groups of co-occurring edits, using graphs such as source code dependency graphs, file system trees, and abstract syntax trees, to recommend related edits and improve the efficiency of source code migration.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If manual source code migration is performed, then code transformation can be completed, but the process is time-consuming and expensive

Engineering Contradiction:
Improvecode migration speedVSAvoidmigration time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system automatically analyzes source code edits and identifies related edits that should be made together, enabling the code migration process to guide itself without constant human intervention. The automated detection and recommendation of co-occurring edits reduces manual effort and accelerates the migration process.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system provides real-time feedback to developers by analyzing detected edits and recommending related edits that should be made contemporaneously. This feedback loop ensures that related code changes are identified and applied together, preventing migration errors and improving efficiency.

Inventive Principle:
Principle #23Feedback

2Reliability

If comprehensive source code analysis is performed to identify all related edits, then migration accuracy improves, but the complexity of the process increases

Engineering Contradiction:
Improvemigration accuracyVSAvoidanalysis process complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The code base is divided into manageable source code snippets or files, and edits are analyzed at this granular level. By segmenting the analysis into smaller units, the system can comprehensively examine related edits without being overwhelmed by the entire code base, maintaining accuracy while managing complexity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system acts as an intermediary between the developer's intended edit and the actual migration outcome. It analyzes the detected edit, identifies related edits through graph traversal and pattern matching, and presents recommendations that bridge the gap between partial manual input and complete accurate migration.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Reliability

If developers manually track all related source code edits, then co-occurring edits can be implemented consistently, but the work becomes tedious and error-prone

Engineering Contradiction:
Improveedit consistencyVSAvoidoperation simplicity
Core Design Contradiction:
ReliabilityVSEase of operation

Solution Approach 1:

The system automatically performs the tedious task of tracking and identifying related edits without requiring manual effort from developers. By self-service detection and recommendation of co-occurring edits, the system ensures consistent implementation while eliminating the cumbersome manual tracking process.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system provides immediate feedback to developers about which edits should be made together, ensuring consistent implementation of co-occurring changes. This automated feedback mechanism replaces manual tracking and reduces errors while maintaining ease of operation.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS12265804B2Identification and application of related source code edits
Publication Date: 2025.04.01 GOOGLE LLC
  • US12265804B2 patent drawing
  • US12265804B2 patent drawing
  • US12265804B2 patent drawing

AI summary

Implementations are described herein for identifying related source code edits to perform, or to aid in the performance of, various programming tasks. In various implementations, a first edit made to a first source code snippet in a source code editor may be detected. Based on the first edit, a second source code edit to be made to a second source code snippet may be identified. The identifying may include: traversing one or more graphs to determine one or more edge sequences between nodes corresponding to the first and second source code snippets, comparing the one or more edge sequences to a plurality of reference edge sequences between nodes corresponding to historical co-occurrences of the first and second code edits, and identifying the second edit based on the comparing. The source code editor may provide output that includes a recommendation to implement the second edit.