This is a draft cheat sheet. It is a work in progress and is not finished yet.
Data Structure(Graph)
Graph's Definition: |
Graphs are non-linear data structures made up of two major components |
Graph's Components: |
1.Vertices: |
|
2.Edges: |
|
are entities in a graph |
|
represent the relationship between the vertices in the graph |
Graph's Goal: |
Used to visualize organized data and to represent places and the distance between them. |
Types of Graphs: |
1.Based on Direction: |
Undirected Graphs: edge(x,y) == edge(y,x) |
Directed Graphs: edge(x,y) != edge(y,x) |
|
2.Based on Weights: |
Weighted Graphs: every edge has a value |
Unweighted Graphs: does not have a value associated with every edge. |
|
3.Special Graphs: |
Trees |
Directed Acyclic Graphs |
Complete Graphs |
Implementation: |
Graphs are easily built out of lists and dictionaries as in figure(1). |
|
This graph has six nodes (A-F) and eight edges as in figure(2). |
|