VOOZH about

URL: https://www.geeksforgeeks.org/python/difference-between-graph-isomorphism-and-automorphism-using-python-networkx/

⇱ Difference between Graph Isomorphism and Automorphism using Python NetworkX - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Difference between Graph Isomorphism and Automorphism using Python NetworkX

Last Updated : 28 Jun, 2024

Graph isomorphism and automorphism are important concepts in graph theory. Graph isomorphism checks the equivalence of two graphs, while graph automorphism deals with the symmetry within a single graph. Using Python NetworkX, we can easily explore and visualize these concepts, making it a valuable tool for studying complex networks.

Difference between Graph Isomorphism and Automorphism

Characteristics

Graph Isomorphism

Graph Automorphism

Definition

A bijective mapping between the vertices of two graphs preserving the adjacency.

A re-labeling of the graph's vertices that maps the graph onto itself.

Relationship

Between the two different graphs.

Within the same graph.

Purpose

To check if two graphs are structurally identical.

To find symmetries within the graph.

Example Code Usage

nx.is_isomorphic(G1, G2)

nx.algorithms.isomorphism.GraphMatcher(graph, graph).isomorphisms_iter()

Real-world Example

Checking if two social networks are identical.

Finding symmetrical properties in the molecular structures.

What is Graph Isomorphism?

Graph isomorphism is a concept where two graphs and are considered isomorphic if there is a bijection (one-to-one correspondence) between their vertex sets that preserves adjacency. In simpler terms, if you can relabel the vertices of to make it identical to ​, the two graphs are isomorphic.

Graph isomorphism is important in various fields, including chemistry (for comparing molecular structures), network theory, and computer science (for pattern recognition and data structure analysis).

Formal Definition

Two graphs are isomorphic if there exists a bijection such that any two vertices are adjacent in if and only if are adjacent in ​.

Example:

Output:

Are G1 and G2 isomorphic? True

What is Graph Automorphism?

Graph automorphism is a special case of graph isomorphism where a graph GGG is mapped onto itself in a way that preserves its structure. An automorphism of a graph is a permutation of the vertices that preserves adjacency.

Graph automorphisms are significant in studying the symmetries of graphs, which has applications in chemistry (studying molecular symmetries), network theory (analyzing symmetrical structures in networks), and combinatorial design.

Formal Definition

A graph has an automorphism if there exists a bijection such that any two vertices are adjacent if and only if are adjacent.

Example:

Output:

Automorphisms of G: [{0: 0, 1: 1, 2: 2}, {0: 0, 2: 1, 1: 2}, {1: 0, 0: 1, 2: 2}, {1: 0, 2: 1, 0: 2}, {2: 0, 0: 1, 1: 2}, {2: 0, 1: 1, 0: 2}]
Comment
Article Tags: