Highlight 2 lowest weight edges out of 3 from node
Mostrar comentarios más antiguos
So I created digraph which have edges with weights.
s = [1 2 1 3 1 4 2 3 3 4 2 4];
t = [2 1 3 1 4 1 3 2 4 3 4 2];
weights = [10 5 15 6 20 8 9 13 9 12 10 8];
names = {'1' '2' '3' '4'};
G = digraph(s,t,weights,names)
p = plot(G,'Layout','force','EdgeLabel',G.Edges.Weight)
I wanted highlight edges which have lowest weights, so I started combine with mink.
[eid,nid] = mink(outedges(G,3),2)
It worked well with nodes 1,2 and 4, but on node 3 it highlighted wrong edges (should highlight egdes with weights 6 and 9).
I noticed that highlight is based on edges id. The problem is I have no idea how for example implement G.Edges.Weight into mink or what is another solution.

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!