1. Introduction
The Graph Isomorphism (GI) problem is a fundamental challenge in computer science and graph theory. It seeks to determine whether two finite graphs, G and H, are isomorphic. Recall that an isomorphism is a bijective function that preserves the graph structure. This means that if two vertices are connected by an edge in G, their corresponding vertices in H must also be connected by an edge. If such a function exists, then the graphs G and H are said to be isomorphic.
The complexity of the Graph Isomorphism problem is unique compared to many other problems in graph theory. It does not fit neatly into the categories of P or -complete. Recall that a problem is in P if it can be solved in polynomial time by a deterministic Turing machine, while an -complete problem is one that is both in and -hard; the latter means that a solution to the problem can be verified in polynomial time and every other problem in can be reduced to this problem in polynomial time. Within this context, it is known that the Graph Isomorphism problem lies in class , meaning that if a proposed isomorphism is given, its correctness can be verified in polynomial time. However, it has not been proven that the problem can be solved in polynomial time, nor has it been shown to be -complete.
Significant progress has been made in addressing the Graph Isomorphism problem (see [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14]). For instance, Babai [
1] introduced a quasi-polynomial time algorithm, marking a major advancement that bridges the gap between polynomial and exponential time complexity. While this algorithm does not classify the problem as being in
P, it does lower the upper bounds of its complexity, providing new avenues for research.
Several methods solve the GI problem for specific classes of graphs in polynomial time. Surveys have identified many additional classes of graphs for which the GI problem is equivalent to that of arbitrary graphs. Here, “equivalence” means that the GI problem for a specific class can be transformed into the GI problem for arbitrary (undirected) graphs in polynomial time, and vice versa (see for instance [
4,
10,
14]). This relationship is what defines a class
C of graphs to be GI-complete.
Recently, the class of GI-complete graphs has expanded to include chordal bipartite graphs and strongly chordal graphs [
13], geometric graphs [
12], and perfect graphs [
5]. Although the class of directed graphs was proved to be GI-complete in [
10], to our knowledge, there is no formal proof that the class of multidirected graphs is GI-complete. Here, we approach this using concepts and notions from Category Theory. Specifically, we utilize a categorical framework that connects directed graphs with a specific type of undirected graph known as a prime graph [
15]. These prime graphs are undirected bipartite graphs that have a prime labeling, which encodes directional information. Using this connection, we demonstrate that the class of directed graphs is GI-complete. However, our main contribution relies on extending this result first to the class of multidirected graphs without self-loops, and later to the class of multidirected graphs with self-loops.
From a categorical perspective, these findings illustrate how the GI-complete class encapsulates the complexity of the Graph Isomorphism problem within a broader context of similarly structured problems. The reductions and equivalences we establish indicate that the inherent difficulty of the Graph Isomorphism problem is shared across these classes, despite their structural differences. Thus, the GI-complete classes serve as a valuable framework for understanding the boundaries and relationships within computational complexity.
The rest of this paper is organized as follows:
Section 2 gives some preliminary definitions and facts about the category of prime graphs. In
Section 3, we present our theoretical results. We first prove that the class of prime graphs is isomorphic complete. This is considered to prove that the class of directed graphs is isomorphic complete as well. Later, we show that the category of multidirected graphs and the category of weighted prime graphs are isomorphic. This result, in turn, is used to proof that the class of multidirected graphs is isomorphic complete. Finally,
Section 4 gives some concluding arguments and future lines of research.
2. Preliminaries
Mathematically, a graph is a pair , where V is a set whose elements are called vertices (or nodes), and E is a set consisting of two-element subsets of V, called edges (or connections). A graph is undirected if its set of edges consists of connections without directionality. In this case, we will denote an edge between the nodes u and v as an unordered pair , since the two-element subsets and represent the same unordered set. In contrast, a graph is directed if all its edges are connections with a direction. In this case, we will denote an edge from node u to node v as an ordered pair . Note that the order in the two-element subsets is now significant, meaning for directed graphs. Conceptually, we can think of an edge as an arrow with initial node u and target node v. In general, given a vertex v in G, we call u a neighbor of v if u and v are connected by an edge in G. Throughout this work, we will consider simple directed graphs, that is, directed graphs with no multiple edges and no self-loops.
Here, we think of a graph morphism as a function between the vertex sets that preserves the structure or topology of the graphs; that is, it preserves the edges under transformation. Formally,
Definition 1. Let and be two undirected graphs. An undirected graph morphism is a function that maps adjacent vertices in into adjacent vertices in .
Algebraically, an undirected graph morphism f is a function that satisfies that, for any pair of vertices with , we have . For the case of directed graphs and , we say that a function is a directed graph morphism if f maps initial nodes into initial nodes, and terminal nodes into terminal nodes. In this work, we focus on particular graph morphisms known as graph isomorphisms. Formally,
Definition 2. Let and be two graphs. We say that a graph morphism is a graph isomorphism if f is a bijection between the vertex sets.
One can verify that, in both undirected and directed case, the composition of two graph morphisms always yields another graph morphism. Further, the composition is an associative operation that has a neutral element, called the identity morphism (which coincides with the identity map). These properties constitute the definition of a category.
Definition 3. A category consists of a collection of objects , a collection of morphisms between the objects, and a composition operation by which two morphisms and can be combined to produce another morphism . Also, for each object, there is an identity morphism, and the composition is an associative operation.
Considering the above, the collection of all undirected graphs with all undirected graph morphisms form a category denoted by
UndGraph. Likewise, the collection of all simple directed graphs with all directed graph morphisms form a category, denoted by
DGraph. In this work, we will consider the category
PGraphs, described in [
15], whose objects are prime graphs.
Definition 4. Let be an undirected graph with vertices, and let the sets and . We say that admits a
prime labeling
if there exists a bijective function such that for one has the following three cases:
- (i)
If and , then for each neighbor u of v, for some . (We visualize this in Figure 1). - (ii)
If and , then for each neighbor u of v, for some . (We visualize this in Figure 2). - (iii)
If and , then there exists a neighbor w of v such that and . (We visualize this in Figure 3).
For instance, the following graphs (
Figure 4)
are not prime graphs, as the prime-labeled nodes are connected to each other. However, the graph on the right becomes a prime graph if we endow it with the following prime labeling (
Figure 5).
One important property of prime graphs is that these can be visualized as undirected bipartite graphs (
Figure 6). This is a consequence of the definition of a prime labeling, as prime-labeled nodes only have non-prime-labeled nodes as neighbors, and vice versa.
In [
15], it is proved that the category
DGraphs and the category
PGraphs are isomorphic. This means that the objects and morphisms of these two categories are in a one-to-one correspondence. Grounded on this isomorphism, we prove in the next section that the class of directed graphs is isomorphic complete, which paves the way to generalize the result to the case of multidirected graphs.
Moreover, by extending this isomorphism to the category of weighted prime graphs and the category of multidirected graphs, we show in
Section 3.2 that the class of multidirected graphs is isomorphic complete.
3. Results
This section contains our main theoretical results. First, we show a polynomial time reduction between prime graphs and undirected graphs, which leads us to prove that the class of directed graphs is isomorphic complete. Then, we extend the isomorphism between DGraphs and PGraphs to consider multidirected graphs and weighted prime graphs. This last isomorphism, in turn, is used for the polynomial time reduction between multidirected graphs and undirected graphs.
3.1. Directed Graphs Are GI-Complete
Broadly speaking, we say that a class
of graphs is isomorphism complete if one can reduce its isomorphism problem to that of undirected graphs in polynomial time. This reduction is in both directions; that is, it comprises a map that relates undirected graphs to graphs in
, and another map relating graphs in
with undirected graphs. Each of these transformations is subject to three main properties as described in [
4] (
Section 3.2). For instance, if
T assigns undirected graphs to graphs in
, then the following hold:
is in for each undirected graph G;
G is isomorphic to H if, and only if, is isomorphic to ;
can be computed in polynomial time from the number of vertices of G.
Example 1. Any undirected graph can be turned into a bipartite graph by splitting each edge into two edges and inserting a new vertex between them. This process preserves isomorphisms and is carried out in polynomial time. The reverse transformation is trivial, as each bipartite graph is an undirected graph. Thus, the class of bipartite graphs is isomorphic complete.
In [
15], the authors introduce the category of prime graphs and prime graph morphisms. Essentially, a prime graph is an undirected graph that allows a prime labeling function. Here, the prime labeling function endows a notion of direction in the corresponding prime graphs. Further, the authors prove that the category of prime graphs and the category of simple directed graphs are isomorphic; that is, there exists a bijective correspondence between the objects and the morphisms that respects the composition operation. As an example,
Figure 7 shows a simple directed graph and its corresponding prime graph under this isomorphism.
Moreover, the time complexity of transforming a directed graph into a prime graph is
, where n is the number of nodes. One consequence of the prime labeling function defined on prime graphs is that the adjacency matrix for any prime graphs has the form
where
A is a square matrix,
is its transpose matrix, and 0 is a zero matrix of the same size as
A. In this context, matrix
A contains all the adjacencies between prime and non-prime nodes. As we see next, the class of all prime graphs is isomorphic complete.
Remark 1. Two graphs G and H are isomorphic if, and only if, their adjacency matrices are similar. This means that, if and denote the adjacency matrices of G and H, respectively, then there exist an invertible matrix P such that . Moreover, as graph isomorphism involves permutations of the vertices, it follows that P is a permutation matrix of the identity matrix and, hence, it is an orthogonal matrix. This way, we see that .
Proposition 1. There exists a transformation that reduces undirected graphs to prime graphs in polynomial time.
Proof. Let
be an undirected graph with
n vertices, and let
be its adjacency matrix. Let us define the matrix
, where
is the identity matrix of
. Thus, by considering the matrix
we obtain a prime graph
that contains the adjacencies of the undirected graph
in the non-diagonal entries of the matrix
. Note that this process is carried out in polynomial time. Now, if
is isomorphic to
, by Remark 1,
for a permutation matrix
P. This way, we obtain that
Hence, the matrices
and
are similar. With this in mind, we claim that the adjacency matrices
of the corresponding prime graphs
and
, respectively, are similar. Indeed, the matrices
are inverse to each other and satisfy that
The last equality follows because
, and so,
In turn, we get that
. Consequently,
Assume now that
and
are two undirected graphs such that their corresponding prime graphs
and
are isomorphic. Then, by Remark 1, it follows that the adjacency matrices
are similar. In this case, by the way prime graph morphisms are defined, the invertible matrix corresponding to the permutation of the vertices must preserve the labelings. In other words, it must send prime-labeled nodes to prime-labeled nodes, as well as non-prime-labeled nodes to non-prime-labeled nodes. Additionally, it must be compatible with the prime and non-prime label for each node in the following sense: if
and
are two non-prime-labeled nodes that correspond to each other under the prime graph isomorphism, then their prime-labeled nodes
and
also correspond to each other. Thus, the invertible matrix must have the form
and, further, its inverse coincides with the matrix
, due to orthogonality. Taking the above into consideration, one obtains that
from which it follows that
. Hence,
and
are similar matrices through the permutation matrix
P. Consequently, by Remark 1, the undirected graphs
and
are isomorphic. □
Example 2. On the left of Figure 8, we have the undirected graph , and on the right, we have its corresponding prime graph . Notice that, for the undirected edge in , we constructed two edges in : one is and the other is .
Remark 2. The Proposition 1 might also be argued as follows: Any undirected graph can be transformed into a directed graph by considering two directed edges and , for each undirected edge in . Then, by applying [15] (Theorem 4), one obtains a prime graph whose adjacency matrix has the formwith . Here, corresponds to the adjacency matrix of the undirected graph , and is the identity matrix of . The above process is verified in Example 2, where for the undirected edge in , we defined the edges and in , which correspond to the directed edges and in . It is also worth noticing that the identity matrix is responsible for all edges of the form in . To prove the converse of Proposition 1, we will associate wth each prime graph an undirected graph that reflects the essence of the prime labeling. For illustrative purposes, consider the following.
Example 3. On the left of Figure 9, we have the prime graph , and on the right, we have its corresponding undirected graph . Observe that the edges in of the form , with , are the ones that generate the edges of the undirected graph .
Proposition 2. There exists a transformation that reduces prime graphs to undirected graphs in polynomial time.
Proof. Let
be a prime graph with
nodes. Then, its adjacency matrix has the form
where
A is a square matrix of size
. Moreover, by the way prime graphs are defined, matrix
, with
being an
matrix with 0 in the diagonal. Considering this, we define the undirected graph
as the graph with
as its adjacency matrix. Note that this process is carried out in polynomial time.
Now, let
and
be two isomorphic prime graphs whose adjacency matrices are given by
and
, respectively. Then, by Remark 1,
and
are similar matrices. Moreover, as described in Proposition 1, the invertible matrix must be a permutation matrix of the form
with the inverse given by
. This way, we have that
which implies that
. Furthermore, as
and
, we obtain that
Consequently, we obtain that and are similar matrices, thus showing that and are isomorphic.
Assume now that the undirected graphs
and
, corresponding to the prime graphs
and
, are isomorphic. Then, by Remark 1, their adjacency matrices
and
are similar. Hence,
, with
P being a permutation matrix. Considering this, we have that
Moreover, it follows that
. Taking this into consideration, we can see that
Thus,
and
are isomorphic. □
As a consequence of Proposition 1 and Proposition 2, we have the following:
Theorem 1. The class of prime graphs is isomorphic complete.
Moreover, since the transformation between prime graphs and simple directed graphs shown in [
15] is polynomial in time, we have the following.
Theorem 2. The class of directed graphs is isomorphic complete.
3.2. Multidirected Graphs Are GI-Complete
In this section, we show that the class of multidirected graphs is GI-complete. To this end, we start by considering the category MGraph, whose objects are multidirected graphs with no self-loops, and whose morphisms are multidirected graph morphisms. We first show that MGraph is isomorphic to a category WPGraph, whose objects are weighted prime graphs and whose morphisms are given by prime graph morphisms that respect the edges’ multiplicity. This isomorphism, in turn, leads us to prove that the class of multidirected graphs with no self-loops is GI-complete. After, by modifying the weight values on the weighted prime graphs, we show that the class of multidirected graphs, now with self-loops allowed, is also GI-complete.
3.2.1. Multidirected Graphs and Weighted Prime Graphs Are Isomorphic
We start considering multidirected graphs as directed graphs without self-loops, and where multiple directed edges between two nodes are allowed. This multiplicity can be represented as a weight value taken from the positive integers
. For instance, for the multidirected graph in
Figure 10,
the edge multiplicity of the arrow with tail a and head c is 2, while the edge multiplicity of the arrow with tail c and head a is 1. From what follows, we will denote the edge multiplicity of a directed edge by .
Definition 5. Let and be two multidirected graphs. We say that the function is a multidirected graph morphism if the following conditions hold:
- 1.
For any , ;
- 2.
for any .
The above definition can be rephrased by saying that a multidirected graph morphism is a directed graph morphism—between the underlying directed graphs—-that respects the edge multiplicity. With this in mind, it follows that the composition of multidirected graph morphisms is an associative operation. Moreover, for each multidirected graph, the identity morphism coincides with the identity map. Hence, one obtains that the collection of multidirected graphs along with the collection of multidirected graph morphisms forms a category we denote by MGraph.
Now, on the other hand, we have weighted prime graphs. Here, the weight values are also taken from the set of all positive integers
, with one constraint: the weight of any edge of the form
will always be 1 (see
Figure 11). From now on, we will call these type of graphs
weighted prime graphs; these will comprise the class of objects of a category we denote by
WPGraph.
With regard to morphisms, these are given by functions between the underlying prime graphs that respect the topology, as well as the weight values on the corresponding edges. In other words,
Definition 6. Let and be two weighted prime graphs. We say that the function is a weighted prime graph morphism if the following hold:
- 1.
f is a prime graph morphism between the underlying prime graphs;
- 2.
if is the weight of the edge in , then, .
Notice that weighted prime graph morphisms are essentially prime graph morphisms that respect multiplicity. Thus, their composition is an associative operation. Further, the identity morphism coincides with the identity map for each weighted prime graph. Hence, one obtains that the class WPGraph of weighted prime graphs becomes a category whose morphisms are given by weighted prime graph morphisms.
We will now show that the categories MGraph and WPGraph are isomorphic. First, note that each multidirected graph has a unique underlying structure of a directed graph, obtained by compressing all multiple edges.
Example 4. On the left of Figure 12, we have a multidirected graph, and on the right, we have its underlying structure as a directed graph. Let us consider a multidirected graph morphism
. Notice that, by definition,
is a directed graph morphism that respects multiplicities on the edges. Thus, by [
15] (Theorem 4),
is in correspondence with a prime graph morphism
. Here, the prime graphs
and
are obtained by applying [
15] (Theorem 4) to the directed graphs given by the underlying structure of
and
, respectively. Bearing this in mind, one can define the weights on the prime graphs based on the weights of the multidirected graphs. For instance, for the prime graph
, one obtains the weighted prime graph
, whose weight values are given by the following:
If is a non-prime prime edge in , we set , that is, the multiplicity of the directed edge in .
For any edge of the form , we set .
Example 5. For the multidirected graph in Example 4, one obtains the weighted prime graph in Figure 13. Observe that the correspondence in Example 5 is reversible. Indeed, each weighted prime graph
gives rise to a unique multidirected graph
, where the multiplicities are induced by the weights of the non-prime edges of
. Furthermore, as multidirected graph morphisms are essentially directed graph morphisms that respect multiplicity, and weighted prime graph morphisms are basically prime graph morphisms that respect the weight values, then the isomorphism in [
15] (Theorem 4) yields to the following.
Theorem 3. The categories MGraph and WPGraph are isomorphic.
3.2.2. The Class of Multidirected Graphs Without Self-Loops Is GI-Complete
We now prove that the class of all multidirected graphs without self-loops is GI-complete. To this end, we start by showing that there exists a polynomial time reduction from multidirected graphs to undirected graphs that encodes edge multiplicity as the number of ascending chains within the structure of the undirected graphs. In fact, this construction generalizes the one in [
10], where the author considers a “gadget” to convert a directed graph into an undirected graph. After this, using Proposition 1, we provide a polynomial time reduction from undirected graphs to multidirected graphs based on prime graphs.
Let us consider a multidirected graph , and two nodes . Then, in the corresponding undirected graph, we will have two nodes , with as many chains in between as the sum of the multiplicities of the directed edges and in .
Example 6. In Figure 14, the multidirected graph on the left has and . Thus, its corresponding undirected graph has three ascending chains from node a to node b, while it has two ascending chains from node b to node a. While performing the above transformation for each edge of the multidirected graph, one preserves the connectivity and, further, it encodes the notion of edge multiplicity as the number of ascending chains. Note that the above transformation T is carried out in polynomial time. To check the isomorphism properties for T, observe that if and are two isomorphic multidirected graphs, then their corresponding undirected graphs and will be isomorphic. Indeed, while preserving connectivity and transforming multiplicities into ascending chains, T transforms the same underlying topologies and multiplicities into the same underlying topologies and number of ascending chains. Conversely, suppose that is isomorphic to for two multidirected graphs and . Since , these have the same underlying topology, implying that and do as well. Further, as T encodes the multiplicities as the number of ascending chains, we see that the multidirected graphs will have the same edge multiplicity between each pair of vertices. Hence, and are isomorphic.
Let us now consider an undirected graph
. Then, it induces a unique prime graph
, as described in Proposition 1. This unique prime graph, in turn, can be considered as a weighted prime graph
whose weight values are all 1. Thus, by Theorem 3, the graph
corresponds to a multidirected graph
whose edge multiplicities are all 1 as well. Note that the whole transformation is carried out in polynomial time due to Proposition 1. To verify the isomorphism properties, let us consider
and
, two isomorphic undirected graphs. Then, by Proposition 1, the graphs
and
are isomorphic. If we now conceive these two graphs as weighted prime graphs
and
, with weight values 1, then, by Theorem 3, these graphs give rise to two isomorphic multidirected graphs
and
.
Conversely, let us assume that
and
are two isomorphic graphs, coming from the undirected graphs
and
under the transformation
. Then, by Theorem 3, their weighted prime graph counterparts,
and
, have the same underlying structure as prime graphs. Thus, by Proposition 2, their corresponding undirected graphs have the same underlying structure. Hence,
and
are isomorphic.
Therefore, we have the following.
Theorem 4. The class of multidirected graphs with no self-loops is a GI-complete class.
3.3. Multidirected Graphs with Self-Loops Are GI-Complete
Finally, as a result of the above construction, we show that the class of multidirected graphs where self-loops are allowed is isomorphic complete. This will follow from loosing the restriction on the weight values for all edges of the form in the weighted prime graph. In fact, this time will take the value 1 if there is no self-loop, and will take the value if there is a self-loop with multiplicity n.
Example 7. The multidirected graph on the left of Figure 15 has a simple self-loop at node a, no self-loop at node b, and a self-loop of multiplicity 2 at node c. Thus, in its corresponding weighted prime graph, we have that , , and . The above construction shows that the class of multidirected graphs with self-loops is in a one-to-one correspondence with a broader class of weighted prime graphs, where now the edge weight values can take any positive integer. We denote this broader class of weighted prime graphs by WePGraph.
Remark 3. The class WPGraph is a proper subclass of WePGraph.
In terms of the transformation
mapping of multidirected graphs with self-loops to undirected graphs, this is defined similarly as in
Section 3.2.2, with the additional condition of adding an
n-chain link at any vertex that corresponds to a vertex of the directed graph with a self-loop with multiplicity
n.
Example 8. In Figure 16, the multidirected graph on the left has a simple self-loop at node a and a self-loop of multiplicity two at node c. The graph on the right corresponds to its undirected graph under the transformation . Notice that in the undirected graph, node a has a single chain link that corresponds to the simple self-loop, while node c has a chain link of length two, corresponding to the self-loop of multiplicity 2.
We also observe that the map from multidrected graphs with self-loops to undirected graphs is a polynomial time reduction because it only adds a finite number of chain links for each vertex that corresponds to a vertex of the directed graph with a self-loop.
Lastly, regarding the transformation
that maps undirected graphs into multidirected graphs with self-loops, this remains the same as in
Section 3.2.2, since the class of weighted prime graphs
WPGraph is contained in the broader class of weighted prime graphs
WePGraph. Therefore, we obtain the following.
Theorem 5. The class of multidirected graphs with self-loops is GI-complete.
4. Conclusions
This work addresses and formally resolves the open question concerning the Isomorphic Completeness problem for directed graphs, as well as its more general extension to multidirected graphs. To this end, we utilize Category Theory to establish an isomorphism with a category whose isomorphism problem can be reduced to that of undirected graphs in polynomial time.
Our findings open the door to explore the time complexity of directed graph techniques, many of which are known to be NP-hard. By leveraging our framework, these techniques can be translated into a more suitable framework, where the problem is solvable in polynomial time. This methodology reinterprets time complexity in terms of the objects and morphisms of the categories we are working with, allowing us to relativize and simplify the problem through isomorphic categories.
These results highlight the utility of Category Theory as a unifying framework for addressing complex graph-theoretic problems, offering both theoretical insights and practical strategies for computational efficiency.