How to create isolate nodes in graph?

Hello,
I am trying to create an isolate node (degree 0, no edges) in a graph.
G = graph({'a', 'b', 'c','e'},{'c', 'a', 'd',''});
creates an unnamed node attached to e, when what I want is e to be isolated.
Any advice on how to do this?
Thanks.

Antworten (1)

Kelly Kearney
Kelly Kearney am 8 Jan. 2021

1 Stimme

The easiest way would be to simply add the isolated node to the existing graph:
G = graph({'a', 'b', 'c'},{'c', 'a', 'd'});
G = addnode(G, 'e')
Alternatively, you could look at some of the other syntaxes for creating a graph (such as providing an EdgeTable and NodeTable rather than a simple list of source/target nodes).

Kategorien

Mehr zu Networks finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Gefragt:

am 8 Jan. 2021

Beantwortet:

am 8 Jan. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by