-
Notifications
You must be signed in to change notification settings - Fork 0
Graphs
Madhav Anand edited this page Nov 2, 2021
·
3 revisions
- Collection of
vertices(circles) andedges(lines) connected with each other. - Vertices have
value(name) like 0, 1 etc. Edges can beweightedorunweightedlike 10, 20 etc. - Relationship can be like
cities,computers(vertices) connected withroad,wire(edges). - Questions will be like
ifPathExistallPossiblePaths-
smallest path(in terms of edges, which less stops)- BFS -
smallest path(in terms of weights, which less stops)- Dijkstra -
Minimum Spanning Tree- Find the number of wires to connect computers.Prims & Kruskal -
Directed GraphFile depends upon other file. Tell the order to compile. Topological Sort
- Representation in two ways -
Adjacency MatrixandAdjacency List.
- 2D Array of VxV.
- If Edge exists from V to V then
weight/1otherwise0 - Can only be formed, if
V < 10,000