Datalens.ai
← All algorithms

GRAPH-COMMUNITIES

transitivity

Compute graph transitivity, the fraction of all possible triangles.

Example of usage

Identify collaboration structure with transitivity in a six-person, two-department organization.

Usage / limitations

+Use when: Explore employee collaboration patterns, densely connected teams and cross-team bridging.

−Limitations: Results depend on graph topology, edge completeness and algorithm assumptions; small networks are illustrative.

Mathematical formula

See method documentation: implementation and assumptions vary.
Sample dataShow
{
  "variable": "teams",
  "domain": "Cross-team collaboration network",
  "feature_names": [
    "team",
    "department"
  ],
  "nodes": [
    [
      "Ana",
      "Design"
    ],
    [
      "Ben",
      "Design"
    ],
    [
      "Cara",
      "Design"
    ],
    [
      "Dan",
      "Engineering"
    ],
    [
      "Eva",
      "Engineering"
    ],
    [
      "Finn",
      "Engineering"
    ]
  ],
  "edges": [
    [
      "Ana",
      "Ben"
    ],
    [
      "Ben",
      "Cara"
    ],
    [
      "Cara",
      "Ana"
    ],
    [
      "Dan",
      "Eva"
    ],
    [
      "Eva",
      "Finn"
    ],
    [
      "Finn",
      "Dan"
    ],
    [
      "Cara",
      "Dan"
    ]
  ]
}

Code example (Python)

# DataLens.ai example — cross-team collaboration analysis.
# The named teams input is provided by Copy input + code + test.
import networkx as nx

# Convert employee collaboration links into an undirected graph.
G = nx.Graph()
G.add_nodes_from([row[0] for row in teams["nodes"]])
G.add_edges_from(teams["edges"])
# Associate each employee with their declared department.
departments = {name: group for name, group in teams["nodes"]}

# Estimate the fraction of connected triplets closed into triangles.
result = nx.transitivity(G)
assert 0 < result <= 1

# Assertions above validate this graph result.
print("Expected output verified")