Degree of "Parentality" in the graph

From Wiki Algonomia
Jump to navigation Jump to search

Introduction to the Problem

In the analysis of shareholding structures, graphs are used to represent the relationships between different entities (like individuals, companies, etc.). Nodes in the graph represent entities, and edges represent shareholding relationships. The key goal is to determine the degree of influence or control one entity (parent) has over another (infant). This is achieved by calculating the minimal distance between each pair of nodes in the graph.

Algorithm Explanation

Recursive Algorithm for Minimal Distance

The algorithm for finding the minimal distance between two nodes in a graph, especially in cases with potential loops, includes:

  1. Initialization: Start from a source node.
  2. Recursive Function:
    • If the current node is the target, return the current distance.
    • If the current node has been visited (to handle loops), return an infinite distance.
    • Recursively visit each unvisited neighbor, incrementing the distance.
    • The minimal distance is the smallest value returned by the recursive calls.
  3. Termination: The function returns the minimal distance after exploring all paths.

Handling Loops

To manage loops in the graph, the algorithm keeps track of visited nodes. When a node is revisited, it indicates a loop, and that path is not considered in the minimal distance calculation.

Numeric Example

Data Table (Complex Graph)

Entity (Node) Shares Held in (Edges)
A B, C
B C, D, E
C D, F
D E
E A (loop), F
F

Corresponding Graph

The graph is shown below:

Calculating Minimal Distances

  • Distance Calculation: The algorithm computes distances from each node to every other node, considering the shortest path and avoiding loops.
  • Example Calculations:
    • Distance from A to E is 4 (A → B → C → D → E).
    • Distance from E to A is infinite due to the loop.

Resulting Adjacency Matrix

A B C D E F
A 0 1 2 3 4 3
B 0 1 2 3 2
C 0 1 2 1
D 0 1
E 0 1
F 0

Conclusion

This recursive algorithm is designed to calculate the minimal distances between all pairs of nodes in a shareholding structure graph. The complex graph example and the resulting matrix demonstrate the algorithm's capability to handle intricate relationships and loops within a network.