Extract subgraph using names
Ältere Kommentare anzeigen
Hi MathWorks community,
I have a graph G which has 6119 nodes. I want to extract a subgraph H with only 539 nodes. The name of the nodes that need to be extract are in a seperate 539 x 1 double called NodeID. I tried the following code, but received 'Error using graph/subgraph (line 29) Nodes must be a vector of unique node indices, a vector of unique node names, or a logical vector of length equal to the number of nodes.'.
H = subgraph(G,strtrim(num2str(NodeID)))
I am not sure what the problem is and what should I do to resolve the problem.
For your reference, I am also attaching my G.Nodes and NodeID as a mat. file.
Thanks!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

