Package java.io

Examples of java.io.PrintWriter.printf()


    public static void writeWeighted(
            File f, WeightedGraph<? extends WeightedEdge> g)
               throws IOException {
        PrintWriter pw = new PrintWriter(f);
        for (WeightedEdge e : g.edges()) {
            pw.printf("%d %d %f%n", e.from(), e.to(), e.weight());
        }
        pw.close();
    }

    public static void writeWeighted(
View Full Code Here


                v1 = String.valueOf(e.from());
            String v2 = vertexLabels.lookup(e.to());
            if (v2 == null)
                v2 = String.valueOf(e.to());

            pw.printf("%s\t%s\t%f%n", v1, v2, e.weight());
        }
        pw.close();
    }
}
View Full Code Here

            IntIterator iter = g.vertices().iterator();
            while (iter.hasNext()) {
                int v = iter.nextInt();
                String label = vertexLabels.lookup(v);
                if (label != null)
                    pw.printf("%d \"%s\"%n", v, label);
            }
        }
       
        // We will flatten all the parallel edges together, which requires
        // iterative over the edges to see how many unique compacted edges there
View Full Code Here

                        fromWeight += e.weight();
                    else
                        toWeight += e.weight();
                }
                if (fromWeight != 0)
                    pw.printf("%d %d %f%n", v1, v2, fromWeight);
                if (toWeight != 0)
                    pw.printf("%d %d %f%n", v2, v1, toWeight);
            }
        }
       
View Full Code Here

                        toWeight += e.weight();
                }
                if (fromWeight != 0)
                    pw.printf("%d %d %f%n", v1, v2, fromWeight);
                if (toWeight != 0)
                    pw.printf("%d %d %f%n", v2, v1, toWeight);
            }
        }
       
        pw.close();
    }  
View Full Code Here

                    // If the edge similarity is above the threshold, compute
                    // the kernel similarity for each new edge.
                    if (dataSimilarity > edgeSimThreshold) {
                        double edgeWeight = kernelSim.sim(row1, row2);
                        affMatrixWriter.printf("%d %d %f\n",i+1,j+1,edgeWeight);

                        // If the kernel metric is symmetric, just reuse the
                        // previously calculated edge weight.  Otherwise
                        // recalculate it.
                        edgeWeight = (kernelSim.isSymmetric())
View Full Code Here

                        // previously calculated edge weight.  Otherwise
                        // recalculate it.
                        edgeWeight = (kernelSim.isSymmetric())
                            ? edgeWeight
                            : kernelSim.sim(row2, row1);
                        affMatrixWriter.printf("%d %d %f\n",j+1,i+1,edgeWeight);
                    }
                }
            }

            affMatrixWriter.close();   
View Full Code Here

                    // which to use.
                    double dataSimilarity = edgeSim.sim(curRow, otherRow);
                   
                    if (dataSimilarity > edgeSimThreshold) {
                        double edgeWeight = kernelSim.sim(curRow, otherRow);
                        affMatrixWriter.printf("%d %d %f\n",
                                               row+1, other+1, edgeWeight);

                        // If the kernel metric is symmetric, just reuse the
                        // previously calculated edge weight.  Otherwise
                        // recalculate it.
View Full Code Here

                        // recalculate it.
                        edgeWeight = (kernelSim.isSymmetric())
                            ? edgeWeight
                            : kernelSim.sim(otherRow, curRow);

                        affMatrixWriter.printf("%d %d %f\n",
                                               other+1, row+1, edgeWeight);
                    }
                }
                curRow = nextRow;
                matrixIter.reset();
View Full Code Here

                    // Clean and write the posting's content to the output file.
                    sb.append("\n");
                    String cleanedContent = processor.process(sb.toString());
                    System.out.println(awardFile.getAbsolutePath());
                    pw.printf("%s\n", cleanedContent);
                    br.close();
                }
            }
        }
        pw.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.