gistlib
main.m% Create a 10x10 Manhattan grid rows = 10; cols = 10; G = gridGraph(rows,cols); plot(G) % Add midpoint nodes midpointNodes = []; for i = 1:rows-1 for j = 1:cols-1 midpoint = [i+0.5, j+0.5]; % Calculate midpoint between nodes midpointNodes = [midpointNodes; midpoint]; end end hold on plot(midpointNodes(:,1), midpointNodes(:,2), 'ro', 'MarkerSize', 10) hold off 388 chars19 lines
% Create a 10x10 Manhattan grid rows = 10; cols = 10; G = gridGraph(rows,cols); plot(G) % Add midpoint nodes midpointNodes = []; for i = 1:rows-1 for j = 1:cols-1 midpoint = [i+0.5, j+0.5]; % Calculate midpoint between nodes midpointNodes = [midpointNodes; midpoint]; end end hold on plot(midpointNodes(:,1), midpointNodes(:,2), 'ro', 'MarkerSize', 10) hold off
gistlibby LogSnag