Graph Analytics

Graphs Representations

  1. Adjacency Matrices

    • Represent a graph as an n x n square matrix M

      • n = |V|
      • Mij =1 means a link from node i to j
    • Advantages

      • Amenable to mathematical manipulation
      • Iteration over rows and columns corresponds to computations on outlinks and inlinks
    • Disadvantages

      • Lots of zeros for sparse matrices
      • Lots of wasted space
  2. Adjacency Lists

    • Advantages

      • Much more compact representation
      • Easy to compute over outlinks
    • Disadvantages

      • Much more difficult to compute over inlinks

PageRank Algorithm

Link to previous page
Given page x with inlinks $t_1, \dots, t_n$, where

  • $C(t)$ is the out-degree of $t$
  • $a$ is probability of random jump
  • $N$ is the total number of nodes in the graph

Big Graph Processing Application

Why not use Map-Reduce for Graph Parallel Algorithms?

  1. Data Dependencies

    • Map-Reduce does not efficiently express dependent data
      • User must code substantial data transformations
      • Costly data replication
  2. Iterative Algorithms

    • Map-Reduce not efficiently express iterative algorithms
      1. Only a subset of data needs computation
      2. System is not optimized for iteration

Pregel

  • Google’s Pregel for Distributed Graph Processing (mostly in-memory-only)

    • Vertex-centric computation with barrier between successive iterations (aka Super-steps)
    • Inspired by Valiant’s Bulk Synchronous Parallel model
    • Open-source version under the Apache Giraph project
    • API with flexibility to express arbitrary algorithm
    • Scalable and Fault-tolerant platform
  • PageRank in Giraph (Pregel)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    bsp_page_rank() {
    // Sum PageRank over incoming messages
    sum = 0
    forall (message in in_messages())
    sum = sum + message
    rank = ALPHA + (1-ALPHA) * sum;
    set_vertex_value(rank);

    // Send new messages to neighbors or terminate
    if (current_super_step() < MAX_STEPS) {
    nedges = num_out_edges()
    forall (neighbors in out_neighbors())
    send_message(rank / nedges);
    } else vote_to_halt();
    }
  • Computation Model for Pregel

    • Within each Super-Step, concurrent computation and communication need not be ordered in time
    • Communication through message passing
    • Each vertex:
      • Receives messages sent in the previous Super-step
      • Executes the same user-defined function
      • Modifies its value or that of its outgoing edges
      • Sends messages to other vertices (to be received in the next superstep)
      • Mutates the topology of the graph
      • Votes to halt if it has no further work to do
  • Problems: Bulk synchronous computation can be highly inefficient

GraphLab

Data Graph

A graph with arbitrary data (C++ Objects) associated with each vertex and edge

  1. Multicore Setting

    • In Memory
    • Relatively Straight Forward
      • vertex_data(vid) → data
      • edge_data(vid,vid) → data
      • neighbors(vid) → vid_list
    • Challenge: Fast lookup, low overhead
    • Solution: Dense data-structures Fixed Vdata&Edata types Immutable graph structure
  2. Cluster Setting

    • In Memory
    • Partition Graph and Cached Ghosting

Update Functions

An update function is a user defined program which when applied to a vertex transforms the data in the scope of the vertex

  • Graph-Parallel Abstraction

    • A user-defined Vertex-Program runs on each vertex
    • Graph constrains interaction along edges: Using messages or through shared state
    • Parallelism: run multiple vertex programs simultaneously

PageRank Example

  • Pregel Abstraction
    Vertex-Programs interact by sending messages

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Pregel_PageRank(i, messages):
    // Receive all the messages total = 0
    foreach(msg in messages):
    total = total + msg

    // Update the rank of this vertex
    R[i] = 0.15 + total

    // Send new messages to neighbors
    foreach(j in out_neighbors[i]):
    Send msg(R[i] * wij) to vertex j
  • GraphLab Abstraction
    Vertex-Programs directly read the neighbors state

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    GraphLab_PageRank(i):
    // Compute sum over neighbors total = 0
    foreach(j in in_neighbors(i)):
    total = total + R[j] * wji

    // Update the PageRank
    R[i] = 0.15 + total

    // Trigger neighbors to run again
    if R[i] not converged then
    foreach(j in out_neighbors(i)):
    signal vertex-program on j

