Abstract
Analogies are an important part of human cognition for learning and discovering new concepts. There are many different approaches to defining analogies and how new ones can be found or constructed. We propose a novel approach in the tradition of structure mapping using colored multigraphs to represent domains. We define a category of colored multigraphs in order to utilize some Category Theory (CT) concepts. CT is a powerful tool for describing and working with structure-preserving maps. There are many useful applications for this theory in cognitive science, and we want to introduce one such application to a broader audience. CT and the concepts used in this paper are introduced and explained. We show how the category theoretical concepts product and pullback can be used with the category of colored multigraphs to find possible analogies between domains using different requirements. The dual notion of a pullback, the pushout, is then used as conceptual blending to generate a new domain.
1. Introduction
Analogies are seen as a staple of human cognition because they play an important part in teaching, learning, and developing new concepts [1,2]. Similarities between two domains can be used to transfer knowledge from one domain to another to gain new insights or explain complex concepts. There are many questions concerning analogies, like how they are best defined, how they can be constructed from two domains, and what a good analogy is. These questions are also important when incorporating analogies in artificial reasoning to improve it or make it more interpretable. A key part of any approach to analogies is the representation of the involved knowledge and concepts [3]. Liu et al. [4], for example, embed knowledge graphs in an abstract linear space to transfer relations from one domain to another. The structure mapping theory by Gentner [5] focuses on mappings between domains based solely on their structure and has been used to automatically generate analogies in the structure mapping engine [6].
In this paper we use Category Theory (CT), a mathematical field concerned with general and specific properties of structure-preserving maps, to define domains as objects in the category of colored multigraphs and analogies as maps between them. This category theoretic view on analogies allows us to use CT concepts to analyze these maps and what information is contained in them.
In the remainder of this section, we will introduce our concept of analogies together with a specific example and basic concepts of CT. The main section contains a definition of analogies as morphisms in the category of colored multigraphs and shows how the CT concepts pullback and pushout can be used to form new colored graphs representing possible analogies and blends between two domains.
1.1. Analogies
An analogy consists of two domains, the base and the target, and a mapping between them [5]. This mapping gives rise to a generalization of their common structure and can be used to transfer knowledge from the base domain to the target domain or to generate a new concept that contains properties of both (concept blending). Structure mapping [5] is a classic approach to finding the commonalities between two domains, which focuses on the shared structure of each domain, rather than the properties of involved objects. A common example is to say that the solar system is like the Bohr model of the hydrogen atom because certain relations between the Sun and planets are similar to relations between the nucleus and the electron [5].
In examples, domains are often shown as directed multigraphs, whose nodes are objects and whose edges are relations between these objects (see example in Figure 1). We introduce a formalization of domains that is based on these directed multigraphs. Each node and edge of a domain has a name to differentiate them, and there may be several edges between two nodes. A multigraph consists of two sets, the set of nodes N and the set of edges E, and two functions from E to N, mapping each edge e to its source () and target node (). In structure mapping, relations between objects are the defining characteristics that guide which objects are seen as similar, while properties of objects are not. We add a coloring to the edges of the directed multigraph to capture that some relations are the same or similar. A coloring is described by a set C of possible colors and a function c that maps each edge to its color. In the example of Figure 1, the attraction between the Sun and planets can be related to the attraction between the nucleus and electron, but there are no distinctive similarities between the properties of the Sun and the nucleus.
Figure 1.
Example domains as colored multigraphs: the solar system (a) is like the hydrogen atom (b).
Edges in graphs are binary relations, so we can only describe domains with binary and, using loops, unary relations as multigraphs. We will also not cover higher-order predicates here. Higher-order predicates and n-ary relations can be included in a different representations of domains using categories and types as described in Ott and Jäkel [7].
We use a category of colored graphs to formalize analogies and determine possible maps.
1.2. Category Theory
CT is a theory that bridges many mathematical fields. An abstract description of mathematical objects, which focuses on their relations, is used to show and leverage commonalities and differences between these objects. CT can therefore be seen as a theory of analogies between mathematical objects. Using CT in cognitive science in general and to model analogy making in particular has been suggested before, for example by using commutative diagrams to analyze an analogy and coequalizers to describe re-representation [8] or by using functors to describe the instantiation of an abstract concept to the base and target domain and a natural transformation of these functors to describe an analogy [9]. The structure-preserving morphisms of a category can be used with most formalizations, for example with Heuristic-Driven Theory Projection [10].
We will give definitions of a category and some concepts that are needed for our use case. For a more detailed introduction, we refer the reader to introductory textbooks [11,12].
CT deals with categories, which consist of objects and arrows, so-called morphisms, between these objects. These morphisms are usually written as for the morphism f from object X to object Y. For example, the category consists of sets as objects and functions as morphisms. Functions behave nicely in the sense that the combination of two functions is again a function and each set has an identity function such that its composition with another function yields again that other function. These properties are general for each category and included in the following definition.
Definition 1
(Category). A category consists of a set or class of objects and for each pair of objects a set of morphisms between these objects . Morphisms can be concatenated if one has the same source as the other’s target. The composition of two morphisms is marked by ∘ and has the following properties:
- 1.
- For every object there exists an identity morphism such that for any object and any morphism , and holds.
- 2.
- For any objects and morphisms , and the compositions and exist and it holds that .
The category of directed multigraphs (not colored), based on the standard definition of the category of undirected graphs [13], contains multigraphs as objects and all structure-preserving maps as morphisms. Structure preserving in this context means that a morphism consists of a map of nodes () and one of edges () that are consistent with the graph structure; i.e., the source of an edge e is mapped to the source of its image () and the target is mapped to the target of its image () for all edges . The identity morphism maps each node and edge to itself and fulfills the first property of a category. The composition of two morphisms and is defined by the composition of the single components. For example for any . This composition is also a morphism in the category of directed multigraphs and fulfills the second property.
When talking about morphisms, a key question is whether certain morphisms or combinations are equal to each other. Certain parts of a category can be nicely drawn as a diagram, using arrows to represent morphisms, and such a diagram is called commuting if all directed paths with the same start and end points, i.e., compositions of morphisms with the same domain and codomain, are equal.
We can now define the category of colored multigraphs and demonstrate how the CT concepts pullback and pushout can be used to describe analogies.
2. Formalizing Analogies
In this section, we formalize analogies using the category of colored directed multigraphs. We will first define the respective category and then show how some concepts central to the theory of analogies can be formalized using the CT concepts pullbacks and pushouts.
2.1. Category of Domains
We want to focus on the relational mapping between domains as a basis for finding and constructing analogies. Each domain consists of objects (e.g., sun and planets) and relations between these object (e.g., the Sun attracts a planet). A relation always has a direction (the Sun is bigger than a planet is not the same as a planet is bigger than the Sun) and each pair of objects can have multiple relations. As mentioned before, domains are modeled as directed multigraphs with loops. Colors are added to edges to show similarities between various edges. The attracts relations in Figure 1 have, for example, more in common with each other than with the hotter relations. From here on, colored directed multigraphs will be just called colored graphs.
We now want to formally define a category of colored graphs in order to better analyze the structure of maps between colored graphs. We expand the definition from Section 1.2 to include colors. Each object in is a colored graph that consists of three sets, the set of nodes N, the set of edges E, and the set of colors C. In addition to the function mapping each edge to a source node () and a target node (), there is one for color as well (). Color is here not restricted to classic colors but can be seen as general labeling.
For example the graph for the atom in Figure 1 can be formalized as object in with nucleus, electron}, more massive, attracts, revolves around}, a set of four distinct edges, and the respective maps , , and to build the graph in the figure.
A category is defined not only by its objects, but also by its morphisms. A morphism in our category consists of three structure-preserving functions. The first, , maps all edges from the base graph B to edges of the target graph T. The second map, , maps all nodes from the base graph B to nodes of the target graph T in a way that preserves source and target nodes of the mapped edges. The third map, , maps colors to colors, meaning that all edges that have the same color in the base graph must have the same color in the target graph. This may be a different color. This map makes the left square in Figure 2 commute.
Figure 2.
Morphisms in the category of colored graphs. A morphism from one graph to another consists of three structure-preserving functions: , and .
In our example of Figure 1, there are many valid morphisms from the solar system graph to the atom graph . The two planets have to be mapped to a different node from the node sun, because there are no loops in . The color ‘attracts’ is the only color with edges in all directions, so it can only be mapped to ‘attracts’ in . However, there are not the same restrictions on morphisms for the other colors. Morphisms between sets can be easily composed, and each colored graph has an identity function, so indeed fulfills all properties of a category.
So far we have encoded important structural information of domains in colored graphs and defined morphisms that preserve this structure. However, there can be many morphisms between two graphs, and not every morphism gives rise to a good analogy. There is also the additional concern that a morphism maps the whole graph. The ‘hotter’ edges in , for example, have no match in but will be mapped to some other edges by a morphism. We now want to use the concepts product and pullback to construct possible mappings between two domains that are more restricted but also allow a partial correspondence.
2.2. Pullbacks with Possible Analogies
The next concept we introduce is the product, which is a generalization of the Cartesian product of sets. A product of two objects in a category is another object in that category that contains all information of the two factors. Figure 3a shows the product in a commutative diagram.
Figure 3.
(a) Product: For any object Z and morphisms and , there is a unique morphism u such that the product of the objects X and Y leads to commutative diagrams with the projection morphisms and . (b) Pullback: The pullback along f and g also has a unique morphism u for every Z and morphisms and such that the diagram commutes.
Definition 2
(Product). The product of two objects is equipped with two projection morphisms and such that for any object and pair of morphisms and there exists a unique morphism such that and .
A product is unique up to isomorphisms. The category contains for every pair of sets their Cartesian product and the respective projections, which fulfill the properties of the product defined above. So has all products. This is not necessarily true for every category.
A product of two colored graphs shows all possible mappings between the edges of the two graphs at once. For two colored graphs for , the product has the node set , edge set , and a color set isomorphic to . The maps are defined as for . The projections and map each element of , , and to their first or second component. See Figure 4 for an example.
Figure 4.
Example product (center graph) of a graph with two nodes (left) and one with three nodes (right). The product graph has six nodes and six edges in four colors, one for every combination. The red and yellow edge from to , for example, represents the combination of the yellow edge from 2 to 1 and the red edge from b to c.
For the solar system example above, the product results in a large graph with many edges because any combination of edge mappings is considered. We will now define pullbacks and look at how a pullback over a simple graph can be used to force edges of certain colors to be only combined with other edges of these colors.
A pullback can be seen as a restricted product. The pullback in over two morphisms and consists, for example, of the set and the respective projections. Figure 3b shows the following definition as a commutative diagram.
Definition 3
(Pullback). A pullback over two morphisms and is equipped with the morphisms and such that and for any other object and morphisms and with there exists a unique morphism such that and .
As mentioned above, a pullback can be used to restrict the product. This construction of seeing a product as all possibilities and using the pullback to sort by an inert structure has been used before in a paper on artificial perception [14]. The pullback over two morphisms and consists of the node set , edge set , a color set , and the respective maps s (for source nodes), t (for target nodes), and c (for colors).
The graph G, which we call a middle graph here, is used to encode some prior information or restriction regarding the possible maps. For example, Figure 5 shows a pullback for the graphs from Figure 1 over a middle graph with a single node and one edge for each color that occurs in at least one of the two graphs. This graph and the morphisms f and g that map edges to edges of the same color encodes the prior knowledge that possible matches should only match edges of the same color with each other. For space reasons, the graphs of the solar system and the atom are shown at a smaller scale. For reference, we can compare this diagram to the one in Figure 3b. The object X is replaced by the graph describing the solar system and Y by the graph describing the atom; the small graph has the same function as M and the large graph is the pullback and therefore replaces .
Figure 5.
A pullback over the solar system , the hydrogen atom , and a graph with one node and four loops of different colors. The morphisms f and g map each edge to the respective colored edge. The pullback results in a new colored graph, which shows all color-abiding mappings.
All possible analogies that adhere to the graph colors are superimposed in the pullback. The example pullback in Figure 5 does not contain the hotter relation between the Sun and planets because there is no equivalent edge in the hydrogen atom. We can now look for each possible combination of pairing the nodes mars, venus, and sun with the the nodes electron and nucleus in the respective subgraph. There are six possible combinations of matches for injective mappings between the nodes of the two domains. Each match consists of one node of the graph and one of and a subgraph consists of two of these matches. The respective subgraph of the pullback contains all edges between these two node pairs. Figure 6 shows the six resulting subgraphs. There are two subgraphs without any edges (a, b), two with only two edges (c, d), and two with four (e, f). The last two contain the most structure and are therefore the preferred mappings. These correspond to matching the Sun with the nucleus and one planet with the electron and are equally valid.
Figure 6.
All six possible analogies between the solar system and the hydrogen atom as subgraphs of the pullback graph from Figure 5. (a,b) Subgraphs without any edges, becuase none exist between the respective nodes in the original graph. (c,d) Subgraphs with two edges, one in each direction. (e,f) Subgraphs with four edges and therefore the subgraphs with the maximum amount of edges.
We could loosen the requirement on the color matching by changing the maps f and g. If edges of two colors are mapped to the same edge, all their combinations occur in the pullback. Another option is to force certain nodes or edges to be matched by adding edges and nodes to the middle graph. Hence, the pullback can be used to obtain a graph with all possible analogies superimposed based on prior knowledge. We can then reconstruct all possible matches and use the number of edges in the subgraphs as a preference order.
Figure 7 shows another pullback over a different graph. The middle graph now has three instead of one node and four edges with the same color black. This graph encodes different restrictions than the one in Figure 5. Here, the nodes are already paired. The morphism f maps the node mars to m, sun to s,n and venus to v,e, respectively, while g maps nucleus to s,n and electron to v,e. However, each edge is mapped to the one edge that has the correct source and target to fulfill the condition of a graph morphism without adhering to any color conditions because the middle graph does not encode any differentiation between colors. The resulting pullback contains only the two nodes sun, nucleus and venus, electron because the node m was only matched by one of the two original graphs. However, because there was no differentiation between edge colors, each combination of two edges in and with the right source and target has a representation in the pullback graph.
Figure 7.
A pullback over the solar system , the hydrogen atom , and a graph with three nodes and four edges between them. The morphisms f and g map each node according to the first letters indicated in the graph and the edges to the one edge with the right source and target node. The pullback results in a new colored graph with only two nodes but ten edges for all different combinations.
In this example, the differentiation contained in the colors was lost in the maps to the uni-colored graph, resulting in many possible edges. In this case, it is more difficult to decide which edges should be used in a subgraph to describe the analogy.
2.3. Blending Using Pushouts
We can use a partial map from one domain to another to construct a new combined domain, the so-called conceptual blend. We build on the idea of using a pushout for this conceptual blending [15,16] to define the asymmetric transfer from the base domain to the target domain.
Many CT concepts have a dual in which the morphisms are reversed. The dual of a product is called a coproduct and is a generalization of a disjoint union of two sets. Figure 8a shows the diagram describing a coproduct.
Figure 8.
(a) Coproduct: For any object Z and morphisms and , there is a unique morphism u such that the coproduct of the objects X and Y leads to commutative diagrams with the morphisms and . (b) Pushout: The pushout along f and g also has a unique morphism u for every Z and morphisms and such that the diagram commutes.
Definition 4
(Coproduct). The coproduct of two objects is equipped with two morphisms and such that for any object and pair of morphisms and there exists a unique morphism such that and .
In the category of multigraphs introduced above, a coproduct of two graphs is given by a disjoint union of these graphs and the morphisms mapping each graph to its respective subgraph. The dual of a pullback is called a pushout.
Definition 5
(Pushout). A pushout over two morphisms and is equipped with the morphisms and such that and for any other object and morphisms and with there exists a unique morphism such that and .
We have started by constructing a graph of possible analogies using the pullback, as shown in Figure 5. The resulting subgraphs in Figure 6 describe different analogies and can be used to create a blended graph via pushout. For the example in Figure 9, the subgraph (f) in Figure 6 was chosen because it is one of the subgraphs with the most edges. The resulting graph describing the blend contains this common graph and additionally all nodes and edges that occur in one of the two graphs, but not in the common graph.
Figure 9.
Blending via a pushout over graph (f) in Figure 6. Dashed arrows mark arrows that only occur in .
The pushout over this graph matching sun to the nucleus and venus to the electron yields a graph with these two combined nodes and their combined edges and one additional node for Mars and some additional edges. This positioning of mars in the combined graph can be seen as the idea of having more than one revolving object in such a system and therefore having more than one electron in an atom. The hotter relation, which is also transferred, can lead to the realization that an explanation using this analogy has to point out this difference to avoid a wrong transfer or confusion.
Starting with a simple graph to match the colors of the two domain graphs, we constructed a pullback to find all possible matches for an analogy. One of these matches was chosen in the form of a subgraph of the pullback and used for a pushout to generate a blended graph.
3. Discussion
We have formalized knowledge domains as colored multigraphs and used CT to show how this structure can be used to describe and find possible analogies between two domains. We used pullbacks over a graph describing prior knowledge to generate a new graph of possible maps. A subgraph of this pullback that describes one of those possible matches was used in a pushout to construct a blend of the two domains.
We do not assume that humans actually use CT when finding, teaching, or learning analogies, but we know that some kind of mapping between relations can be performed and this is one way of describing this process. We demonstrated the usefulness of CT for such considerations.
Colored graphs are a common visualization of domains and the category includes the basic tools to form matches and blends, but this formalization works best for binary and first-order relations. A second, more abstract approach building on the same ideas is presented by Ott and Jäkel [7] to include n-ary and higher-order relations.
This is only a small demonstration of the possibilities, and a next step could be to better define which of the possible analogies should be used. This could be guided by endowing the domain graphs with further information, for example which relations are the most important for defining a domain. The methods used could also be implemented in automatic analogy forming. A good formalization of domains and analogies between them can help us further understand human reasoning and can be used to improve artificial reasoning in a way that is interpretable and understandable for human users.
Funding
This work was funded by the German Federal Ministry of Education and Research in the project ‘PlexPlain: Erklärende KI für komplexe Lineare Programme am Beispiel intelligenter Energiesysteme’ [grant number 01IS19081] and the Hessian Ministry of Higher Education, Research, Science and the Arts and its LOEWE research priority program ‘WhiteBox’ [grant number LOEWE/ 2/13/519/03/06.001(0010)/77].
Data Availability Statement
Data sharing is not applicable.
Acknowledgments
I would like to thank Frank Jäkel, Inga Ibs, and Malte Ott for their ideas and fruitful discussions. I also thank the reviewers, organizers, and participants at ESSLLI 2024 for their helpful feedback.
Conflicts of Interest
The author declares no conflicts of interest.
References
- Gentner, D.; Hoyos, C. Analogy and Abstraction. Top. Cogn. Sci. 2017, 9, 672–693. [Google Scholar] [CrossRef] [PubMed]
- Besold, T.R.; Schmidt, M.; Pease, A. Analogy and Arithmetic: An HDTP-Based Model of the Calculation Circular Staircase. In Proceedings of the 35th Annual Meeting of the Cognitive Science Society, Berlin, Germany, 31 July–3 August 2013. [Google Scholar]
- Mitchell, M. Abstraction and analogy-making in artificial intelligence. Ann. N. Y. Acad. Sci. 2021, 1505, 79–101. [Google Scholar] [CrossRef] [PubMed]
- Liu, H.; Wu, Y.; Yang, Y. Analogical Inference for Multi-Relational Embeddings. arXiv 2017, arXiv:1705.02426. [Google Scholar] [CrossRef]
- Gentner, D. Structure-mapping: A theoretical framework for analogy. Cogn. Sci. 1983, 7, 155–170. [Google Scholar] [CrossRef]
- Yan, J.; Forbus, K.D.; Gentner, D. A Theory of Rerepresentation in Analogical Matching. In Proceedings of the 25th Annual Meeting of the Cognitive Science Society, Boston, MA, USA, 30 July–2 August 2003; pp. 1265–1270. [Google Scholar]
- Ott, C.; Jäkel, F. Types of Relations: Defining Analogies with Category Theory. arXiv 2025, arXiv:2505.19792. [Google Scholar] [CrossRef]
- Navarrete, J.A.; Dartnell, P. Towards a category theory approach to analogy: Analyzing re-representation and acquisition of numerical knowledge. PLoS Comput. Biol. 2017, 13, e1005683. [Google Scholar] [CrossRef] [PubMed]
- Phillips, S. A category theory principle for cognitive science: Cognition as universal construction. Cogn. Stud. Bull. Jpn. Cogn. Sci. Sciety 2021, 28, 11–24. [Google Scholar] [CrossRef]
- Krumnack, U.; Abdel-Fattah, A.; Kühnberger, K.U. Formal Magic for Analogies. In Proceedings of the Workshop “Formalizing Mechanisms for Artificial General intelligence and Cognition (Formal MAGiC)”, Beijing, China, 31 July 2013. [Google Scholar]
- Awodey, S. Category Theory, 2nd ed.; Oxford University Press: Oxford, UK; New York, NY, USA, 2010; Open Library ID: OL24416864M. [Google Scholar]
- Spivak, D.I. Category Theory for the Sciences; MIT Press: Cambridge, MA, USA, 2014. [Google Scholar]
- Hell, P. An introduction to the category of graphs. Ann. N. Y. Acad. Sci. 1979, 328, 120–136. [Google Scholar] [CrossRef]
- Arzi-Gonczarowski, Z. Perceive this as that–Analogies, artificial perception, and category theory. Ann. Math. Artif. Intell. 1999, 26, 215–252. [Google Scholar] [CrossRef]
- Martinez, M.; Abdel-Fattah, A.M.H.; Krumnack, U.; Gómez-Ramírez, D.; Smaill, A.; Besold, T.R.; Pease, A.; Schmidt, M.; Guhe, M.; Kühnberger, K.U. Theory blending: Extended algorithmic aspects and examples. Ann. Math. Artif. Intell. 2017, 80, 65–89. [Google Scholar] [CrossRef]
- Schorlemmer, M.; Plaza, E. A uniform model of computational conceptual blending. Cogn. Syst. Res. 2021, 65, 118–137. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).








