Basic Example Graph

You can visualize a network as a bipartite graph G=(U,V,E)G = (U, V, E) representing producers UU and buyers VV as nodes, with weighted edges EE capturing transactions between them. Edge weights w(u,v)w(u, v) track the cumulative fees contributed by producer uu from transactions with buyer vv.

To capture both the economic activity and the network influence of each node, we introduce a graph value metric that incorporates eigenvector centrality. For each producer uu, we define the graph value GuG_u as:

Gu=αECu+(1α)(u,v)Ew(u,v)G_u = \alpha \cdot |EC_u| + (1 - \alpha) \cdot \sum_{(u,v)\in E} w(u,v)

Where:

  • ECu|EC_u| is the absolute value of the eigenvector centrality of node uu
  • α\alpha is a tunable parameter between 0 and 1
  • (u,v)Ew(u,v)\sum_{(u,v)\in E} w(u,v) is the sum of all edge weights connected to uu

Using the absolute value in the calculation:

Ensures Non-negativity: This approach guarantees that all centrality measures contribute positively to the graph value, aligning with the typical requirements of token distribution mechanisms where negative contributions are not practical.

Preserves the Interpretative Integrity: While taking the absolute value can sometimes mask the directionality (if relevant), in many network applications, especially those involving token distributions or influence measures, the magnitude of centrality is more critical than its direction.

The eigenvector centrality ECuEC_u is calculated by solving the eigenvector equation:

λx=Ax\lambda \mathbf{x} = A\mathbf{x}

Where:

  • AA is the adjacency matrix of the graph
  • λ\lambda is the largest eigenvalue
  • x\mathbf{x} is the corresponding eigenvector

The eigenvector centrality of a node is its corresponding value in the normalized eigenvector x\mathbf{x}.

This graph value metric GuG_u combines the node's economic activity (represented by the sum of edge weights) with its structural importance in the network (represented by its eigenvector centrality). The parameter α\alpha allows for tuning the balance between these two factors.


Simple Example of a Dynamic Graph

Let's simulate a small network with 2 producers (P1, P2) and 3 buyers (B1, B2, B3). We'll use α=0.5\alpha = 0.5 for our calculations.

In Python, we can define a function calculate_graph_values that performs our calculations with the NetworkX package.

Code
1import numpy as np2import networkx as nx3
4def calculate_graph_values(G, alpha=0.5):5    # Ensure consistent node ordering6    node_order = ['P1', 'P2', 'B1', 'B2', 'B3']7    8    # Create adjacency matrix9    A = nx.to_numpy_array(G, nodelist=node_order)10    11    # Calculate eigenvector centrality12    eigenvalues, eigenvectors = np.linalg.eig(A)13    largest_index = np.argmax(eigenvalues)14    eigenvector = eigenvectors[:, largest_index].real15    16    # Normalize eigenvector17    eigenvector = np.abs(eigenvector) / np.linalg.norm(eigenvector)18    19    # Calculate graph values for producers20    graph_values = {}21    for i, node in enumerate(node_order):22        if node.startswith('P'):23            economic_activity = sum(G[node][neighbor]['weight'] for neighbor in G[node])24            graph_values[node] = alpha * eigenvector[i] + (1 - alpha) * economic_activity25    26    return A, eigenvector, graph_values

Initial transaction graph:#

We will define an initial graph:

Code
1# Create initial graph2G = nx.Graph()3G.add_edge('P1', 'B1', weight=2)4G.add_edge('P2', 'B2', weight=3)5G.add_edge('P2', 'B3', weight=1)

When we run the graph through our calculate_graph_values function as:

Code
A, eigenvector, graph_values = calculate_graph_values(G)

we produce the following results.

P1P2B1B2B3
P100200
P200031
B120000
B203000
B301000

Solving λx=Ax\lambda \mathbf{x} = A\mathbf{x}, we get the normalized absolute eigenvector value for each node:

NodeValue
P10.0000
P20.7071
B10.0000
B20.6708
B30.2236
Was this chapter helpful?