Adding edges to a Graph
    4 views (last 30 days)
  
       Show older comments
    
Hi All,
I am using the following section of code to add edges to a graph
for node = 1:length(TobeAdded)-1
        source = TobeAdded(node);
        sink = TobeAdded(node+1);
        Graph = addedge(Graph,source,sink);
end
I'd like to know if there is a faster way to do this.
0 Comments
Answers (1)
  Walter Roberson
      
      
 on 19 Oct 2020
        Graph = addedge(Graph, TobeAdded(1:end-1), TobeAdded(2:end))
0 Comments
See Also
Categories
				Find more on Graph and Network Algorithms in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
