%% Find Incoming Edges and Node Predecessors
% Plot a graph and highlight the incoming edges and predecessors of a selected node.
%
% Create and plot a directed graph using the bucky adjacency matrix. Highlight node 1 for reference.

G = digraph(bucky);
p = plot(G);
highlight(p,1,'NodeColor','r','MarkerSize',10)

%
% Determine the incoming edges and predecessors of node 1. Highlight these nodes and edges.

[eid,nid] = inedges(G,1)

%

X = G.Edges(eid,:)

%

highlight(p,nid,'NodeColor','g','MarkerSize',9)
highlight(p,'Edges',eid,'EdgeColor','g')

% Copyright 2012 The MathWorks, Inc.