Search in sources :

Example 1 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project gephi by gephi.

the class ClusteringCoefficient method getReport.

@Override
public String getReport() {
    //distribution of values
    Map<Double, Integer> dist = new HashMap<>();
    for (int i = 0; i < N; i++) {
        Double d = nodeClustering[i];
        if (dist.containsKey(d)) {
            Integer v = dist.get(d);
            dist.put(d, v + 1);
        } else {
            dist.put(d, 1);
        }
    }
    //Distribution series
    XYSeries dSeries = ChartUtils.createXYSeries(dist, "Clustering Coefficient");
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(dSeries);
    JFreeChart chart = ChartFactory.createScatterPlot("Clustering Coefficient Distribution", "Value", "Count", dataset, PlotOrientation.VERTICAL, true, false, false);
    chart.removeLegend();
    ChartUtils.decorateChart(chart);
    ChartUtils.scaleChart(chart, dSeries, false);
    String imageFile = ChartUtils.renderChart(chart, "clustering-coefficient.png");
    NumberFormat f = new DecimalFormat("#0.000");
    if (isDirected) {
        return "<HTML> <BODY> <h1> Clustering Coefficient Metric Report </h1> " + "<hr>" + "<br />" + "<h2> Parameters: </h2>" + "Network Interpretation:  " + (isDirected ? "directed" : "undirected") + "<br />" + "<br>" + "<h2> Results: </h2>" + "Average Clustering Coefficient: " + f.format(avgClusteringCoeff) + "<br />" + "The Average Clustering Coefficient is the mean value of individual coefficients.<br /><br />" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Simple and slow brute force.<br />" + "</BODY> </HTML>";
    } else {
        return "<HTML> <BODY> <h1> Clustering Coefficient Metric Report </h1> " + "<hr>" + "<br />" + "<h2> Parameters: </h2>" + "Network Interpretation:  " + (isDirected ? "directed" : "undirected") + "<br />" + "<br>" + "<h2> Results: </h2>" + "Average Clustering Coefficient: " + f.format(avgClusteringCoeff) + "<br />" + "Total triangles: " + totalTriangles + "<br />" + "The Average Clustering Coefficient is the mean value of individual coefficients.<br /><br />" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Matthieu Latapy, <i>Main-memory Triangle Computations for Very Large (Sparse (Power-Law)) Graphs</i>, in Theoretical Computer Science (TCS) 407 (1-3), pages 458-473, 2008<br />" + "</BODY> </HTML>";
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) HashMap(java.util.HashMap) DecimalFormat(java.text.DecimalFormat) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart) NumberFormat(java.text.NumberFormat)

Example 2 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project gephi by gephi.

the class Modularity method getReport.

@Override
public String getReport() {
    //Distribution series
    Map<Integer, Integer> sizeDist = new HashMap<>();
    for (Node n : structure.graph.getNodes()) {
        Integer v = (Integer) n.getAttribute(MODULARITY_CLASS);
        if (!sizeDist.containsKey(v)) {
            sizeDist.put(v, 0);
        }
        sizeDist.put(v, sizeDist.get(v) + 1);
    }
    XYSeries dSeries = ChartUtils.createXYSeries(sizeDist, "Size Distribution");
    XYSeriesCollection dataset1 = new XYSeriesCollection();
    dataset1.addSeries(dSeries);
    JFreeChart chart = ChartFactory.createXYLineChart("Size Distribution", "Modularity Class", "Size (number of nodes)", dataset1, PlotOrientation.VERTICAL, true, false, false);
    chart.removeLegend();
    ChartUtils.decorateChart(chart);
    ChartUtils.scaleChart(chart, dSeries, false);
    String imageFile = ChartUtils.renderChart(chart, "communities-size-distribution.png");
    NumberFormat f = new DecimalFormat("#0.000");
    String report = "<HTML> <BODY> <h1>Modularity Report </h1> " + "<hr>" + "<h2> Parameters: </h2>" + "Randomize:  " + (isRandomized ? "On" : "Off") + "<br>" + "Use edge weights:  " + (useWeight ? "On" : "Off") + "<br>" + "Resolution:  " + (resolution) + "<br>" + "<br> <h2> Results: </h2>" + "Modularity: " + f.format(modularity) + "<br>" + "Modularity with resolution: " + f.format(modularityResolution) + "<br>" + "Number of Communities: " + structure.communities.size() + "<br /><br />" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Vincent D Blondel, Jean-Loup Guillaume, Renaud Lambiotte, Etienne Lefebvre, <i>Fast unfolding of communities in large networks</i>, in Journal of Statistical Mechanics: Theory and Experiment 2008 (10), P1000<br />" + "<br /><br />" + "<h2> Resolution: </h2>" + "R. Lambiotte, J.-C. Delvenne, M. Barahona <i>Laplacian Dynamics and Multiscale Modular Structure in Networks 2009<br />" + "</BODY> </HTML>";
    return report;
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) Node(org.gephi.graph.api.Node) DecimalFormat(java.text.DecimalFormat) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart) NumberFormat(java.text.NumberFormat)

Example 3 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project gephi by gephi.

the class PageRank method getReport.

/**
     *
     * @return
     */
