AI Glossary / Graphs and symbolic AI / Intermediate
Reciprocity
Definition
Reciprocity measures how often directed connections are matched by connections in the reverse direction. In the NetworkX graph sense used here, overall reciprocity is the fraction of directed edges whose reverse edge also exists. A mutually connected pair contributes two reciprocated directed edges. The measure describes network structure, not the fairness, quality, or meaning of the relationship represented.
What it means
If A links to B, that is one directed edge. If B also links to A, the two directions form a reciprocal pair. A graph can contain a mixture of reciprocal and one-way connections.
The supplied source concerns this mathematical graph measure. The ordinary social meaning of reciprocity, such as returning a favor, is broader and should not be inferred from a graph score alone. A return link may represent many different processes, including an automatic acknowledgment, a genuine exchange, or simply a data-collection convention.
How it works
For a simple directed graph without self-loops, count all directed edges. Then count the edges that have a reverse counterpart and divide by the total. A reciprocal pair contributes two to the numerator because both directed edges meet the condition.
At a particular node, the NetworkX calculation compares mutual neighbors with its incoming and outgoing connections. The node score is twice the number of mutual neighbors divided by the sum of its in-degree and out-degree.
An isolated node has no incident edges, so its score is undefined rather than zero. The overall measure is likewise undefined when there are no edges. Decide explicitly how such cases enter any report. The implementation's treatment of special graph features also matters; the examples here exclude self-loops and parallel edges.
Three practical examples
- Communication networks: an analyst measures the proportion of observed sender-to-recipient links that also appear in reverse during a defined period.
- Website analysis: a graph records whether linked pages also link back, without interpreting a return link as endorsement.
- Collaboration research: a team compares directional interaction patterns while retaining separate information about frequency, content, and context.
Think of it this way
Think of arrows drawn between boxes on a whiteboard. Some arrows have matching arrows back, while others point only one way. Reciprocity summarizes how common the matching arrows are. The analogy is deliberately structural: it cannot tell you whether people cooperate well, whether an exchange was useful, or whether the same number of messages traveled in each direction.
Worked example
Build a directed graph on A, B, C, and D with five edges: A to B, B to A, A to C, C to A, and C to D. There are two reciprocal pairs, A - B and A - C. They contribute four reciprocated directed edges out of five, so overall reciprocity is 4/5 = 0.8.
For A, there are two incoming and two outgoing edges, with two mutual neighbors, B and C. Its node score is 2 × 2 divided by 4 = 1.
B has one incoming and one outgoing edge, both connecting it with A. Its score is 2 × 1 divided by 2 = 1.
C has one incoming edge from A and two outgoing edges, to A and D. It has one mutual neighbor, A, giving 2 × 1 divided by 3, or about 0.667. D has one incoming edge and no outgoing edge, so its score is zero.
The unweighted average of these node scores is about 0.667, which differs from the graph's 0.8. Overall reciprocity is not generally the simple average of node reciprocity. Adding an isolated node E leaves the edge-based graph score at 0.8, but E's individual score is undefined. A report should not silently turn that undefined value into a zero.
Illustrative case study
Fictional case: Birch Analytics studies an internal test network of service interactions. An arrow means that one service sent at least one request to another during a fixed observation window.
The team finds several reciprocal pairs but notices that one direction can contain many more requests than the other. It reports link reciprocity separately from traffic volume and response timing. It also records services with no observed links as isolates rather than describing them as non-reciprocal participants.
This fictional case demonstrates interpretation and reporting choices. It does not claim a measured system improvement or equate a reciprocal link with successful service completion.
Common misconceptions and mistakes
Do not count reciprocal pairs once while counting all directed edges individually. That mixes units and gives the wrong ratio.
Do not confuse an isolated node's undefined value with a node that has connections but no reverse links. D in the example has a defined score of zero; E does not.
Avoid treating a high score as evidence of balanced message counts or healthy relationships. The unweighted measure records edge presence. Also document the observation window: a reverse interaction just outside that window will not appear in the graph, potentially changing the score without changing the underlying relationship.
Business use
Reciprocity can help describe a network before deeper analysis. Its business usefulness depends on what an edge represents and why mutual connectivity matters to the question being asked.
In Birch Analytics' example, a high link-reciprocity value cannot replace measurements of failures or response delays. Pair the score with relevant operational measures and explain graph construction choices. When comparing periods or systems, keep edge definitions and inclusion rules consistent so the apparent change is not merely a change in measurement.
People also ask
Does one reciprocal pair contribute one or two to the numerator?
Two directed edges, when the denominator counts directed edges as in the definition used here.
Is graph reciprocity the average of node scores?
Not generally. The worked example gives graph reciprocity 0.8 and a different unweighted node average.
Does this measure how many messages were returned?
Not in the unweighted graph formulation. It measures whether reverse edges exist, not the volume carried by them.
Check your understanding
Why does adding isolated E leave overall reciprocity unchanged?
Answer: E adds no directed edges, so neither the numerator nor the denominator of the graph ratio changes.
Related terms
- Directed graph
- in-degree
- out-degree
- mutual neighbour
- isolated node
- edge
- network density
- weighted network
Learn next
add D to C in the example and recalculate both graph and node values. Then compare a link-presence graph with a message-count table. Check how a different time window changes which reverse edges are observed.
More in Graphs and symbolic AI
- Real-time search - Real-time search is a family of search methods that limit the computation performed before an agent commits to its next action.
- Reasoning - Reasoning is the process of using information, assumptions, and relationships to reach conclusions, evaluate possibilities, or decide what follows.
- Reciprocal rank - Reciprocal rank is a retrieval-evaluation score equal to one divided by the position of the first relevant or correct result in a ranked list.
- Recombination - Recombination is an evolutionary-computation operation that creates candidate solutions by combining information from parent candidates.
- Reconstruction - Reconstruction, in computer vision, is the process of estimating a scene's three-dimensional structure from observations such as photographs.
- Record linkage - Record linkage is the process of deciding which records refer to the same real-world entity across or within datasets.
Sources
Primary sources: NetworkX reciprocity documentation: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.reciprocity.reciprocity.html Published implementation: https://networkx.org/documentation/stable/_modules/networkx/algorithms/reciprocity.html Both were inspected. In the inspected implementation, a single-isolate request raises an error, while an iterable request can return None for isolates. This entry uses loop-free simple directed graphs; numerical examples are original.
Previous: Reciprocal rank Next: Recombination