2 * A class that represents the irregular bipartite graph used in
3 * EM3D. The graph contains two linked structures that represent the
4 * E nodes and the N nodes in the application.
11 * Nodes that represent the electrical field.
15 * Nodes that representhe the magnetic field.
20 * Construct the bipartite graph.
21 * @param e the nodes representing the electric fields
22 * @param h the nodes representing the magnetic fields
24 BiGraph(Node e, Node h)
31 * Create the bi graph that contains the linked list of
33 * @param numNodes the number of nodes to create
34 * @param numDegree the out-degree of each node
35 * @param verbose should we print out runtime messages
36 * @return the bi graph that we've created.
39 static BiGraph create(int numNodes, int numDegree, boolean verbose, Random r)
42 // making nodes (we create a table)
43 //if (verbose) System.printString("making nodes (tables in orig. version)");
44 Node [] eTable=Node.fillTable(numNodes, numDegree, r);
45 Node [] hTable=Node.fillTable(numNodes, numDegree, r);
48 //if (verbose) System.printString("updating from and coeffs");
49 for(int i = 0; i< numNodes; i++) {
51 n.makeUniqueNeighbors(eTable, r);
54 for (int i = 0; i < numNodes; i++) {
56 n.makeUniqueNeighbors(hTable, r);
59 // Create the fromNodes and coeff field
60 //if (verbose) System.printString("filling from fields");
61 for(int i = 0; i< numNodes; i++) {
66 for (int i = 0; i < numNodes; i++) {
71 // Update the fromNodes
72 for (int i = 0; i < numNodes; i++) {
76 for (int i = 0; i < numNodes; i++) {
81 BiGraph g = global new BiGraph(eTable[0], hTable[0]);
86 * Override the toString method to print out the values of the e and h nodes.
87 * @return a string contain the values of the e and h nodes.
89 public String toString()
91 StringBuffer retval = new StringBuffer();
95 retval.append("E: " + n + "\n");
101 retval.append("H: " + n + "\n");
104 return retval.toString();