Given a category 𝒞 and a ring R, one can construct an algebra 𝒜 as follows. Let 𝒜 be the set of all
formal finite linear combinations of the form
where the coefficients ci lie in R and, to every pair of objects a and b of 𝒞 and every morphism μ
from a to b, there corresponds a basis element ea,b,μ. Addition and scalar multiplication are defined
in the usual way. Multiplication of elements of 𝒜 may be defined by specifying how to multiply
basis elements. If b≠c, then set ea,b,ϕ ⋅ ec,d,ψ = 0; otherwise set ea,b,ϕ ⋅ eb,c,ψ = ea,c,ψ∘ϕ. Because of
the associativity of composition of morphisms, 𝒜 will be an associative algebra over
R.
Two instances of this construction are worth noting. If G is a group, we may regard G as a
category with one object. Then this construction gives us the group algebra of G. If P
is a partially ordered set, we may view P as a category with at most one morphism
between any two objects. Then this construction provides us with the incidence algebra of
P.