i want to develop a c++ program that may take a visual input like a graph and then manipulate it to find whether its a planar graph or not....i am well versed with the algorithm to do this...just want to know that how can I read the input from a GUI sort of thing where the user can actually place the vertices and draw the actual graph. Or can i integrate any existing drawing application like mspaint with my c++ code and then accept the input from there.


PLease help!!!!

You are not describing all of the details very thoroughly:

....i am well versed with the algorithm to do this...
PLease help!!!!

I am assuming that you are using visual studio
To read the input from a GUI - either write an application that is part of the GUI or operate from files: .bmp.

The easiest graphical representation to manipulate mathmatically is a bitmap. Windows will write directly to a bitmap before showing the object in an application like paint. and the Microsoft scribble tutorial is a reasonable place to start. GDI and Device Context are bith terms that take a fair bit of learning that are used for graphics in window

The tricky element can be saving bitmaps:

if you have a visual studio that has CImage this is useful as it lets you load and save bitmaps easily

If you are not able to use this look into the bitmap header structure

You do this so that you can visually check that your code is doing what is wanted.

1. get your algorithm implemented to work with a bitmap of the graph
screen shot manually cut and save to 24bit bitmap in paint.
2. sort out how you want the bitmap passed to your function
this will still be a bitmap

i just want to take the graph as a visual input rather than taking it in its conventional form like adjacency list or adjacency matrix and then convert the visual form into a conventional form. That is the problem I am seeking help for. after getting the graph in conventional form I will be able to manipulate it to comment on its planarity.

Now some of the terminology you are using is unfamiliar to me.

When you say graph:
are we talking an Excel chart
I.E. lines and points

This would be a traditional graph but my concern is that when i looked up adjacency matrices it uses graphs to refer to "labelled graphs", which appear to have directional flows and if that is the case you might need to be precise in what format is the visual image you expect.

A visual representation of a traditional grpah can be in several forms but basically you are talking about processing an image. A bitmap would be the information that is displayed via the monitor and a .svd would store the information in terms of the lines drawn.

You need to select the input that you want and identify the features that you need.

Your solution would have to be modular:

1 - capture the image
2 - identify the features in the image.
3 - convert the features into a physical description
4 - convert the physical description into desired format ie (adjacency matrix)

Now you should be sure that you can do 2-4 before wasting time implementing 1. this means taking an image in the format that you want to handle with 2 & 3.

The most basic image is the .bmp no compression and you can capture using MFC, etc. But if this is what you are using first take an image convert it inside paint to .bmp and check that 2-4 is working with a .bmp otherwise you will need a different input.

i just want to take the graph as a visual input rather than taking it in its conventional form like adjacency list or adjacency matrix and then convert the visual form into a conventional form. That is the problem I am seeking help for. after getting the graph in conventional form I will be able to manipulate it to comment on its planarity.

--edited

the graph i am talking is the one with vertices and edges and moreover its an undirected one....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.