コード例 #1
0
 /** Print the value numbers for each node in the value graph. */
 void printValueNumbers() {
   for (Enumeration<GraphNode> e = valueGraph.enumerateVertices(); e.hasMoreElements(); ) {
     ValueGraphVertex v = (ValueGraphVertex) e.nextElement();
     int valueNumber = v.getValueNumber();
     GVCongruenceClass c = B.get(valueNumber);
     System.out.println(v.getName() + " " + valueNumber + " " + c.getLabel());
   }
 }
コード例 #2
0
 /**
  * Initialize the congruence classes, assuming that all nodes with the same label are congruent.
  */
 private void initialize() {
   // store a map from label -> congruenceClass
   HashMap<Object, GVCongruenceClass> labelMap = new HashMap<Object, GVCongruenceClass>(10);
   for (Enumeration<GraphNode> e = valueGraph.enumerateVertices(); e.hasMoreElements(); ) {
     ValueGraphVertex v = (ValueGraphVertex) e.nextElement();
     Object label = v.getLabel();
     GVCongruenceClass c = findOrCreateCongruenceClass(label, labelMap);
     // add this node to the congruence class
     c.addVertex(v);
     // set the value number for the node
     v.setValueNumber(c.getValueNumber());
   }
 }