%% Highlight Node Neighbors
% Create a graph representing a square grid with a side of 8 nodes. Plot the graph and return a handle to the GraphPlot object, p.

n = 8;
A = delsq(numgrid('S',n+2));
G = graph(A,'omitselfloops');
p = plot(G);

%
% Find the neighbors of node 36.

n36 = neighbors(G,36)

%
% Use highlight to change the color of node 36 to green, and the color of its neighbors and their connecting edges to red.

highlight(p,36,'NodeColor',[0 0.75 0])
highlight(p,n36,'NodeColor','red')
highlight(p,36,n36,'EdgeColor','red')

% Copyright 2015 The MathWorks, Inc.