Equity Penetration with Graph Algorithms and LLMs: How to Trace Ultimate Beneficial Owners
A practical guide to equity penetration: how to trace shareholders up to natural persons using graph algorithms, handle cycles and multi-path accumulation correctly, and combine LLMs to extract hidden ownership information from unstructured documents.
What Problem Does Equity Penetration Solve?
Equity penetration means tracing a company’s shareholder relationships layer by layer until natural persons are reached. It is widely used in enterprise risk control, anti-money laundering (AML), investment analysis, and M&A due diligence.
Three closely related concepts are often involved and should be distinguished first:
- Shareholder: An entity that directly holds equity in a company according to business registration records. It can be either a company or a natural person.
- UBO (Ultimate Beneficial Owner): A natural person who indirectly enjoys the benefits or control of a company through shareholding, voting rights, or other arrangements. This is the concept most commonly used in AML scenarios.
- Actual controller: A person who can determine a company’s operations and major decisions. This concept is mostly used in corporate governance and accounting standards.
Equity ratio penetration is not the same as control determination. A person with a low ownership percentage may control a company through acting-in-concert agreements, board seats, or veto rights. Conversely, a person with a high ownership percentage may not have actual decision-making power due to arrangements such as voting rights delegation. Therefore, the ratios obtained through penetration are only a starting point for judgment; final conclusions must also take agreements and governance arrangements into account.
Why Complex Ownership Structures Are Hard to Handle
Real-world corporate ownership structures are often complex, with three main types of difficulties.
First, complex graph structures. Companies may hold cross-shareholdings or even circular ownership—for example, A holds B, B holds C, and C holds A again. Multi-layer nesting causes the number of paths to grow rapidly.
Second, key information is not in structured data. Nominee holding agreements, side agreements, and arrangements involving concealed shareholders usually do not appear in the structured fields of business registration data. Instead, they are written into contracts, articles of association, legal documents, or financial report footnotes.
Third, data changes over time. Equity transfers, capital increases, and capital reductions all change the structure, so every query must specify an as-of date.
Graph Algorithm Approach: Backtracking Along the Shareholder Direction
By modeling companies and natural persons as nodes in a graph and shareholding relationships as directed edges, equity penetration can be performed with graph algorithms. Each edge carries an ownership ratio. Penetration should start from the target company and find shareholders by following the edges pointing to it—that is, traversing in-edges. A common but incorrect approach starts from the company and traverses out-edges, which actually walks toward its subsidiaries—the direction is reversed.
Penetration ratios are multiplied along each path. Suppose a natural person holds shares through two layers of companies: 60% in the first layer and 50% in the second. The cumulative ratio for that path is 30%. If the same natural person holds shares through multiple paths, the ratios of all paths should be summed.
A common flawed implementation uses a global visited set for deduplication, which causes under-reporting. If a company is first visited via a low-ratio path, it will be skipped entirely when reached again via a high-ratio path, losing the beneficial owners contributed by the high-ratio path. The improved approach detects cycles per path: an entity is only skipped if it re-appears within the same path, and multiple paths leading to the same natural person are accumulated.
The following code demonstrates the improved logic:
from collections import deque, defaultdictdef equity_penetration(graph, start_company, threshold=0.25,min_ratio=0.01, max_depth=10):"""Backtrack along the shareholder direction and compute thecumulative ownership ratio of each natural person.graph: graph query interface; get_in_edges(entity) returns thelist of shareholding edges pointing to that entitystart_company: ID of the starting companythreshold: minimum cumulative ownership ratio to qualify as a UBOmin_ratio: pruning threshold for cumulative path ratiosmax_depth: maximum traversal depth to bound path explosion"""# Traverse in-edges: each item carries (holder_entity, ratio)# Maintain the current path for per-path cycle detection# Accumulate results per natural person across multiple paths...
Key implementation points:
- Traverse in-edges only, so the search follows the shareholder direction rather than the subsidiary direction.
- Multiply ownership ratios along each path, and sum ratios across paths for the same natural person.
- Use per-path cycle detection instead of a global
visitedset to avoid losing high-ratio paths. - Apply a minimum-ratio threshold (
min_ratio) for pruning and a depth limit (max_depth) to control path explosion, then filter natural persons whose cumulative ratio reaches the UBO threshold.
Combining Graph Algorithms with LLMs
Graph algorithms handle the structured part of the problem well, but as noted above, critical information—nominee agreements, side agreements, and concealed shareholder arrangements—lives in unstructured documents such as contracts, articles of association, legal documents, and financial report notes.
This is where large language models (LLMs) come in. A practical pipeline works as follows:
- Graph algorithm layer: Run the penetration algorithm described above on structured registration data to compute cumulative ownership ratios and candidate UBOs.
- LLM extraction layer: Feed relevant documents to an LLM to extract entities and relationships—such as nominee holding arrangements, acting-in-concert agreements, or voting rights delegations—that do not exist in structured fields.
- Fusion layer: Merge the LLM-extracted relationships back into the graph, re-run the penetration algorithm, and generate a final report that explains both the computed ratios and the qualitative control factors found in documents.
This division of labor plays to each side’s strengths: graph algorithms provide deterministic, auditable ratio computation, while LLMs cover the long tail of information hidden in text. The combined result is more complete than either approach alone—but the final determination of beneficial ownership still requires human review of the underlying agreements and governance arrangements.
