How to run the program
In order to compile and run the code, just create an MFC project in
Microsoft Visual C++ and include all the files on the code page.
While running the program, clicking on the screen will produce a vertex
in vertex mode. You can switch between vertex mode and edge mode by
selecting the option in the menu. In edge mode, you can create
edges by clicking on one vertex and dragging to another. Right
clicking on a vertex will allow you to rename or delete it. Right
clicking on an edge wait will allow you to change it or delete the
edge. Selecting menu options will allow you to add vertices and edges
witgh dialog boxes, switch between weighted and nonweighted edges,
switch between directed and undirected edges, and run and algorithm.
In order to create a graph from a file, you must follow this
exactly:
1. Make "0" the first character. This is to let the program know it's
a user created file and not a program created file.
2. Hit Enter after every character. The file should have only one
character lines.
3. Write the number of vertices and the label of each vertex.
4. Write a "0" for directed edges or a "1" for directed edges.
5. Write two labels and a weight for each edge you want to have.
6. Make "$" the last character, so the program knows you're done.
See an example of a file on the code page.
To add an algorithm, you must add a menu option for it in the resources
file, and map it to a function in the document. Have the function in
the document call the dialog box exactly the way the others do.
Make a boolean flag which is set in the code when the user clicks run.
In OnDraw, make an if statement for the boolean flag, and if it's set,
run the code for the algorithm.
Home