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

1 vue (au cours des 30 derniers jours)
Artur Iskhakov
Artur Iskhakov le 15 Juil 2020
Commenté : Artur Iskhakov le 15 Juil 2020
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?

Réponse acceptée

Christine Tobler
Christine Tobler le 15 Juil 2020
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
  1 commentaire
Artur Iskhakov
Artur Iskhakov le 15 Juil 2020
Oh thank you so much, it's working now))

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by