
- Graph Theory - Home
- Graph Theory - Introduction
- Graph Theory - History
- Graph Theory - Fundamentals
- Graph Theory - Applications
- Types of Graphs
- Graph Theory - Types of Graphs
- Graph Theory - Simple Graphs
- Graph Theory - Multi-graphs
- Graph Theory - Directed Graphs
- Graph Theory - Weighted Graphs
- Graph Theory - Bipartite Graphs
- Graph Theory - Complete Graphs
- Graph Theory - Subgraphs
- Graph Theory - Trees
- Graph Theory - Forests
- Graph Theory - Planar Graphs
- Graph Theory - Hypergraphs
- Graph Theory - Infinite Graphs
- Graph Theory - Random Graphs
- Graph Representation
- Graph Theory - Graph Representation
- Graph Theory - Adjacency Matrix
- Graph Theory - Adjacency List
- Graph Theory - Incidence Matrix
- Graph Theory - Edge List
- Graph Theory - Compact Representation
- Graph Theory - Incidence Structure
- Graph Theory - Matrix-Tree Theorem
- Graph Properties
- Graph Theory - Basic Properties
- Graph Theory - Coverings
- Graph Theory - Matchings
- Graph Theory - Independent Sets
- Graph Theory - Traversability
- Graph Theory Connectivity
- Graph Theory - Connectivity
- Graph Theory - Vertex Connectivity
- Graph Theory - Edge Connectivity
- Graph Theory - k-Connected Graphs
- Graph Theory - 2-Vertex-Connected Graphs
- Graph Theory - 2-Edge-Connected Graphs
- Graph Theory - Strongly Connected Graphs
- Graph Theory - Weakly Connected Graphs
- Graph Theory - Connectivity in Planar Graphs
- Graph Theory - Connectivity in Dynamic Graphs
- Special Graphs
- Graph Theory - Regular Graphs
- Graph Theory - Complete Bipartite Graphs
- Graph Theory - Chordal Graphs
- Graph Theory - Line Graphs
- Graph Theory - Complement Graphs
- Graph Theory - Graph Products
- Graph Theory - Petersen Graph
- Graph Theory - Cayley Graphs
- Graph Theory - De Bruijn Graphs
- Graph Algorithms
- Graph Theory - Graph Algorithms
- Graph Theory - Breadth-First Search
- Graph Theory - Depth-First Search (DFS)
- Graph Theory - Dijkstra's Algorithm
- Graph Theory - Bellman-Ford Algorithm
- Graph Theory - Floyd-Warshall Algorithm
- Graph Theory - Johnson's Algorithm
- Graph Theory - A* Search Algorithm
- Graph Theory - Kruskal's Algorithm
- Graph Theory - Prim's Algorithm
- Graph Theory - Borůvka's Algorithm
- Graph Theory - Ford-Fulkerson Algorithm
- Graph Theory - Edmonds-Karp Algorithm
- Graph Theory - Push-Relabel Algorithm
- Graph Theory - Dinic's Algorithm
- Graph Theory - Hopcroft-Karp Algorithm
- Graph Theory - Tarjan's Algorithm
- Graph Theory - Kosaraju's Algorithm
- Graph Theory - Karger's Algorithm
- Graph Coloring
- Graph Theory - Coloring
- Graph Theory - Edge Coloring
- Graph Theory - Total Coloring
- Graph Theory - Greedy Coloring
- Graph Theory - Four Color Theorem
- Graph Theory - Coloring Bipartite Graphs
- Graph Theory - List Coloring
- Advanced Topics of Graph Theory
- Graph Theory - Chromatic Number
- Graph Theory - Chromatic Polynomial
- Graph Theory - Graph Labeling
- Graph Theory - Planarity & Kuratowski's Theorem
- Graph Theory - Planarity Testing Algorithms
- Graph Theory - Graph Embedding
- Graph Theory - Graph Minors
- Graph Theory - Isomorphism
- Spectral Graph Theory
- Graph Theory - Graph Laplacians
- Graph Theory - Cheeger's Inequality
- Graph Theory - Graph Clustering
- Graph Theory - Graph Partitioning
- Graph Theory - Tree Decomposition
- Graph Theory - Treewidth
- Graph Theory - Branchwidth
- Graph Theory - Graph Drawings
- Graph Theory - Force-Directed Methods
- Graph Theory - Layered Graph Drawing
- Graph Theory - Orthogonal Graph Drawing
- Graph Theory - Examples
- Computational Complexity of Graph
- Graph Theory - Time Complexity
- Graph Theory - Space Complexity
- Graph Theory - NP-Complete Problems
- Graph Theory - Approximation Algorithms
- Graph Theory - Parallel & Distributed Algorithms
- Graph Theory - Algorithm Optimization
- Graphs in Computer Science
- Graph Theory - Data Structures for Graphs
- Graph Theory - Graph Implementations
- Graph Theory - Graph Databases
- Graph Theory - Query Languages
- Graph Algorithms in Machine Learning
- Graph Neural Networks
- Graph Theory - Link Prediction
- Graph-Based Clustering
- Graph Theory - PageRank Algorithm
- Graph Theory - HITS Algorithm
- Graph Theory - Social Network Analysis
- Graph Theory - Centrality Measures
- Graph Theory - Community Detection
- Graph Theory - Influence Maximization
- Graph Theory - Graph Compression
- Graph Theory Real-World Applications
- Graph Theory - Network Routing
- Graph Theory - Traffic Flow
- Graph Theory - Web Crawling Data Structures
- Graph Theory - Computer Vision
- Graph Theory - Recommendation Systems
- Graph Theory - Biological Networks
- Graph Theory - Social Networks
- Graph Theory - Smart Grids
- Graph Theory - Telecommunications
- Graph Theory - Knowledge Graphs
- Graph Theory - Game Theory
- Graph Theory - Urban Planning
- Graph Theory Useful Resources
- Graph Theory - Quick Guide
- Graph Theory - Useful Resources
- Graph Theory - Discussion
Graph Theory - Compact Representation
Compact Representation
Compact Representation in the context of graphs refers to methods of representing graph data in a way that minimizes space usage while retaining all necessary information about the graph. This is useful for large graphs where traditional representations like adjacency matrices or lists might be too memory-intensive.
Some of the important characteristics of compact representation are as follows −
- Efficient Storage: Saves memory by avoiding duplicate information and storing only what's needed. It uses methods like run-length encoding, adjacency list compression, or compact data structures to achieve this.
- Scalability: Handles larger graphs well, allowing us to work with big networks without using too much memory.
- Maintains Graph Properties: Keeps all the important properties and relationships in the graph intact, so we can still perform operations and run algorithms effectively.
Types of Compact Representations
There are different ways to represent graphs in a compact form, and each method is suited for certain types of graphs and uses. Below are some commonly used compact representations −
Adjacency Array
An adjacency array, also called Compressed Sparse Row (CSR) or Compressed Sparse Column (CSC), is a compact way to store the adjacency list of a graph. This method uses three arrays: the vertex array, the edge array, and an optional value array for weighted graphs.
The adjacency array consists of the following components −
- Vertex Array: Stores the indices in the edge array where the edges of each vertex start.
- Edge Array: Stores the adjacent vertices for each vertex.
- Value Array (optional): Stores the weights of the edges, if applicable.
Adjacency Array Calculation
Consider a graph with vertices A, B, and C, and edges A-B, A-C, B-C. Here's how the adjacency array representation is calculated −
Step 1: Assign Indexes to Vertices:
- A = 0
- B = 1
- C = 2
Step 2: List the Edges Using Vertex Indexes:
- A-B: (0, 1)
- A-C: (0, 2)
- B-C: (1, 2)
Step 3: Create the Vertex Array:
This array keeps track of where each vertex's edges start in the edge array. For each vertex, count the total number of edges and note the starting index for its edges in the edge array.
- Vertex A (0): A has 2 edges (A-B and A-C).
- Vertex B (1): B has 1 edge (B-C).
- Vertex C (2): C has no outgoing edges listed.
The Vertex Array is constructed as follows:
- Start of A's edges: 0
- Start of B's edges: 2 (since A has 2 edges)
- Start of C's edges: 3 (since B has 1 edge and starts after A's edges)
Thus, the Vertex Array is: [0, 2, 3].
Step 4: Create the Edge Array:
This array lists the vertices connected by each vertex in order.
- For vertex A (0): the edges are to B (1) and C (2).
- For vertex B (1): the edge is to C (2).
Thus, the Edge Array is: [1, 2, 2].
Therefore, the adjacency array representation for the given graph is −
Vertex Array: [0, 2, 3] Edge Array: [1, 2, 2]
The Vertex Array [0, 2, 3] indicates the starting indices in the Edge Array for the edges of vertices A, B, and C, respectively.
The Edge Array [1, 2, 2] lists the destination vertices for each edge in the graph.
Edge Array
An edge array, also known as an edge list, is a compact way to represent the edges of a graph. Each edge is represented as a pair of vertices, and for weighted graphs, an additional value can be included to represent the edge weight.
The edge array is a simple list of pairs (or tuples) representing the edges −
- Edges: Each edge is represented as a pair of vertices (u, v).
- Weights (optional): Each edge may include a weight value.
Consider a graph with vertices A, B, and C, and edges A-B, A-C, B-C. The edge array representation would be −
Edge Array: [(A, B), (A, C), (B, C)]
Compressed Graph Formats
Compressed graph formats use advanced techniques to reduce the amount of storage space needed for representing graphs. These methods are useful when working with very large graphs, such as those found in web pages or social networks, where traditional storage methods might be inefficient.
Two examples of compressed graph formats are k2-trees and WebGraph frameworks.
k2-trees
The k2-trees are a compact data structure used to represent sparse binary matrices. They are effective for representing adjacency matrices of large, sparse graphs.
A k2-tree works by recursively breaking down the adjacency matrix of a graph into smaller blocks, specifically into kxk submatrices. This process is repeated hierarchically, with each level of the tree focusing on progressively smaller and more manageable submatrices.
Here is an example of how a k2-tree can represent a simple graph adjacency matrix −
[10, 00, 10, 01, 00, 00, 00, 01] K2-Tree Structure: Top Left: Top Left: 1 Top Right: 0 Bottom Left: 0 Bottom Right: 0 Top Right: Top Left: 1 Top Right: 0 Bottom Left: 0 Bottom Right: 0 Bottom Left: 0 Bottom Right: 1
WebGraph Framework
The WebGraph Framework is a set of algorithms and data structures specifically designed to compress web graphs. These web graphs, such as the structure of links between web pages, can be enormous in size.
The WebGraph framework achieves high compression ratios by taking advantage of patterns and redundancies found in the structure of web graphs.
By focusing on common patterns that appear in web graphs, such as frequently linked pages or clusters of pages, the framework significantly reduces the amount of storage space required. This makes it possible to efficiently store and process large web graphs, even when they contain millions or billions of pages and links.
Adjacency List Compression
Adjacency list compression techniques reduce the space required to store adjacency lists by using delta encoding, variable-length coding, and other compression methods.
- Delta encoding stores the differences between consecutive vertices rather than the vertices themselves. This is effective when the vertex IDs are ordered.
- Variable-length coding assigns shorter codes to more frequent items, reducing the overall space required for storage.
Applications of Compact Representations
Compact graph representations are used in various applications where space efficiency and fast access to graph data are important. Some of the key applications are as follows −
- Web Graphs: The World Wide Web can be represented as a large graph, with web pages as vertices and hyperlinks as edges. Compact representations allow efficient storage and analysis of web graphs.
- Social Networks: Social networks, with users as vertices and relationships as edges, benefit from compact representations to handle large amounts of data.
- Biological Networks: Biological networks, such as protein-protein interaction networks, require efficient storage to facilitate large-scale analyses.
- Geographical Information Systems (GIS): GIS applications involve large graphs representing geographical features and their relationships. Compact representations improve storage efficiency and query performance.