Error using matlab.graphics.chart.primitive.GraphPlot/highlight>checkEdgesNodePair
Show older comments
I've been trying to add colors to my graph's edges, but I got this error and I have no idea how to solve it:
Error using matlab.graphics.chart.primitive.GraphPlot/highlight>checkEdgesNodePair
s and t must specify edges in the graph.
Error in matlab.graphics.chart.primitive.GraphPlot/highlight
Error in asd (line 10)
highlight(p,[1 1 1 1 1],[1 2 3 4 6],'EdgeColor','r')
clear all
close all
clc
s = {'a' 'a' 'a' 'a' 'a' 'b' 'b' 'b' 'b' 'c' 'c' 'c' 'd' 'd' 'd' 'e' 'e' 'e' 'e' 'f' 'f' 'f' 'f' 'g' 'g' 'g' 'g' 'g'};
t = {'a' 'b' 'c' 'd' 'f' 'a' 'c' 'd' 'g' 'b' 'c' 'e' 'c' 'a' 'b' 'e' 'c' 'b' 'g' 'a' 'b' 'd' 'e' 'g' 'a' 'c' 'd' 'e'};
G = digraph(s,t);
labels = {'a/5' 'a/5' 'a/5' 'a/5' 'a/5' 'b/4' 'b/4' 'b/4' 'b/4' 'c/3' 'c/3' 'c/3' 'd/3' 'd/3' 'd/3' 'e/4' 'e/4' 'e/4' 'e/4' 'f/4' 'f/4' 'f/4' 'f/4' 'g/5' 'g/5' 'g/5' 'g/5' 'g/5'};
p = plot(G,'Layout','layered','EdgeLabel',labels);
highlight(p,[1 1 1 1 1],[1 2 3 4 6],'EdgeColor','r')
highlight(p,[2 2 2 2],[1 2 4 7],'EdgeColor','g')
highlight(p,[3 3 3],[2 3 5],'EdgeColor','b')
highlight(p,[4 4 4],[1 2 3],'EdgeColor','c')
highlight(p,[5 5 5 5],[2 3 5 7],'EdgeColor','m')
highlight(p,[6 6 6 6],[1 2 4 5],'EdgeColor','y')
highlight(p,[7 7 7 7 7],[7 1 3 4 5],'EdgeColor','k')
title('PageRank Hivatkozások közti átmenet')
Accepted Answer
More Answers (0)
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!