Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
© 2026 CheatGrid™. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Graphs Cheat Sheet

Graphs Cheat Sheet

Back to Mathematics and Algorithms
Updated 2026-04-29
Next Topic: Hash Tables and Hash Maps Cheat Sheet

Graphs are fundamental data structures modeling relationships between entities — consisting of vertices (nodes) connected by edges. They appear throughout computer science, from social networks and routing algorithms to dependency analysis and fraud detection. Graphs can be directed or undirected, weighted or unweighted, cyclic or acyclic — each variant enabling different algorithmic approaches. A key insight: the choice between adjacency list and adjacency matrix representation profoundly impacts both memory usage and traversal speed — sparse graphs favor lists (O(V + E) space), while dense graphs benefit from matrices' O(1) edge lookups at the cost of O(V^2) space. Modern graph data science extends classical algorithms with centrality measures, community detection, and node embeddings that unlock insights in large-scale networks.


What This Cheat Sheet Covers

This topic spans 17 focused tables and 95 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Graph RepresentationsTable 2: Graph Types and PropertiesTable 3: Graph Properties and MetricsTable 4: Graph Traversal AlgorithmsTable 5: Shortest Path AlgorithmsTable 6: Minimum Spanning Tree (MST) AlgorithmsTable 7: Topological Sorting AlgorithmsTable 8: Strongly Connected Components (SCC) AlgorithmsTable 9: Cycle Detection AlgorithmsTable 10: Graph Connectivity AlgorithmsTable 11: Bipartite Graph AlgorithmsTable 12: Network Flow AlgorithmsTable 13: Special Graph ProblemsTable 14: Advanced Graph ConceptsTable 15: Graph Centrality AlgorithmsTable 16: Community Detection AlgorithmsTable 17: Node Embeddings and Link Prediction

Table 1: Graph Representations

TypeExampleDescription
Adjacency List
graph = {0: [1, 2], 1: [2], 2: [0, 3], 3: [3]}
• Dictionary or array mapping each vertex to its neighbor list
• space-efficient for sparse graphs — O(V + E) space, ideal for traversal algorithms.
Adjacency Matrix
matrix = [[0, 1, 1, 0],
[0, 0, 1, 0],
[1, 0, 0, 1],
[0, 0, 0, 1]]
• 2D array where matrix[i][j] = 1 if edge i \to j exists
• O(V^2) space, O(1) edge lookup, best for dense graphs or matrix operations.
Edge List
edges = [(0,1), (0,2), (1,2), (2,3)]
• Simple list of edge tuples (or triples with weights)
• O(E) space, useful for sorting edges (Kruskal's MST) but slow for neighbor queries.

More in Mathematics and Algorithms

  • Graph Theory Cheat Sheet
  • Hash Tables and Hash Maps Cheat Sheet
  • Abstract Algebra Essentials Cheat Sheet
  • Complex Analysis Cheat Sheet
  • Graph Algorithms Shortest Paths and Network Search Cheat Sheet
  • Number Theory Cheat Sheet
View all 57 topics in Mathematics and Algorithms