Function iaminedge2node

Description

Transforms the edge values into the node values by selecting the minimum value of the connected edges.

Synopse

  • N = iaminedge2node(A)
    • A: The adjacency matrix to transform
    • N: An array with the values of each node
1 def iaminedge2node(A):
2     from numpy import arange
3     n = len(A)
4     A = A.astype('float')
5     A[arange(n), arange(n)] = 1e400
6     return A.min(1)

Examples

Examples

 1 from iaOPF import *
 2 
 3 A = array([[ 0 ,  8,  9,  4,  6,  8],
 4            [ 8 ,  1,  6, 10,  4,  8],
 5            [ 9 ,  6, 10, 10,  3,  6],
 6            [ 4 , 10, 10,  7,  4,  5],
 7            [ 6 ,  4,  3,  4,  2,  6],
 8            [ 8 ,  8,  6,  5,  6,  9]])
 9 print A
10 mmgraphviz(iaadjmxtcreate(A,dist=True))
11 N = iaminedge2node(A)
12 print N
[[ 0  8  9  4  6  8]
 [ 8  1  6 10  4  8]
 [ 9  6 10 10  3  6]
 [ 4 10 10  7  4  5]
 [ 6  4  3  4  2  6]
 [ 8  8  6  5  6  9]]
[ 4.  4.  3.  4.  3.  5.]
/media/_xsb/iaOPF/iaminedge2node/GRVIZ74810_001.png