Let $\mathscr C$ be a category so that every morphism is '*invertible*' only up to equivalence and so that it makes sense to say two morphisms are '*homotopic to each other*'. Probably this is called $(2,1)$-category.


(The category in my mind could be such that objects are topological spaces and morphisms are homotopy equivalence maps)


Let $\mathscr D$ be a full subcategory of $\mathscr C$.


Given an object $X\in\mathscr C\setminus \mathscr D$, I attempt to construct a binary relation $\sim\_X$ imitating the [transitive closure](https://ncatlab.org/nlab/show/transitive+closure) in the set theory. Namely, a pair $(c,d )$ in the set $X$ is related, denoted by $c\sim\_X d$, if the following holds:


*There exists a sequence $c=c\_0,c\_1,\dots, c\_{n-1},c\_n=d$ for an integer $n\ge 0$ so that for every $0\le i\le n-1$ and every pair $(c\_i,c\_{i+1})$ we may find an object $Y\_i\in\mathscr D$, an element $a$ in the set $Y\_i$, and two morphisms $f\_i^{(0)}, f\_i^{(1)}:Y\_i\to X$, which are 'homotopic to each other', satisfying $f\_i^{(0)}(a)=c\_i$ and $f\_i^{(1)}(a)=c\_{i+1}$.*



> 
> **Question**: It seems that this construction gives an equivalence relation on every object set $X$. Is there a categorical generalization of transitive closure?
> 
> 
> 


Since in category setting people often talk about congruence relations rather than equivalence relations. Perhaps this is related to some higher congruence things like [here](https://ncatlab.org/nlab/show/%28n%2Cr%29-congruence)?



Transitive closure in category setting
If every morphism is a equivalence, then you really want a $(2,0)$-category, also known as a 2-groupoid. However, I see no reason to assume every morphism is an equivalence here. 


This is not a generalization or a categorification of a transitive closure, in any case: it is literally the transitive closure of the relation $R$ on $X$ defined as $xRy$ if there exists $A\in \mathscr D$, $a\in A$, and homotopic maps $f,g:A\to X$ such that $f(a)=x$ and $g(a)=y$. This is closely analogous to the relation that $x$ and $y$ are in the same connected component, if $X$ is a topological space-indeed if a one-point space is in $\mathscr D$ then they are the same relation, and $R$ is already transitive.