@Override
public String getReport() {
    //distribution of values
    Map<Double, Integer> dist = new HashMap<>();
    for (int i = 0; i < pageranks.length; i++) {
        Double d = pageranks[i];
        if (dist.containsKey(d)) {
            Integer v = dist.get(d);
            dist.put(d, v + 1);
        } else {
            dist.put(d, 1);
        }
    }
    //Distribution series
    XYSeries dSeries = ChartUtils.createXYSeries(dist, "PageRanks");
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(dSeries);
    JFreeChart chart = ChartFactory.createXYLineChart("PageRank Distribution", "Score", "Count", dataset, PlotOrientation.VERTICAL, true, false, false);
    chart.removeLegend();
    ChartUtils.decorateChart(chart);
    ChartUtils.scaleChart(chart, dSeries, true);
    String imageFile = ChartUtils.renderChart(chart, "pageranks.png");
    String report = "<HTML> <BODY> <h1>PageRank Report </h1> " + "<hr> <br />" + "<h2> Parameters: </h2>" + "Epsilon = " + epsilon + "<br>" + "Probability = " + probability + "<br> <h2> Results: </h2>" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Sergey Brin, Lawrence Page, <i>The Anatomy of a Large-Scale Hypertextual Web Search Engine</i>, in Proceedings of the seventh International Conference on the World Wide Web (WWW1998):107-117<br />" + "</BODY> </HTML>";
    return report;
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) HashMap(java.util.HashMap) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart)

Example 4 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project gephi by gephi.

the class WeightedDegree method getDirectedReport.

public String getDirectedReport() {
    //Distribution series
    XYSeries dSeries = ChartUtils.createXYSeries(degreeDist, "Degree Distribution");
    XYSeries idSeries = ChartUtils.createXYSeries(inDegreeDist, "In-Degree Distribution");
    XYSeries odSeries = ChartUtils.createXYSeries(outDegreeDist, "Out-Degree Distribution");
    XYSeriesCollection dataset1 = new XYSeriesCollection();
    dataset1.addSeries(dSeries);
    XYSeriesCollection dataset2 = new XYSeriesCollection();
    dataset2.addSeries(idSeries);
    XYSeriesCollection dataset3 = new XYSeriesCollection();
    dataset3.addSeries(odSeries);
    JFreeChart chart1 = ChartFactory.createXYLineChart("Degree Distribution", "Value", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false);
    ChartUtils.decorateChart(chart1);
    ChartUtils.scaleChart(chart1, dSeries, false);
    String degreeImageFile = ChartUtils.renderChart(chart1, "w-degree-distribution.png");
    JFreeChart chart2 = ChartFactory.createXYLineChart("In-Degree Distribution", "Value", "Count", dataset2, PlotOrientation.VERTICAL, true, false, false);
    ChartUtils.decorateChart(chart2);
    ChartUtils.scaleChart(chart2, dSeries, false);
    String indegreeImageFile = ChartUtils.renderChart(chart2, "indegree-distribution.png");
    JFreeChart chart3 = ChartFactory.createXYLineChart("Out-Degree Distribution", "Value", "Count", dataset3, PlotOrientation.VERTICAL, true, false, false);
    ChartUtils.decorateChart(chart3);
    ChartUtils.scaleChart(chart3, dSeries, false);
    String outdegreeImageFile = ChartUtils.renderChart(chart3, "outdegree-distribution.png");
    NumberFormat f = new DecimalFormat("#0.000");
    String report = "<HTML> <BODY> <h1>Weighted Degree Report </h1> " + "<hr>" + "<br> <h2> Results: </h2>" + "Average Weighted Degree: " + f.format(avgWDegree) + "<br /><br />" + degreeImageFile + "<br /><br />" + indegreeImageFile + "<br /><br />" + outdegreeImageFile + "</BODY></HTML>";
    return report;
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) DecimalFormat(java.text.DecimalFormat) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart) NumberFormat(java.text.NumberFormat)

Example 5 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project gephi by gephi.

the class DynamicNbEdges method getReport.

@Override
public String getReport() {
    //Time series
    XYSeries dSeries = ChartUtils.createXYSeries(counts, "Nb Edges Time Series");
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(dSeries);
    JFreeChart chart = ChartFactory.createXYLineChart("# Edges Time Series", "Time", "# Edges", dataset, PlotOrientation.VERTICAL, true, false, false);
    chart.removeLegend();
    ChartUtils.decorateChart(chart);
    ChartUtils.scaleChart(chart, dSeries, false);
    String imageFile = ChartUtils.renderChart(chart, "nb-edges-ts.png");
    NumberFormat f = new DecimalFormat("#0.000");
    String report = "<HTML> <BODY> <h1>Dynamic Number of Edges Report </h1> " + "<hr>" + "<br> Bounds: from " + f.format(bounds.getLow()) + " to " + f.format(bounds.getHigh()) + "<br> Window: " + window + "<br> Tick: " + tick + "<br><br><h2> Number of edges over time: </h2>" + "<br /><br />" + imageFile;
    /*for (Interval<Integer> count : counts) {
        report += count.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />";
        }*/
    report += "<br /><br /></BODY></HTML>";
    return report;
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) DecimalFormat(java.text.DecimalFormat) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart) NumberFormat(java.text.NumberFormat)

Aggregations

XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)23 XYSeries (org.jfree.data.xy.XYSeries)22 JFreeChart (org.jfree.chart.JFreeChart)17 DecimalFormat (java.text.DecimalFormat)11 NumberFormat (java.text.NumberFormat)11 HashMap (java.util.HashMap)6 XYPlot (org.jfree.chart.plot.XYPlot)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Node (org.gephi.graph.api.Node)1 StandardXYItemRenderer (org.jfree.chart.renderer.xy.StandardXYItemRenderer)1 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)1 XYSplineRenderer (org.jfree.chart.renderer.xy.XYSplineRenderer)1 XYDataItem (org.jfree.data.xy.XYDataItem)1