A graph is a data structure that is a many-to-many relationship between data elements, plus an abstract data type consisting of a set of basic operations.
A data Object V:V is a collection of data elements that have the same characteristics, called vertex sets.
Creategraph (&G,V,VR);
Initial condition: V is the vertex set of the graph, and VR is the set of arcs in the graph.
Operation Result: construct graph G by definition of V and VR
Destroygraph (&G);
Initial condition: Figure G exists
Operation Result: Destroy Figure g
Locatevex (G,u);
Initial condition: Fig g exists, the vertex in U one G has the same characteristic
Operation Result: If there is a vertex u in G, then return the vertex to the position in the diagram; otherwise, other information will be returned.
Getvex (G,V);
Initial condition: The figure G exists, V is a vertex in G
Action Result: Returns the value of V.
Putvex (&g,v,value);
Initial condition: The figure G exists, V is a vertex in G
Operation Result: value of V Assignment
Firstadjvex (G,V);
Initial condition: The figure G exists, V is a vertex in G
Action Result: Returns the first contiguous vertex of V. If the vertex does not have an adjacent vertex in G, it returns "NULL"
Nextadjvex (G,V,W);
Initial conditions: The existence of Fig G, V is a vertex in G, W is the adjacent vertex of v.
Action Result: Returns the next contiguous vertex of V (relative to W). If W is the last contiguous point of V, return "null"
Insertvex (&G,V);
Initial condition: The existence of Fig G, V and vertex in the diagram have the same characteristics
Operation Result: Add a new vertex v in Fig g
Deletevex (&G,V);
Initial condition: The figure G exists, V is a vertex in G
Action Result: delete vertex v in G and its associated arc
INSERTACR (&G,V,W);
Initial conditions: Existence of fig G, V and W are two vertices in g
Operation Result: Add Arc <v,w> in G, if G is non direction, add symmetrical arc <w,v>
Deletearc (&G,V,W);
Initial conditions: Existence of fig G, V and W are two vertices in g
Operation Result: The arc <v,w> is removed in G, and if G is not, the symmetrical arc is also removed <w,v>
Dfstraverser (G,v,visit ());
Initial condition: The existence of Fig G, V is a vertex in G, visit is the application function of vertex
Operation Result: from Vertex v to depth first traverse graph G, and call function visit for each vertex. Once visit () fails, the operation fails.
Bfstraverse (G,v,visit ());
Initial condition: The existence of Fig G, V is a vertex in G, visit is the application function of vertex
Operation Result: from Vertex v breadth first traversal graph G, and call function visit for each vertex. Once visit () fails, the operation fails.