Cheatography
https://cheatography.com
Abstraction of Graph data structure
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Definition of Graph
Graphs are non-linear data structures made up of two major components: |
Vertices: are entities in a graph |
Edges: 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: |
Based on Direction: |
Based on Direction: |
Undirected Graphs: edge(x,y) == edge(y,x) |
|
Directed Graphs: edge(x,y) != edge(y,x) |
|
|
|
Data Structure(Graph)
Graphs are non-linear data structures made up of two major components |
Vertices: are entities in a graph |
Edges: represent the relationship between the vertices in the graph |
it's goal: |
Used to visualize organized data and to represent places and the distance between them. |
|
Types of Graphs: |
Based on Direction: |
Undirected Graphs: edge(x,y) == edge(y,x) |
|
Directed Graphs: edge(x,y) != edge(y,x) |
Based on Weights: |
Weighted Graphs: every edge has a value |
|
Unweighted Graphs: does not have a value associated with every edge. |
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). |
|
|
|