helix.graph.algo.c3part
Class C3PartUtil

java.lang.Object
  extended by helix.graph.algo.c3part.C3PartUtil

public class C3PartUtil
extends Object

Utilities for C3Part algorithms Note: for readability, we use uppercase characters for parameters holding nodes of the multigraph (e.g. V, U) and lowercase characters for nodes of the datagraph (e.g. v, u). A node of the multigraph is called a 'multinode' and a node of the datagraph is called a 'datanode'. Note: some part of the code (marked as @concurrent) are specific to the concurrent version. you may ignore them for the non-concurrent version


Field Summary
static String Nodes
          the tuple associated to a node of the multigraph
static String Optimizer
          the local optimizer : experimental section
 
Method Summary
static void addAlias(Vertex V, Vertex Alias)
          add alias into multinode V (also set root of V to Root)
static void addNode(Vertex V, Vertex v)
          add datanode v in tuples of a multinode V
static void addSon(Vertex V, Vertex Son)
          add son into multinode V
static int countStars(Vertex V)
          count number of stars in multinode V
static RVertexSet getAliases(Vertex V)
          get multinodes aliases of a multinode V (V is called a root multinode) and create an empty RVertexSet if it does not exist.
static Vertex getLastNode(Vertex V)
          get last datanode of a multinode V Last(V) = vk / Nodes(V) = (v1, ..., vk)
static Vertex getMultinode(Vertex v)
          get the multinode V such that Nodes(V) = (v) this is used in multigraph initialisation to retrieve the multinode V that has been build from v.
