Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Set weight (cost) to edges.

  1. #1
    Member
    Join Date
    Jan 2012
    Location
    Hellas
    Posts
    284
    Thanks
    11
    Thanked 59 Times in 57 Posts

    Default Set weight (cost) to edges.

    Hello guys!
    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.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,145
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Set weight (cost) to edges.

    Getting 10000 values from a file seems a good solution if the values can not be computed.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    andreas90 (March 18th, 2012)

Similar Threads

  1. Finding the edges of object in photo
    By Picker in forum Algorithms & Recursion
    Replies: 1
    Last Post: April 20th, 2012, 11:32 PM
  2. Is Amazon RDS Cost-Effective?
    By KevinWorkman in forum JDBC & Databases
    Replies: 7
    Last Post: March 7th, 2012, 09:07 PM
  3. Setting up a reseller hosting company cost
    By Veyper in forum Totally Off Topic
    Replies: 6
    Last Post: November 9th, 2011, 02:34 PM
  4. Basic program which gets cost, adds tax, gets payment then calculates change.
    By bibboorton in forum What's Wrong With My Code?
    Replies: 6
    Last Post: August 25th, 2010, 10:31 AM
  5. Check difference between no. of stops, calculate cost
    By JavaStudent23 in forum Java Theory & Questions
    Replies: 4
    Last Post: November 17th, 2009, 03:29 AM