Scheduler

The scheduler determines the order that vertices are updated (The process repeats until the scheduler is empty.)

  • GraphLab provides several different schedulers
    1. Round Robin: vertices are updated in a fixed order
    2. FIFO: Vertices are updated in the order they are added
    3. Priority: Vertices are updated in priority order

Consistency Model

Why we need for the consistency?

  • Importance of Consistency
    • No Consistency => Higher Throughput and Potentially Slower Convergence of ML
    • Many algorithms require strict consistency, or performs significantly better under strict consistency.
  1. Read-Write Race:
    CPU 1 reads bad PageRank estimate, as CPU 2 computes value

  2. Write-Write Race:
    Processors running adjacent update functions simultaneously modify shared data

  • GraphLab Supports Serializability
    Serializability: For a group of concurrent (parallel) transactions, e.g. executing the update functions for different vertices, the results produced by these concurrent transactions are the same as if each transaction has taken place one after another (without interleaving) in some sequential order

  1. Full Consistency
    All the nodes, suggesting that any write operation performed on any node must be immediately visible and consistent across all nodes within the system

  2. Edge Consistency
    Nodes within this circle may not immediately reflect updates made in other parts of the system; thus, they might provide slightly outdated or inconsistent data compared to the most recent writes

  • Consistency Through Scheduling:
    • Edge Consistency Model: Two vertices can be Updated simultaneously if they do not share an edge.
    • Graph Coloring: Two vertices can be assigned the same color if they do not share an edge.

Natural Graphs

  • Problem: Existing distributed graph computation systems perform poorly on Natural Graphs

  • Properties of Natural Graphs: Power-Law Degree Distribution (“Star Like” Motif)

  • Challenges

Communication Overhead

  1. Pregel Message Combiners on Fan-In
    User defined commutative associative (+) message operation

  2. Pregel Struggles with Fan-Out
    Broadcast sends many copies of the same message to the same machine

  3. GraphLab Ghosting
    Changes to master are synced to ghosts and changes to neighbors of high degree vertices creates substantial network traffic

  4. Graph Partitioning

    • Graph Partitioning Graph parallel abstractions rely

      • Minimize communication
      • Balance computation and storage
    • Power-Law Graphs are difficult to Partition

      • Power-Law graphs do not have low-cost balanced cuts
      • Traditional graph-partitioning algorithms perform poorly on Power-Law Graphs

PowerGraph

  • Minimizing Communication in PowerGraph
    • Communication is linear in the number of machines each vertex spans
    • A vertex-cut minimizes machines each vertex spans
      Percolation theory suggests that power law graphs have good vertex cuts
Theorem: For any edge-cut we can directly construct a vertex-cut which requires strictly less communication and storage
  • GAS Decomposition: distribute vertex-programs
    • Move computation to data
    • Parallelize high-degree vertices

Vertex-Cuts

  • Constructing Vertex-Cuts

    • Evenly assign edges to machines

      • Minimize machines spanned by each vertex
    • Propose three distributed approaches:

      1. Random Edge Placement
      2. Coordinated Greedy Edge Placement
      3. Oblivious Greedy Edge Placement
  1. Randomly assign edges to machines
    Randomly assign edges to machines

  2. Greedy Vertex-Cuts
    Place edges on machines which already have the vertices in that edge

    • De-randomization: greedily minimizes the expected number of machines spanned
    1. Coordinated Edge Placement:

      • Requires coordination to place each edge
      • Slower: higher quality cuts
    2. Oblivious Edge Placement:

      • Approx. greedy objective without coordination
      • Faster: lower quality cuts

Conclusion

  • Problem: Computationon Natural Graphs is challenging
    • High-degree vertices
    • Low-quality edge-cuts
  • Solution: PowerGraph System
    1. GAS Decomposition: split vertex programs
    2. Vertex-partitioning: distribute natural graphs
  • PowerGraph theoretically and experimentally outperforms existing graph-parallel systems