static RVertexList getNodes(Vertex V)
          get datanodes tuple of a multinode V (i.e.
static ColorOptimizer getOptimizer(Registry r)
          get the color optimizer attached to the registry
static RColorSet getPseudoColors(Vertex V, Vertex U)
          compute pseudo colors of edge (U, V) using the datagraph (i.e not relying on an actual edge).
static Vertex getRoot(Vertex V)
          get root of multinode V return null if V is not an Alias Node
static Vertex getSon(Vertex V, Vertex terminal)
          get the multinode son of a multinode V, that ends with specified terminals.
static RVertexSet getSons(Vertex V)
          get multinodes sons of a multinode V and create an empty RVertexSet if it does not exist.
static RColorSet getTrueColors(Vertex V, Vertex U)
          compute true colors of edge (U, V) using the datagraph (i.e not relying on an actual edge).
static boolean hasAlias(Vertex V)
          tell if multinode V has aliases i.e.
static boolean hasRoot(Vertex V)
          tell if multinode V has a root node i.e.
static boolean hasSon(Vertex V)
          tell if multinode V has son(s)
static boolean isCoreNode(Vertex V)
          tell if multinode V has no star.
static boolean isFullStar(Vertex V)
          tell if multinode V is a full star (also called the 'black' star) i.e if all of its datanodes are stars
static boolean isPartialStar(Vertex V)
          tell if multinode V is a partial star on at least one color but not a full star
static boolean isStar(Vertex v)
          tell if datanode v is a star (*) note: there are different ways to detect '*' the quickest for now is that '*' is (should be) the only colorless datanode
static void removeAlias(Vertex V, Vertex Alias)
          remove alias from multinode
static void removeAliases(Iterable<Vertex> iterable)
           
static void removeAliases(Vertex V)
          remove all aliases from multinode V (also remove root from Aliases(V))
static void removeMultinode(Vertex v)
          remove multinode V from datanode v
static void removeRoot(Iterable<Vertex> iterable)
           
static void removeRoot(Vertex V)
          remove root from multinode V (and remove V from its root aliases)
static void removeSons(Iterable<Vertex> iterable)
           
static void removeSons(Vertex V)
          remove all sons from multinode V
static void setMultinode(Vertex v, Vertex V)
          record in datanode v the multinode V such that Nodes(V) = (v).
static void setOptimizer(Registry r, ColorOptimizer optimizer)
          set the color optimizer into the registry
static void setRoot(Vertex V, Vertex Root)
          record Root multinode in multinode V (also add V in Aliases(Root))
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Nodes

public static final String Nodes
the tuple associated to a node of the multigraph

See Also:
Constant Field Values

Optimizer

public static final String Optimizer
the local optimizer : experimental section

See Also:
Constant Field Values
Method Detail

getNodes

public static final RVertexList getNodes(Vertex V)
get datanodes tuple of a multinode V (i.e. Nodes(V)) and create an empty RVertexList if it does not exist. shorthand for RVertexList.getVertexList(V, Nodes)


addNode

public static final void addNode(Vertex V,
                                 Vertex v)
add datanode v in tuples of a multinode V


getLastNode

public static final Vertex getLastNode(Vertex V)
get last datanode of a multinode V Last(V) = vk / Nodes(V) = (v1, ..., vk)


getMultinode

public static final Vertex getMultinode(Vertex v)
get the multinode V such that Nodes(V) = (v) this is used in multigraph initialisation to retrieve the multinode V that has been build from v. return null if v didn't give rise to any multinode.


setMultinode

public static final void setMultinode(Vertex v,
                                      Vertex V)
record in datanode v the multinode V such that Nodes(V) = (v). this is used in multigraph initialisation to keep track in v of the multigraph vertex V that has been build from v.


removeMultinode

public static final void removeMultinode(Vertex v)
remove multinode V from datanode v


isStar

public static final boolean isStar(Vertex v)
tell if datanode v is a star (*) note: there are different ways to detect '*' the quickest for now is that '*' is (should be) the only colorless datanode


countStars

public static final int countStars(Vertex V)
count number of stars in multinode V


isFullStar

public static final boolean isFullStar(Vertex V)
tell if multinode V is a full star (also called the 'black' star) i.e if all of its datanodes are stars


isPartialStar

public static final boolean isPartialStar(Vertex V)
tell if multinode V is a partial star on at least one color but not a full star


isCoreNode

public static final boolean isCoreNode(Vertex V)
tell if multinode V has no star. such a multinode is called a 'CoreNode'


getSons

public static final RVertexSet getSons(Vertex V)
get multinodes sons of a multinode V and create an empty RVertexSet if it does not exist. shorthand for RVertexSet.getVertexSet(V, Sons)


getSon

public static final Vertex getSon(Vertex V,
                                  Vertex terminal)
get the multinode son of a multinode V, that ends with specified terminals. return null if not found


addSon

public static final void addSon(Vertex V,
                                Vertex Son)
add son into multinode V


hasSon

public static final boolean hasSon(Vertex V)
tell if multinode V has son(s)


removeSons

public static final void removeSons(Vertex V)
remove all sons from multinode V


removeSons

public static final void removeSons(Iterable<Vertex> iterable)

getAliases

public static final RVertexSet getAliases(Vertex V)
get multinodes aliases of a multinode V (V is called a root multinode) and create an empty RVertexSet if it does not exist.


addAlias

public static final void addAlias(Vertex V,
                                  Vertex Alias)
add alias into multinode V (also set root of V to Root)


hasAlias

public static final boolean hasAlias(Vertex V)
tell if multinode V has aliases i.e. if V is a root multinode


removeAlias

public static final void removeAlias(Vertex V,
                                     Vertex Alias)
remove alias from multinode


removeAliases

public static final void removeAliases(Vertex V)
remove all aliases from multinode V (also remove root from Aliases(V))


removeAliases

public static final void removeAliases(Iterable<Vertex> iterable)

getRoot

public static final Vertex getRoot(Vertex V)
get root of multinode V return null if V is not an Alias Node


setRoot

public static final void setRoot(Vertex V,
                                 Vertex Root)
record Root multinode in multinode V (also add V in Aliases(Root))


hasRoot

public static final boolean hasRoot(Vertex V)
tell if multinode V has a root node i.e. if it is an alias node


removeRoot

public static final void removeRoot(Vertex V)
remove root from multinode V (and remove V from its root aliases)


removeRoot

public static final void removeRoot(Iterable<Vertex> iterable)

getOptimizer

public static final ColorOptimizer getOptimizer(Registry r)
get the color optimizer attached to the registry


setOptimizer

public static final void setOptimizer(Registry r,
                                      ColorOptimizer optimizer)
set the color optimizer into the registry


getTrueColors

public static final RColorSet getTrueColors(Vertex V,
                                            Vertex U)
compute true colors of edge (U, V) using the datagraph (i.e not relying on an actual edge). may return an empty colorset.


getPseudoColors

public static RColorSet getPseudoColors(Vertex V,
                                        Vertex U)
compute pseudo colors of edge (U, V) using the datagraph (i.e not relying on an actual edge). pseudo colors are the projection (OR) of all true colors of all edges between root and alias nodes. Example: V = Root(V1, V2) ; U = Root(U1, U2) pseudoColors = OR( trueColors(X,Y)) for X = V, V1, V2 ; Y = U, U1, U2 note: if V and U are not roots, then this will return the same as trueColors. may return an empty colorset.