Undefined function 'highlight' for input arguments of type 'digraph'

4 次查看(过去 30 天)
Hi ,
I have a plot that contain a graph and I want to highlight a path between two nodes so I used the following:
plot(G);
v = shortestpath(G,'n','s');
highlight(G,v,'EdgeColor','r');
But I keep getting this error :
Undefined function 'highlight' for input arguments of type 'digraph'.
Error in PGM (line 26)
highlight(G,v,'EdgeColor','r');
Any solution for that ? thanks

采纳的回答

Steven Lord
Steven Lord 2017-6-26
You highlight the graphics object created by calling plot on a graph or digraph, not the graph or digraph itself.
h = plot(G);
v = shortestpath(G,'n','s');
highlight(h,v,'EdgeColor','r');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by