Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

[Urgent] Generating dynamic graphs @ runtime?

Thread view: 
viki.sanjeeva@gmail.com - 06 Mar 2006 09:48 GMT
Hi,
This task is very new for me and I have to do it for my client. Ok,
here is what I have to do:

1) The user will input a square matrix in a text file.
2) Java program will read this text file and will validate whether the
input matrix is square or not? If yes then continue; else error screen.
3) After successfull validation, it will create a graph based on the
values of matrix.
4) The created (generated) graph (image) will be displayed as an output
to the user on his browser.

The business logic here is the method of creating graph based on matrix
values. This method I know well on paper-pencil. But implementing the
same in Java code and generating the graph is bit new. The later part,
i.e. generating the graph is in fact the actual task.

I've developed an explained example with matrix (input) and the
generated graph (output) here:
http://www.uploadfile.info/uploads/457e277a37.jpg

In the graph, you will see objects are linked with each other via
arrows. This linking is decided on the matrix values. Most probably, I
will be having images of objets saved in my haardisk. Only Linking them
@ runtime have to be done.

Looking forward for the guideline to start implementing the task.

Thanks,

Bye,
Viki.
Simon - 06 Mar 2006 15:33 GMT
Hi,

> 1) The user will input a square matrix in a text file.
> 2) Java program will read this text file and will validate whether the
[quoted text clipped - 3 lines]
> 4) The created (generated) graph (image) will be displayed as an output
> to the user on his browser.

If I get this right, than what you have is commonly called an "adjacency matrix"
of  a graph.

> The business logic here is the method of creating graph based on matrix
> values. This method I know well on paper-pencil. But implementing the
> same in Java code and generating the graph is bit new. The later part,
> i.e. generating the graph is in fact the actual task.

Now, what do you want to do? Of course you can place your vertices on a circle
or grid or in a random fashion somewhere on the screen and draw lines with an
arrow head between adjacent vertices, but that won't give you decent results
because you will get a clutter of lines all over the screen. There is no trivial
and general way to draw a graph in a nice way and in fact there is a lot of
research going on about that. You can google for "graph drawing", but if your
project is really "urgent" I doubt you will finish that in time :-)

Of course, there are specialized methods if your graph has some known
properties, e.g. if it is bibartite or a tree, but that depends on your
application...

Cheers,
Simon
Tris Orendorff - 09 Mar 2006 18:30 GMT
> Hi,
> This task is very new for me and I have to do it for my client. Ok,
[quoted text clipped - 7 lines]
> 4) The created (generated) graph (image) will be displayed as an output
> to the user on his browser.

LIAR, LIAR pants on FIRE.

Own up.  This is homework.  No client would hire a consultant to do
something so vague as "imput a square matrix in a text file."  Those
numbers must mean something to the client.
Roedy Green - 09 Mar 2006 18:34 GMT
>1) The user will input a square matrix in a text file.
>2) Java program will read this text file and will validate whether the
>input matrix is square or not? If yes then continue; else error screen.

nobody on earth talks that way except CS profs near retirement.  See
http://mindprod.com/jgloss/homework.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Nigel Wade - 10 Mar 2006 11:23 GMT
> Hi,
> This task is very new for me and I have to do it for my client. Ok,
[quoted text clipped - 16 lines]
> generated graph (output) here:
> http://www.uploadfile.info/uploads/457e277a37.jpg

You created that? It wasn't part of the problem sheet handout you were given?

> In the graph, you will see objects are linked with each other via
> arrows. This linking is decided on the matrix values. Most probably, I
[quoted text clipped - 7 lines]
> Bye,
> Viki.

http://java.sun.com/docs/books/tutorial/2d/index.html

Read and enjoy. Learning for yourself will prepare you better for your future
problem classes.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.