Hello guys ! First of all sorry for my bad english...
I got Matlab2016, and i would like to know if is possible enlarge a node in a graph. Is there some particular function or not?
My idea is to enlarge one node based on the number of link that it has.. if one node has got many link is BIG, if it has few link is SMALL.
can you help me please?
really thanks to you :D

 Akzeptierte Antwort

michio
michio am 28 Sep. 2016
Bearbeitet: michio am 28 Sep. 2016

1 Stimme

highlight function may be the one you are looking for. highlight: Highlight nodes and edges in plotted graph The following is one of the examples from the page above with a slight modification:
n = 8;
A = delsq(numgrid('S',n+2));
G = graph(A,'OmitSelfLoops');
p = plot(G);
highlight(p,36,'MarkerSize',20)
highlight(p,6,'MarkerSize',5)
You can make a specific node bigger. Hope this helps.

4 Kommentare

Light.16
Light.16 am 28 Sep. 2016
Thank you for the answer! Do you know if is possible highlight directly on graph? I mean using directly graphic interface
michio
michio am 28 Sep. 2016
If you really want to do this interactively on the graph interface (plottool), you can manually change the markersize property of the graph object. see the captured image.
After executing
highlight(p,36,'MarkerSize',20)
for example, MarkerSize property becomes 1x64 array, each element corresponds to the size of each node. By clicking the small icon (right next to the section colored blue in the image) it shows a variable editor. On the editor you can manually change the values.
Light.16
Light.16 am 28 Sep. 2016
Really thank for this help!! Only one question... is maybe possible that the program understand automatically which node enlarge? Or i've to do this manually?
For example... how can i expand one node with 20 link and differentiate it from another one that got only 1 link?
michio
michio am 29 Sep. 2016
I thought you wanted do this manually.
degree find the number of links of each node. I think you can make use of this. See Degree of graph nodes.
For example, setting the output of degree to MarkerSize property would enlarge the node to the size which is a function of the number of links. Below, numlinks is squared so that the effect is more visible.
n = 8;
A = delsq(numgrid('S',n+2));
G = graph(A,'OmitSelfLoops');
p = plot(G);
numlinks = degree(G);
p.MarkerSize = numlinks.^2;
You can modify numlinks as you want. Say, if you want to enlarge a node with 2 links:
n = 8;
A = delsq(numgrid('S',n+2));
G = graph(A,'OmitSelfLoops');
p = plot(G);
numlinks = degree(G);
Node2enlarge = find(numlinks == 2);
highlight(p, Node2enlarge);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 28 Sep. 2016

Kommentiert:

am 29 Sep. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by