Graphs in C

Graph is a data structure consisting of a finite set of vertices and edges joining any two vertices.

Important terms 


Undirected graph

An edge is a 2 way connection.

In this graph , each edge(u,v) is an unordered pair of vertices. [edge(u,v) is same as edge(v,u)]

Directed graph


An edge is a 1 way connection.

In this graph , each edge(u,v) is an ordered pair of vertices. i.e [edge(u,v) is not same as edge(v,u)]

Degree of vertex

In an undirected graph , number of edges connected to a vertex is called its degree.

In degree

In a directed graph , number of edges coming into the vertex is called its in-degree.

Out degree

In a directed graph , number of edges going out from the vertex is called its out-degree.


        

More


Representation of graph using adjacency matrix


Depth First Search (DFS)

Breadth First Search (BFS)

Prim's Algorithm

Djisktra's algorithm

No comments:

Post a Comment