How can I generate a square lattice undirected graph?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rayan Glus
am 14 Okt. 2021
Kommentiert: Rayan Glus
am 15 Okt. 2021
Hi,
How can I generate a square lattice undirected graph? I tried this:
n = 10;
A = delsq(numgrid('S',n+2));
G = graph(A,'omitselfloops');
plot(G)
But the links do not look straight, right? And the graph looks like a plateau.
Thanks!
1 Kommentar
Akzeptierte Antwort
Chunru
am 15 Okt. 2021
n = 10;
A = delsq(numgrid('S',n+2));
G = graph(A,'omitselfloops');
h = plot(G);
h.XData = floor((0:99)/10);
h.YData = rem((0:99), 10);
axis equal
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Undirected Graphs finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!