mkisiu
asked on
c++ reading data from file into two dimensional array
Hello,
Could you please help me to resolve the following task:
In the text file I have the matrix of connections between points together with the weights for each pair, for instance:
A, B, 10
A, C, 15
B, D, 11
D, C, 12
E, A, 14
Now, I need to convert these data into the graph matrix with zeroes on diagonal (A,A=0, B,B=0, etc.) and x stands for no weight for pair:
[[0, 10, 15, x, 14],
[10, 0, x, 11, x],
[15, x, 0, 12, x],
[x, 11, 12, 0, x],
[14, x, x, x, 0]]
I need to do that in c++ but I believe this is rather matter of an algorithm.
Thanks in advance
Mike
Could you please help me to resolve the following task:
In the text file I have the matrix of connections between points together with the weights for each pair, for instance:
A, B, 10
A, C, 15
B, D, 11
D, C, 12
E, A, 14
Now, I need to convert these data into the graph matrix with zeroes on diagonal (A,A=0, B,B=0, etc.) and x stands for no weight for pair:
[[0, 10, 15, x, 14],
[10, 0, x, 11, x],
[15, x, 0, 12, x],
[x, 11, 12, 0, x],
[14, x, x, x, 0]]
I need to do that in c++ but I believe this is rather matter of an algorithm.
Thanks in advance
Mike
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER