Graph Coloring

#include<iostream.h>
#include<fstream.h>
#include<string.h>

class edge;
class nodes{
char *name;
int info;
int color;
edge *head;
edge *tail;
nodes *next;
nodes *prev;
public:
nodes(char n[]);
static void ins_node(char n[]);
static nodes find_node(char n[]);
bool ins_edge(nodes adj);
void del_edge(nodes adj);
static edge find_edge(nodes nod1,nodes nod2);
void del();
nodes find_adj(char n[]);
}*start,*availn;
//void nodes::ins_node(char n[]);
class edge
{
nodes *start,*end;
edge *next,*prev;
public:
static edge find_egde(nodes nod1,nodes nod2);
static bool del_edge(nodes nod1,nodes nod2);
static bool ins_edge(nodes nod1,nodes nod2);
};
void traverse();
void del_all();
void menu(int i);
//static bool edge::del_edge(nodes nod1,nodes nod2);
void main()
{
start='';
availn='';
int loop=1;
while(loop)
         {
cout<<"Press 1 to construct the graph\n"
//            cout<<"press 2 to reconstruct the graph\n"
cout<<"press 3 to ins a node\n"
cout<<"press 4 to del an node\n"
cout<<"press 5 to ins an edge\n"
cout<<"press 6 to del an edge\n"
cout<<"press 7 to edit a node\n"
cout<<"press 8 to traverse\n"
cout<<"Else press 0 to quit\n";
cin>>loop;
menu(loop);
           }
}
void menu(int i)
{
if(i==1)
      {
del_all();
cout<<"how many node to ins?";
int num;
cin>>num;
char name[100];
for(int j=0;j<num;j++)
              {
cout<<"giv name of node";
cin>>name;
nodes.ins_node(name);
               }
       }
}

2 thoughts on “Graph Coloring

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s