Show Menu
Cheatography

Data Structure(Graph)2 Cheat Sheet (DRAFT) by

Abstraction of a graph data structure.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Data Struct­ure­(Graph)

Graph's Defini­tion:
Graphs are non-linear data structures made up of two major components
Graph's Compon­ents:
1.Vert­ices:
 
2.Edges:
 
are entities in a graph
 
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:
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
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).
 

figure(1)

figure(2)