helix.graph.algo.c3part.compressor
Class AbstractCompressor

java.lang.Object
  extended by helix.graph.algo.c3part.compressor.AbstractCompressor
All Implemented Interfaces:
GraphCompressor
Direct Known Subclasses:
AbstractMultiCompressor

public abstract class AbstractCompressor
extends Object
implements GraphCompressor

A basic skeleton for compressors with default implementations.
You mostly have to implement the two methods:
subsume(v, u) : tells if v S u
restore(u) : restore the compressed vertex u to its initial state


Constructor Summary
AbstractCompressor()
           
 
Method Summary
 void compress(Graph graph)
          compress graph
 void compress(Graph graph, Logger logger)
          same as compress with logging compression rate
 void compressVertex(Vertex v, Vertex root, Graph graph)
          compress single vertex v on root vertex root
 void expand(Graph graph)
          expand graph to its uncompressed state
 void flatten(Graph graph)
          expand graph without edges
 Iterable<Vertex> getAliases(Vertex v)
          get aliases of root vertex
 Iterable<Vertex> getNeighbors(Vertex v)
          return neighbors of vertex v, including aliases of neighbors
 String getParamInfo()
          get optional parameters info
 Vertex getRoot(Vertex v)
          get root of a compressed vertex
 Iterable<Vertex> getVertices(Graph graph)
          return all vertices in compressed graph.
 boolean isAlias(Vertex v)
          tell if vertex is an Alias (i.e.
 boolean isNormal(Vertex v)
          tell if vertex is a normal vertex.
 boolean isRoot(Vertex v)
          tell if vertex is a root vertex.
 int nbVertices(Graph graph)
          return the number of vertices in graph (including compressed one)
 GSet<Vertex> retrieveSet()
          retrieve a copy of previously stored set optional operation
 void storeSet(GSet<Vertex> set)
          temporarily stores a copy of set of vertices optional operation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface helix.graph.algo.c3part.compressor.GraphCompressor
expandVertex, subsumes
 

Constructor Detail

AbstractCompressor

public AbstractCompressor()
Method Detail

compressVertex

public void compressVertex(Vertex v,
                           Vertex root,
                           Graph graph)
compress single vertex v on root vertex root

Specified by:
compressVertex in interface GraphCompressor

compress

public void compress(Graph graph)
compress graph

Specified by:
compress in interface GraphCompressor

compress

public void compress(Graph graph,
                     Logger logger)
same as compress with logging compression rate

Specified by:
compress in interface GraphCompressor

expand

public void expand(Graph graph)
expand graph to its uncompressed state

Specified by:
expand in interface GraphCompressor

getVertices

public Iterable<Vertex> getVertices(Graph graph)
return all vertices in compressed graph. for efficiency, vertices should be returned in an ordered way : any root vertex should be immediately followed by it aliases.

Specified by:
getVertices in interface GraphCompressor

nbVertices

public int nbVertices(Graph graph)
return the number of vertices in graph (including compressed one)

Specified by:
nbVertices in interface GraphCompressor

getNeighbors

public Iterable<Vertex> getNeighbors(Vertex v)
return neighbors of vertex v, including aliases of neighbors

Specified by:
getNeighbors in interface GraphCompressor

isAlias

public boolean isAlias(Vertex v)
tell if vertex is an Alias (i.e. compressed) vertex.

Specified by:
isAlias in interface GraphCompressor

isRoot

public boolean isRoot(Vertex v)
tell if vertex is a root vertex. i.e. if it owns at least one alias

Specified by:
isRoot in interface GraphCompressor

isNormal

public boolean isNormal(Vertex v)
tell if vertex is a normal vertex. i.e. neither root nor alias

Specified by:
isNormal in interface GraphCompressor

getRoot

public Vertex getRoot(Vertex v)
get root of a compressed vertex

Specified by:
getRoot in interface GraphCompressor

getAliases

public Iterable<Vertex> getAliases(Vertex v)
get aliases of root vertex

Specified by:
getAliases in interface GraphCompressor

flatten

public void flatten(Graph graph)
expand graph without edges

Specified by:
flatten in interface GraphCompressor

storeSet

public void storeSet(GSet<Vertex> set)
temporarily stores a copy of set of vertices optional operation

Specified by:
storeSet in interface GraphCompressor

retrieveSet

public GSet<Vertex> retrieveSet()
retrieve a copy of previously stored set optional operation

Specified by:
retrieveSet in interface GraphCompressor

getParamInfo

public String getParamInfo()
get optional parameters info

Specified by:
getParamInfo in interface GraphCompressor