isisomorphic
Tests whether two graphs have the same structure.
Category: Mathematics > Graph and Network Algorithms
Syntax
tf = isisomorphic(G1, G2)
Returns true if the graphs are isomorphic.
Description
Two graphs are isomorphic when the nodes of one can be renamed so that its edges become exactly the edges of the other. Node labels do not matter, only the pattern of connections. Different numbers of nodes or edges, or different degree counts, rule out isomorphism immediately.
To find the renaming itself, use isomorphism.
Input arguments
G1, G2- Two graphs of the same kind: both
graphor bothdigraph.
Output arguments
tf- Logical scalar.
Example
Same shape, different labels
A = graph([1 2], [2 3]);
B = graph([1 3], [3 2]);
C = graph([1 2 3], [2 3 1]);
isisomorphic(A, B)
isisomorphic(A, C)
Output
ans = logical
1
ans = logical
0