Graph
Post By kanra
Blogs Graph
This is an ADT of directed graph using Adjacency List implementation.
In other word, this ADT is using Array of Linear Linked List (LLL) as its data structure.
An array of vertices where each element has a vertex with a head pointer to a LLL of edges for their adjacent vertices).

 

 

Vertex ADT

 

template
class vertex<class Type>
{
    public:
	    vertex();
	    vertex(const Type &);
	    vertex(const Type *data);

	    void set_data(const Type & new_data);

	    void set_data(const Type *new_data);
	
	    void delete_data();

	    void connect_head(node_p<vertex<Type>> *head);

	    node_p<vertex<Type>> *& get_head();
	
	    void reset_head();

	    void display();

	    bool is_data_match(const Type &);

    private:
	
        Type *data;
    
        // A LLL that each node's pointer points to a vertex
        node_p<vertex> *head;	
};

 



AUTHOR : kanra
EMAIL : karawakara@gmail.com
Working on Networking, Web Development, Software Development, Server-side deployment. Having fun on doing experiments on new technologies.