Edge Table of Undirected Graph
Ältere Kommentare anzeigen
I realize that I am unable to extract the edge and node tables of an undirected graph (ungraph). To explain, take the following adjacency matrices:
>> A = [0 0 0 5 0; 0 0 0 0 6; 0 2 0 0 0; 0 0 3 0 0; 1 0 4 0 0]; % Adjacency matrix of digraph.
>> Asym = 0.5 * (A + A'); % Adjacency matrix of ungraph.
Then, I create the following digraph and ungraph:
>> G = digraph(A); % Digraph associated with A. Note how MATLAB ACKs this request.
G =
digraph with properties:
Edges: [6×2 table]
Nodes: [5×0 table]
>> Gsym = graph(Asym); % Ungraph associated with Asym. Note that MATLAB ACKs differently for an ungraph. This change is quite recent.
<5 nodes, 6 edges, undirected>
Now, I want to look at the edge weights of G and Gsym:
>> G.Edges % This gives the edge table of digraph G.
ans =
6×2 table
EndNodes Weight
________ ______
1 4 5
2 5 6
3 2 2
4 3 3
5 1 1
5 3 4
>> Gsym.Edges % This used to work well. But it now gives an error.
Incorrect number or types of inputs or outputs for function 'getEdgesTable'.
Error in indexing (line 16)
out = getEdgesTable(G);
More importantly, how do I look at the edge table and node table of the ungraph Gsym?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!