How to graph a connectivity/adjacency matrix?
显示 更早的评论
I want to graph the structure of a network (a power grid). I have a list containing to-from nodes for each branch.
The BIOGRAPH function is almost perfect. The drawback is that the lines always go out the "bottom" of the ancestor block, and into the "top" of the descendant. As an ancestor is always displayed above its descendants, the graphs are sometimes very chaotic.
It would be much better if the graph was plotted in a way that just showed which nodes were connected, without any hierarchy, and where lines could be horizontal.
Edit: I need to be able to assign different colors to various lines / nodes, to visualize voltage issues or overloads etc, similar to what I've done using biograph (code below).
Is this possible? It doesn't need to be a perfect solution, any improvements would be great.
This is the code I use now:
%%Plot biograph
Sys = sparse(from,to,1,s,s);
SysTri = tril(Sys + Sys');
bg = biograph(SysTri,ids,'ShowArrows','off','ShowWeights','off');
h = view(bg);
%%Color faulted line:
set(h.nodes(newFaultNodes),'Color',[1 0.4 0.4]);
fowEdges = getedgesbynodeid(h,get(h.Nodes(newFaultNodes),'ID'));
revEdges = getedgesbynodeid(h,get(h.Nodes(fliplr(newFaultNodes)),'ID'));
edges = [fowEdges;revEdges];
set(edges,'LineColor',[1 0 0])
set(edges,'LineWidth',2)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Directed Graphs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!