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.

 Réponse acceptée

I figured it - to help others who have the same issue, it was just a spelling missing in a variable name in the table I was trying to add!

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by