www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CompareGraphsWithDifferentLabelsAndLayoutsExample.m

    %% Compare Graphs with Different Labels and Layouts
% Create and plot two graphs, |G1| and |G2|.
G1 = graph([1 1 1 2 2 3 3 4 5 5 7 7],[2 4 5 3 6 4 7 8 6 8 6 8]);
plot(G1,'XData',[1 4 4 1 2 3 3 2],'YData',[4 4 1 1 3 3 2 2])

%%
G2 = graph({'a' 'a' 'a' 'b' 'b' 'b' 'c' 'c' 'c' 'd' 'd' 'd'}, ...
    {'g' 'h' 'i' 'g' 'h' 'j' 'g' 'i' 'j' 'h' 'i' 'j'});
plot(G2,'XData',[1 2 2 2 1 2 1 1],'YData',[4 4 3 2 3 1 2 1])

%%
% Determine whether an isomorphism exists for |G1| and |G2|. The result
% indicates that the graphs are structurally the same despite their
% different labels and layouts.
tf = isisomorphic(G1,G2)