Set weight (cost) to edges.
I have to implement an algorithm to solve a problem in a graph. Right now i am just trying to "set" the problem (data representation). This is a very critical point because the problem will be very large (e.g. 500 or more vertices). So far i have set the vertices and edges and i am wondering (to be honest, i think it's impossible but i decided to give it a try here) if there is a way to set the weight of the edges without doing it "manually"(i have implemented a setWeight() method which assigns a weight to a given edge). As i said before the problem is very large and it won't be very efficient to call setWeight() for every edge (since that might have 10000 or more edges.) The only idea i have is to make a file with the weights and change my method to get the data from it - but i don't know if that would be very efficient either. I have no experience ιn such problems, so any information would be very useful.
Note: the edges' weights don't follow any pattern they are only satisfying the triangular inequality.
Any help or suggestions would be appreciated.
Thanks in advance.
Re: Set weight (cost) to edges.
Getting 10000 values from a file seems a good solution if the values can not be computed.