🎉 One-stop destination for all your technical interview Preparation 🎉
Directed: If there is an edge from u to v, then there is no edge from v to u.
Undirected: If there is an edge from u to v, then there is an edge from v to u.
Vertices/Nodes (N): Vertices are the fundamental units of the graph. Sometimes, vertices are also known as vertex or nodes. Every node/vertex can be labeled or unlabelled.
Edges (E): Edges are drawn or used to connect two nodes of the graph. It can be ordered pair of nodes in a directed graph. Edges can connect any two nodes in any possible way. There are no rules. Sometimes, edges are also known as arcs. Every edge can be labeled/unlabelled.
Path: Contains a lot of nodes and each of them are reachable. A node cannot appear twice in path.
Degree in undirected graph: Number of edges connected to a node.
Degree in directed graph:
Edge weight: Weight of an edge is the value associated with it. It can be used to represent the cost of the edge. By default we can assume weight of an edge as 1.