Show Menu
Cheatography

Data Structure(Graph) Cheat Sheet (DRAFT) by

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 compon­ents:
Vertices: are entities in a graph
Edges: represent the relati­onship 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 Struct­ure­(Graph)

Graphs are non-linear data structures made up of two major components
Vertices: are entities in a graph
Edges: represent the relati­onship 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
Implem­ent­ation:
 
Graphs are easily built out of lists and dictio­naries as in figure(1).
 
This graph has six nodes (A-F) and eight edges as in figure(2).