Remove edges in a subgraph SG using nodes IDs (numbers) from the graph G
3 views (last 30 days)
Show older comments
Hi, I have a graph defined by node pairs (node IDs): s = [1 1 2 4 7 ...] t = [2 5 3 5 6 ...] Since the graph is huge and I would need to work only on a portion of it, I extracted a subgraph.
If I am not wrong, it looks like that subgraph is reordering the node IDs (right?), therefore, when I try to remove edges (and nodes) from the subgraph, by using the same node IDs of my graph contained in s = [...] and in t = [...], I get an error.. Any idea to fix this small issue? (I also tried to assign and employ "nodenames"..but without success)
0 Comments
Answers (1)
Walter Roberson
on 7 Nov 2019
Edited: Walter Roberson
on 7 Nov 2019
Use node names instead of node numbers when you create the graph. Then in the sub-graph you can use findnode(). Or just give the node names directly in the rmedge() call.
4 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!