# US 2022/0035609 A1 · Graph-based vectorization for software code optimizations

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0035609 A1
- Document ID: US20220035609A1
- Status: Published application
- Kind: A1
- Application number: 16/941,832
- Filed: 2020-07-29
- Published: 2022-02-03
- Earliest claimed: 2020-07-29
- Assignees: Bank of America Corporation
- Applicants: Bank of America Corporation
- Inventors: Tamilselvi Elango; Madhusudhanan Krishnamoorthy
- Web page: https://patentgrep.com/patent/US20220035609A1

## CPC

- G06F 8/443: {Optimisation}
- G06F 8/4441: {Reducing the execution time required by the program code}
- G06F 8/4434: {Reducing the memory space required by the program code}
- G06F 8/447: {Target code generation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A software code optimizer automatically detects inefficiencies in software code and corrects them. Generally, the software code optimizer converts software code into a graph representing the workflows and relationships in the software code. The graph is then converted into vectors that represent each workflow in the software code. The vectors are assembled into a matrix that represents the software code. The matrix may be stored in a cluster in a database as an example of optimized software code or be compared with other matrices stored as clusters in the database to determine whether the software code is optimized. The software code optimizer can change the software code to be more efficient if a matrix for an optimized version of the software code is found in the database.

## Claims

### Claim 1

An apparatus comprising:
a memory; and
a hardware processor communicatively coupled to the memory, the hardware processor configured to:
receive software code;
convert the software code into a graph that represents a plurality of workflows through the software code;
convert the graph into a plurality of vectors, each vector of the plurality of vectors comprising a numerical representation of a workflow of the plurality of workflows;
assemble the vectors into a first matrix;
retrieve, from a database, a second matrix and a third matrix;
compare the first matrix with the second and third matrices;
determine, based on comparing the first matrix with the second and third matrices, that the first matrix is closer to the second matrix than the third matrix;
in response to determining that the first matrix is closer to the second matrix than the third matrix, convert the second matrix into reference software code;
compare the reference software code to the received software code to determine a difference between the reference software code and the received software code; and
change the received software code to resolve the difference between the reference software code and the received software code.

### Claim 2 (depends on 1)

The apparatus of claim 1, the hardware processor further configured to remove a comment from the received software code before converting the received software code into the graph.

### Claim 3 (depends on 1)

The apparatus of claim 1, wherein converting the received software code into the graph comprises breaking the received software code into a plurality of portions, each portion of the plurality of portions comprises a workflow of the plurality of workflows.

### Claim 4 (depends on 1)

The apparatus of claim 1, wherein resolving the difference between the reference software code and the received software code reduces at least one of a memory utilization and an execution time of the received software code when the received software code is executed.

### Claim 5 (depends on 1)

The apparatus of claim 1, wherein the second and third matrices are stored in a cluster in the database.

### Claim 6 (depends on 1)

The apparatus of claim 1, wherein determining that the first matrix is closer to the second matrix than the third matrix comprises:
determining a first distance between the first matrix and the second matrix;
determining a second distance between the first matrix and the third matrix; and
determining that the first distance is shorter than the second distance.

### Claim 7 (depends on 1)

The apparatus of claim 1, the hardware processor further configured to store the first matrix in the database as part of a cluster comprising the second and third matrices.

### Claim 8

A method comprising:
receiving, by a hardware processor communicatively coupled to a memory, software code;
converting, by the hardware processor, the software code into a graph that represents a plurality of workflows through the software code;
converting, by the hardware processor, the graph into a plurality of vectors, each vector of the plurality of vectors comprising a numerical representation of a workflow of the plurality of workflows;
assembling, by the hardware processor, the vectors into a first matrix;
retrieving, by the hardware processor and from a database, a second matrix and a third matrix;
comparing, by the hardware processor, the first matrix with the second and third matrices;
determining, by the hardware processor and based on comparing the first matrix with the second and third matrices, that the first matrix is closer to the second matrix than the third matrix;
in response to determining that the first matrix is closer to the second matrix than the third matrix, converting, by the hardware processor, the second matrix into reference software code;
comparing, by the hardware processor, the reference software code to the received software code to determine a difference between the reference software code and the received software code; and
changing, by the hardware processor, the received software code to resolve the difference between the reference software code and the received software code.

### Claim 9 (depends on 8)

The method of claim 8, further comprising removing, by the hardware processor, a comment from the received software code before converting the received software code into the graph.

### Claim 10 (depends on 8)

The method of claim 8, wherein converting the received software code into the graph comprises breaking the received software code into a plurality of portions, each portion of the plurality of portions comprises a workflow of the plurality of workflows.

### Claim 11 (depends on 8)

The method of claim 8, wherein resolving the difference between the reference software code and the received software code reduces at least one of a memory utilization and an execution time of the received software code when the received software code is executed.

### Claim 12 (depends on 8)

The method of claim 8, wherein the second and third matrices are stored in a cluster in the database.

### Claim 13 (depends on 8)

The method of claim 8, wherein determining that the first matrix is closer to the second matrix than the third matrix comprises:
determining a first distance between the first matrix and the second matrix;
determining a second distance between the first matrix and the third matrix; and
determining that the first distance is shorter than the second distance.

### Claim 14 (depends on 8)

The method of claim 8, further comprising storing, by the hardware processor, the first matrix in the database as part of a cluster comprising the second and third matrices.

### Claim 15

A system comprising:
a database; and
a software code optimizer comprising a memory and a hardware processor communicatively coupled to the memory, the hardware processor configured to:
receive software code;
convert the software code into a graph that represents a plurality of workflows through the software code;
convert the graph into a plurality of vectors, each vector of the plurality of vectors comprising a numerical representation of a workflow of the plurality of workflows;
assemble the vectors into a first matrix;
retrieve, from the database, a second matrix and a third matrix;
compare the first matrix with the second and third matrices;
determine, based on comparing the first matrix with the second and third matrices, that the first matrix is closer to the second matrix than the third matrix;
in response to determining that the first matrix is closer to the second matrix than the third matrix, convert the second matrix into reference software code;
compare the reference software code to the received software code to determine a difference between the reference software code and the received software code; and
change the received software code to resolve the difference between the reference software code and the received software code.

### Claim 16 (depends on 15)

The system of claim 15, the hardware processor further configured to remove a comment from the received software code before converting the received software code into the graph.

### Claim 17 (depends on 15)

The system of claim 15, wherein converting the received software code into the graph comprises breaking the received software code into a plurality of portions, each portion of the plurality of portions comprises a workflow of the plurality of workflows.

### Claim 18 (depends on 15)

The system of claim 15, wherein resolving the difference between the reference software code and the received software code reduces at least one of a memory utilization and an execution time of the received software code when the received software code is executed.

### Claim 19 (depends on 15)

The system of claim 15, wherein the second and third matrices are stored in a cluster in the database.

### Claim 20 (depends on 15)

The system of claim 15, wherein determining that the first matrix is closer to the second matrix than the third matrix comprises:
determining a first distance between the first matrix and the second matrix;
determining a second distance between the first matrix and the third matrix; and
determining that the first distance is shorter than the second distance.
