How do I add edges to a directed graph with an edgetable -keep getting errors
显示 更早的评论
I have a digraph, BG with an edge table of size 133x13 which includes the first column EndNodes which is a 13x2 cell array of end nodes and 12 other variables of different types. I have a table 'addedges' to add in which is a table of 10x12 with variable names and type the same as BG.Edges excluding the first EndNodes column. I have tried multiple ways to add these edges:
s=addedges.start_node_no
t=addedges.end_node_no
BG = addedge(BG,s,t,addedges)
"Warning: The assignment added rows to the table, but did not assign values to all of the table's existing variables. Those variables are extended with rows containing default values.Error using digraph/addedge (line 167)
The number of table variables in an assignment must match."
So I then duplicated the start_node_no and end_node_no columns in 'addedges' , merged it and named it EndNodes so the table is identicial in size at 13 columns with the same variable names and tried:
BG = addedge(BG,addedges)
and still got the same error.
I then tried to the make EndNodes a cell array as it is currently a double but had no success. I have tried duplicated BG.Edges and adding them and that works so there is obviously something wrong with my table and not the code.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!