1.node and edges wala hota hai graph

Untitled

2.types

1.undirected

2.directed

3.node → entity hai to store data

4.edge → connecting nodes

5.degree: degree(v) → v node se kitne connection hai

  1. indegree
  2. outdegree

6.weighted graph

Untitled

7.Graph

|→adjacency matrix

|→adjacency list

1.adjacency matrlix:

Untitled

2.adjancecy list

Untitled

map<int,list<int>>

8.code

class graph{

public: 
			unordered_map<int,list<int>>adj;
			void addEdge(int u, inty, bool direction){

			adj[u].push_back(v);
			if(direction == 0){
adj[v].push_back(u)

}

}
}