In Matlab, how can I remove nodes with no edges in a directed graph?

Tweakimp

I enter this:

plot(digraph([1 2 3 10],[2 3 1 1]))

And the figure shows enter image description here

How can I remove the nodes 8,9,4,5,6 and 7? Is there a setting to not show any nodes that dont have edges?

Luis Mendo

You can manually relabel the edges using unique, so that there are no holes in the list of node numbers. To maintain the original node names, pass them as fourth input to digraph in the form of a cell array of strings:

S = [1 2 3 10];
T = [2 3 1 1];
[u, ~, w] = unique([S T]);
plot(digraph(w(1:end/2), w(end/2+1:end), [], cellstr(num2str(u.'))))

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to draw a directed graph in matlab?

From Dev

How to draw a directed graph in matlab?

From Dev

How can I add edges to my graph in a for loop?

From Dev

Adding nodes and edges to graph data structure dynamically in Matlab

From Dev

How can I fill between edges of these characters in matlab?

From Dev

How come I cannot (for) loop the input for my Graph's nodes and edges?

From Dev

Boost graph: How to copy the nodes and edges of a graph without copying properties?

From Dev

How to analyse and identify directed graph relationships (between nodes) in Python

From Dev

How can I plot a Quarter graph in matlab?

From Dev

What is the minimum number of edges to be deleted in a directed graph to just remove all the cycles?

From Dev

Boost directed graph: comparing edges of a vertex

From Dev

Generate directed graph without returning edges in java

From Dev

How to find two randoms nodes with no edges between them in graph?

From Dev

How to add nodes and edges to a network analysis graph in Networkx?

From Dev

How to find two randoms nodes with no edges between them in graph?

From Dev

d3.js - How can I expand force directed graph horizontally?

From Dev

How to plot 3d directed graph in matlab

From Dev

Can I use just a simple Set for cycle detection in directed graph?

From Dev

What way I can represent a weighted, directed graph in Java?

From Dev

can I have a directed cyclic graph with just two vertexes?

From Dev

How can I remove all nodes from a scenekit scene?

From Dev

How to remove nodes from TensorFlow graph?

From Dev

How to gradually remove nodes from the graph

From Dev

Convert tsv file so i can use it for nodes and edges in python

From Dev

Distance between two nodes in weighted directed graph

From Dev

Finding list of all nodes in a directed graph

From Dev

Reachability Count for all nodes in a Directed Acyclic Graph

From Dev

get all leaf nodes of a directed graph in pydot

From Dev

finding the route between 2 nodes in a directed graph?

Related Related

  1. 1

    How to draw a directed graph in matlab?

  2. 2

    How to draw a directed graph in matlab?

  3. 3

    How can I add edges to my graph in a for loop?

  4. 4

    Adding nodes and edges to graph data structure dynamically in Matlab

  5. 5

    How can I fill between edges of these characters in matlab?

  6. 6

    How come I cannot (for) loop the input for my Graph's nodes and edges?

  7. 7

    Boost graph: How to copy the nodes and edges of a graph without copying properties?

  8. 8

    How to analyse and identify directed graph relationships (between nodes) in Python

  9. 9

    How can I plot a Quarter graph in matlab?

  10. 10

    What is the minimum number of edges to be deleted in a directed graph to just remove all the cycles?

  11. 11

    Boost directed graph: comparing edges of a vertex

  12. 12

    Generate directed graph without returning edges in java

  13. 13

    How to find two randoms nodes with no edges between them in graph?

  14. 14

    How to add nodes and edges to a network analysis graph in Networkx?

  15. 15

    How to find two randoms nodes with no edges between them in graph?

  16. 16

    d3.js - How can I expand force directed graph horizontally?

  17. 17

    How to plot 3d directed graph in matlab

  18. 18

    Can I use just a simple Set for cycle detection in directed graph?

  19. 19

    What way I can represent a weighted, directed graph in Java?

  20. 20

    can I have a directed cyclic graph with just two vertexes?

  21. 21

    How can I remove all nodes from a scenekit scene?

  22. 22

    How to remove nodes from TensorFlow graph?

  23. 23

    How to gradually remove nodes from the graph

  24. 24

    Convert tsv file so i can use it for nodes and edges in python

  25. 25

    Distance between two nodes in weighted directed graph

  26. 26

    Finding list of all nodes in a directed graph

  27. 27

    Reachability Count for all nodes in a Directed Acyclic Graph

  28. 28

    get all leaf nodes of a directed graph in pydot

  29. 29

    finding the route between 2 nodes in a directed graph?

HotTag

Archive