How to find all edges indexes if node indexes are given?

조회 수: 1 (최근 30일)
Artur Iskhakov
Artur Iskhakov 2020년 7월 15일
댓글: Artur Iskhakov 2020년 7월 15일
Hi! How can I find all edges indexes in graph G that are made of nodes 4,5,6 (in this case according to G.Edges those edges are 5 and 6). Can anybody help me with that?

채택된 답변

Christine Tobler
Christine Tobler 2020년 7월 15일
So you're looking for all edges where both end nodes are part of the set 4, 5, 6? This will compute them:
>> [s, t] = findedge(g);
>> nodes = [4 5 6];
>> find(ismember(s, nodes) & ismember(t, nodes))
ans =
5
6

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by