How to create isolate nodes in graph?

조회 수: 2 (최근 30일)
David McVea
David McVea 2021년 1월 8일
답변: Kelly Kearney 2021년 1월 8일
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.

답변 (1개)

Kelly Kearney
Kelly Kearney 2021년 1월 8일
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).

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by