Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
getedgesbynodeid and graphshortestpath problem

Subject: getedgesbynodeid and graphshortestpath problem

From: Poornima

Date: 25 Jul, 2013 15:12:08

Message: 1 of 1

Hi all,
I am getting this error....
??? Error using ==> biograph.biograph.getedgesbynodeid at 62
When two input arguments are given, NODE_IDS (or PATH_IDS) must be a cell string.edges = getedgesbynodeid(h,get(h.Nodes(path),'ID'));

What am I supposed to do to get over this error, I am trying to color the shortest path.
The DIST, PATH visible in graphkshortestpaths function is not visible with graphshortestpath...

Please I need help.

The code snippet is ....
[DIST,PATH]= graphkshortestpaths( G, stnode, destnode, 2 );
h = view(biograph(G,[],'ShowArrows','Off','ShowWeights','off'));
    
%stnode is start node , destnode is the end node
[dist, path, pred] = graphshortestpath(G,stnode,destnode);
;
 set(h.Nodes(path),'Color',[1 0.4 0.4]);
% fowEdges = getedgesbynodeid(h,get(h.Nodes(path),'ID'));
% revEdges = getedgesbynodeid(h,get(h.Nodes(fliplr(path)),'ID'));
% edges = [fowEdges;revEdges];
edges = getedgesbynodeid(h,get(h.Nodes(path),'ID'));
set(edges,'LineColor',[1 0 0])
set(edges,'LineWidth',1.5)
    
Thank you once again, please help.
Poornima

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us