Plot graph with large dataset
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
1 개 추천
Hi i want to know what does this type of graph mean? I got this while Using same code which works fine on small data but with large data it plots this graph.

채택된 답변
Steven Lord
2017년 5월 23일
1 개 추천
It means that your directed graph (stored as a digraph object) contains multiple connected components. You can see a smaller, simpler example on the documentation page for the conncomp function.
댓글 수: 6
lucksBi
2017년 5월 24일
Thanks alot for your answer. Can I convert into a simple graph?
Steven Lord
2017년 5월 24일
편집: Steven Lord
2017년 5월 24일
By "simple graph" do you mean a connected graph? There's no function to do this automatically as far as I remember but yes, you can do this. Start adding edges between two nodes that are in different connected components; each time you do, you reduce the number of components by 1. Continue until everything is in one component.
Note that there are many different ways to do this; using the example with numbered nodes on the Wikipedia page to which I linked (which is an undirected graph, not a directed graph, but the same principles apply), you could connect the node with degree 0 to any (or many, or all) of the other nodes. If you connected it to the node with degree 1, for example, you'd get something like:
% Make the graph object
s = [1 2 3 4 5 6 7 4];
t = [2 3 4 5 6 7 3 6];
G = graph(s, t);
% Generate coordinates to make it look
% something like the Wikipedia diagram
x = [0 0 1 3 5 4 2];
y = [0 2 1 2 2 1 0];
h = plot(G, 'XData', x, 'YData', y);
% Highlight the previously isolated node in red
highlight(h, 1, 'NodeColor', 'r', 'MarkerSize', 8)
% Highlight the node to which I connected it in black
highlight(h, 2, 'NodeColor', 'k', 'MarkerSize', 8)
While I connected the red highlighted node to the black highlighted node for this example, I could just as easily have connected it to any other node, like:
% Remove edge (1, 2) and add edge (1, 3)
G = rmedge(G, 1, 2);
G = addedge(G, 1, 3);
figure
h = plot(G, 'XData', x, 'YData', y);
% Highlight the previously isolated node in red
highlight(h, 1, 'NodeColor', 'r', 'MarkerSize', 8)
% Highlight the node to which I connected it in black
highlight(h, 3, 'NodeColor', 'k', 'MarkerSize', 8)
Or if you wanted you could have both connections.
G = addedge(G, 1, 2);
figure
h = plot(G, 'XData', x, 'YData', y);
highlight(h, 1, 'NodeColor', 'r', 'MarkerSize', 8);
highlight(h, [2 3], 'NodeColor', 'k', 'MarkerSize', 8)
I could continue but I think I'll stop at just three alternatives.
lucksBi
2017년 5월 27일
Hey thanks alot for this description i have understood the concept very clearly. I want to ask one more thing that if i have many nodes in my graph e.g. 900 nodes so i have to add and remove edges for every node separately to plot a connected graph?
bita hallajian
2017년 10월 27일
How to create a graph for a large dataset in Matlab? first load the dataset, how to define nodes, edges, and weights?because we cant define source and target nodes and their weights in a large dataset, for example, creating graph for a social network
Steven Lord
2017년 10월 27일
Asyran Abdullah
2018년 8월 30일
Then, how can we generate a connected graft by using random source and destination node?
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
