Graph Isomorphism Checker
Graph 1
Graph 2
Result: -
Graph Invariants:
Understanding Graph Isomorphism
What is Graph Isomorphism?
Graph isomorphism is a fundamental concept in graph theory that determines if two graphs are essentially the same, even if they look different or have their vertices labeled differently. It involves finding a one-to-one correspondence (a bijective mapping) between the vertices of two graphs such that their adjacency relationships are perfectly preserved. If two graphs are isomorphic, they share all the same structural properties, making them identical from a graph-theoretic perspective.
Key Concepts
- Vertex mapping: f: V(G) → V(H): This refers to a function that assigns each vertex in graph G to a unique vertex in graph H. It must be a one-to-one and onto mapping, meaning every vertex in G has exactly one corresponding vertex in H, and vice-versa.
- Edge preservation: (u,v) ∈ E(G) ⟺ (f(u),f(v)) ∈ E(H): This is the core condition for isomorphism. It means that if two vertices 'u' and 'v' are connected by an edge in graph G, then their corresponding vertices 'f(u)' and 'f(v)' must also be connected by an edge in graph H. Conversely, if they are not connected in G, their images must not be connected in H.
- Bijective function: One-to-one and onto: A bijective function ensures that every vertex in the first graph has a unique partner in the second graph, and no vertex in the second graph is left out or mapped to by more than one vertex from the first.
- Automorphism: Isomorphism of a graph to itself: An automorphism is a special type of isomorphism where a graph is mapped onto itself. It reveals the symmetries within a single graph, showing how its vertices can be rearranged while maintaining its original structure.
Graph Invariants
Graph invariants are properties of a graph that remain unchanged under isomorphism. If two graphs are isomorphic, they must have the same values for all graph invariants. These properties are crucial for quickly determining if two graphs are *not* isomorphic (if their invariants differ, they cannot be isomorphic), though matching invariants do not guarantee isomorphism.
Basic Invariants
These are the most straightforward properties to check and are often the first step in determining isomorphism. They provide a quick filter for non-isomorphic graphs.
- Number of vertices: The total count of nodes in the graph. Isomorphic graphs must have the same number of vertices.
- Number of edges: The total count of connections between vertices. Isomorphic graphs must have the same number of edges.
- Degree sequence: A list of the degrees (number of connections) of all vertices, usually sorted in descending order. Isomorphic graphs must have identical degree sequences.
- Girth and diameter: Girth is the length of the shortest cycle in a graph, and diameter is the longest shortest path between any two vertices. These structural properties must also match for isomorphic graphs.
Spectral Invariants
These invariants are derived from the eigenvalues of matrices associated with the graph, such as the adjacency matrix. They offer more powerful, though computationally intensive, tests for isomorphism.
- Eigenvalue spectrum: The set of eigenvalues of the graph's adjacency matrix. If two graphs are isomorphic, their adjacency matrices will have the same set of eigenvalues.
- Characteristic polynomial: The polynomial whose roots are the eigenvalues of the adjacency matrix. Isomorphic graphs have the same characteristic polynomial.
- Laplacian spectrum: The eigenvalues of the Laplacian matrix, which is another matrix representation of a graph. This spectrum also serves as an invariant.
- Spectral radius: The largest absolute value among the eigenvalues of the adjacency matrix. This value must be identical for isomorphic graphs.
Structural Properties
These invariants describe deeper structural characteristics of the graph, such as how connected it is or the size of its largest complete subgraph.
- Connectivity: Describes how well-connected a graph is, e.g., vertex connectivity (minimum vertices to remove to disconnect) or edge connectivity.
- Chromatic number: The minimum number of colors needed to color the vertices of a graph such that no two adjacent vertices share the same color.
- Clique number: The size of the largest complete subgraph (clique) within the graph. A clique is a set of vertices where every pair is connected by an edge.
- Independence number: The size of the largest independent set, which is a set of vertices where no two vertices are connected by an edge.
Advanced Metrics
These are more specialized invariants, often used in chemical graph theory or network analysis, that quantify various aspects of graph structure.
- Wiener index: A topological index that sums the distances between all pairs of vertices in a graph. It's used in chemistry to predict properties of molecules.
- Randić index: Another topological index, calculated from the degrees of adjacent vertices. It's also used in cheminformatics.
- Graph energy: The sum of the absolute values of the eigenvalues of the adjacency matrix. It's a measure of the "energy" of a graph.
- Topological indices: Numerical values that characterize the topology of a graph, often used to correlate with chemical or physical properties.
Advanced Topics
The graph isomorphism problem is a significant area of research in theoretical computer science and mathematics, with implications for computational complexity and various practical applications.
Algorithmic Complexity
The graph isomorphism problem is one of the few problems in computational complexity theory that is known to be in NP but is not known to be either in P (solvable in polynomial time) or NP-complete. This makes it a fascinating and challenging area of study.
- GI-complete problems: A class of problems that are equivalent in difficulty to the graph isomorphism problem.
- Polynomial cases: While the general problem is hard, isomorphism can be solved in polynomial time for certain special classes of graphs (e.g., trees, planar graphs).
- Canonical forms: A canonical form is a unique representation for each graph within an isomorphism class. Finding a canonical form would solve the isomorphism problem.
- Graph canonization: The process of transforming a graph into its unique canonical form.
Special Graph Classes
The complexity of checking isomorphism can vary greatly depending on the specific type of graphs being considered. Some classes have efficient algorithms, while others remain challenging.
- Trees and forests: Isomorphism for trees (connected graphs with no cycles) and forests (collections of trees) can be checked efficiently in polynomial time.
- Planar graphs: Graphs that can be drawn on a plane without any edges crossing. Isomorphism for planar graphs can also be solved in polynomial time.
- Regular graphs: Graphs where every vertex has the same degree. Isomorphism for regular graphs is generally harder than for arbitrary graphs.
- Perfect graphs: Graphs where the chromatic number of every induced subgraph equals the size of its largest clique. These graphs have special properties that can sometimes simplify isomorphism testing.
Applications
Despite its theoretical complexity, graph isomorphism has numerous practical applications in diverse fields where structural comparison is essential.
- Chemical structures: Identifying identical chemical compounds or molecules, even if their atomic diagrams are drawn differently.
- Network analysis: Comparing different network topologies (e.g., social networks, computer networks) to find structural similarities or redundancies.
- Pattern matching: Recognizing patterns in images, data, or code by representing them as graphs and checking for isomorphism.
- Database indexing: Optimizing database queries by identifying and grouping structurally identical data patterns.
Related Problems
Graph isomorphism is part of a family of related problems in graph theory that involve comparing or transforming graph structures.
- Subgraph isomorphism: Determining if one graph is isomorphic to a subgraph of another graph. This is generally an NP-complete problem.
- Graph homomorphism: A mapping between graphs that preserves adjacency, but does not necessarily have to be bijective.
- Graph edit distance: A measure of the similarity between two graphs, defined as the minimum number of graph edit operations (insertions, deletions, substitutions of vertices/edges) needed to transform one graph into another.
- Graph matching: Finding a set of edges in a graph such that no two edges share a common vertex. This is a different concept from graph isomorphism.