Choose an appropriate ADT to represent a digraph G VE Expla

Choose an appropriate ADT to represent a di-graph G = (V,E).
Explain with an example.
Add two functions (pseudocode) to calculate the inDegree and outDegree of each node.

Please follow all instructions. I will rate complete answers! Thank you!

Solution

Abstract Data Type for Di-Graph:

Accesssing graph G=(V,E)

nofVertices()
This function returns the number of vertices V

nofEdges()

This function returns the number of edges E

Vertices()
This function returns an iterator of vertices V

Edges()
This function returns an iterator of edges E

Accessing the graph G=(V,E)

inDegree(V)
This function returns the number of directed edges that comes towards vertex V.

outDegree(V)
This function returns the number of directed edges that goes out from V.

AdjVertices(V)
This function returns the vertices adjacent to V that comes toward the edges.

destination(e)
This function returns the destination vertex of edge e, only if e is directed.

isDirected(e)
This function returns true if e is directed, returns false otherwise

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

function to calculate out degree :

function to calculate indegree :

Choose an appropriate ADT to represent a di-graph G = (V,E). Explain with an example. Add two functions (pseudocode) to calculate the inDegree and outDegree of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site