The p-Cohesion algorithm identifies groups of network players (nodes) that are highly connected with each other, represented by cohesive subgraphs. It provides valuable insights into the level of connectivity and interdependence within these groups, enabling in-depth analysis of the graph structure and its implications.
The concept of p-cohesion was first proposed by S. Morris in a contagion model of the interaction among large populations:
One natural measure of the 'cohesion' of a group is the relative frequency of ties among group members compared to non-members. Let the cohesion be a constant p ∈ (0,1), a p-cohesion is a connected subgraph in which every node has, at least, a proportion p of its neighbors within the subgraph, i.e., at most, a proportion (1 − p) of its neighbors outside.
The p-Cohesion model offers two distinct advantages compared to other cohesive subgraph models:
Below shows an example graph. Suppose p = 0.6, a grey label is put next to each node indicating the smallest number of neighbors required for the node to stay in a p-cohesion.

Below are the minimal (in terms of the number of nodes) p-cohesion subgraphs including node a and node j respectively.

Ultipa's p-Cohesion algorithm finds the approximate minimal p-cohesion subgraph for each query node, and returns each subgraph in the form of its node set.
algo(p_cohesion)Name | Type | Spec | Default | Optional | Description |
|---|---|---|---|---|---|
| ids / uuids | []_id / []_uuid | / | / | Yes | ID/UUID of the query nodes; find the approximate minimal p-cohesions that include each query node respectively; query all nodes if not set |
| p | float | (0,1) | / | No | Each node in a p-cohesion has at least a proportion p of its neighbors within the p-cohesion, and at most a proportion (1 − p) of its neighbors outside |
The example graph is as follows:

Spec | Content | Description |
|---|---|---|
| filename | subgraphN: _id,_id,... | Nodes that are contained in each p-cohesion subgraph |
UQLalgo(p_cohesion).params({ ids: ['A', 'I'], p: 0.7 }).write({ file: { filename: "cohesion" } })
Statistics: num of subgraphs = 2
Results: File cohesion
Filesubgraph0:D,C,B,F,A,E, subgraph1:D,C,F,B,H,E,A,I,