%% Label Graph Nodes and Edges
% Create a directed graph. Plot the graph with custom labels for the nodes and edges.

s = [1 1 1 2 2 3 3 4 4 5 6 7];
t = [2 3 4 5 6 5 7 6 7 8 8 8];
G = digraph(s,t)

%

eLabels = {'x' 'y' 'z' 'y' 'z' 'x' 'z' 'x' 'y' 'z' 'y' 'x'};
nLabels = {'{0}','{x}','{y}','{z}','{x,y}','{x,z}','{y,z}','{x,y,z}'};
plot(G,'Layout','force','EdgeLabel',eLabels,'NodeLabel',nLabels)

% Copyright 2015 The MathWorks, Inc.