MATLAB Answers

0

Incidence matrix of a graph

Asked by Vlad Bec on 18 Apr 2019
Latest activity Commented on by Vlad Bec on 5 May 2019 at 14:44
Hello,
Is there any way to create a incidence matrix of a graph. For example, for IEEE 7-bus system I have branch data like this:
1 2
2 3
2 7
2 6
3 6
3 4
4 7
4 5
And I need incidence matrix to be like this:
Or, maybe better solution, to give me numbers of nodes which are mutualy connected, for example
1 2 (node 1 is connected to node 2)
1 2 3 6 7 (node 2 is connected to nodes 1, 3, 6, 7)
2 3 4 6 (node 3 is connected to nodes 2, 4 and 6)
etc.
Thanks!!!

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 18 Apr 2019
 Accepted Answer

If you have constructed a graph() object named G, then
full(G.adjacency)

  3 Comments

I just have those two columns( from node and to node) in Excel like in example
G = graph(from_node, to_node);
adj = full(G.adjacency);
Thank you a lot!

Sign in to comment.