Hi. I've created a graph G in MATLAB. But when I type A = adjacency(G), I get this error:
Unable to use a value of type 'graph' as an index.

댓글 수: 1

Ameer Hamza
Ameer Hamza 2020년 5월 2일
Can you share an example code that can recreate this error?

댓글을 달려면 로그인하십시오.

 채택된 답변

Steven Lord
Steven Lord 2020년 5월 2일

0 개 추천

You've created a variable named adjacency that is taking precedence over the adjacency method for graph objects. Rename the variable.

댓글 수: 2

s = {'1' '2'};
t = {'2' '3'};
G = graph(s,t);
A = adjacency(G);
This is my code, I'm still getting the same error
Can you show the output of
which graph
which adjacency

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

질문:

2020년 5월 1일

댓글:

2020년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by