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.

Page 2 of 2 FirstFirst 12
Results 26 to 30 of 30

Thread: Tackling problem

  1. #26
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default Single Class graphs

    How can graphs be represented in a single class?
    I know how to make a graph with several classes such as Vertex which defines the vertex, Stack which defines the Stack, Graph which lays out the graph and includes any searching algorithm, and a Main class which creates vertexes, and edges and does the search etc. though I would really like to know if there is any simpler way to create a graph, having multiple classes is not allowed on TopCoder where I could use a graph to solve a problem.

  2. #27
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Single Class graphs

    Suggesting that a Java program - any Java program, but especially a Java program that involves graphics - be written with the use of a single class is just nonsense. Since that's how you're interpreting the problem (at least, that's how I interpret your question), either I'm not understanding what you're asking or you're misinterpreting the requirements.

    See if you can clarify the question, perhaps post it here.

  3. #28
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default Re: Tackling problem

    On topcoder there are many problems that need to be solved by graphs, and since I can only create one class for a particular problem how can I solve these problems.

  4. #29
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Tackling problem

    a) Single file or single class? Are inner classes allowed? b) There are many ways to store a Graph, some of which are completely independent of object oriented programming (such as an adjacency matrix)

  5. #30
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default Re: Tackling problem

    Interesting, I have never used inner classes, definitely something I need to learn more about.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Problem with Project Euler problem 18
    By sara_magdy in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 19th, 2013, 12:46 PM
  2. Replies: 3
    Last Post: January 5th, 2012, 01:44 AM
  3. [SOLVED] [Problem] imports javax.swing problem
    By Brollie in forum AWT / Java Swing
    Replies: 8
    Last Post: July 5th, 2009, 07:59 AM
  4. Java program for 2-D Array Maze
    By Peetah05 in forum Collections and Generics
    Replies: 11
    Last Post: May 8th, 2009, 04:30 AM