Add Statistics modules and update implementations to use the new API

Esse commit está contido em:
Mathieu Bastian
2013-12-22 22:08:42 +01:00
commit 535b3ebf99
62 arquivos alterados com 1363 adições e 1380 exclusões
+2 -2
Ver Arquivo
@@ -5,7 +5,7 @@
<artifactId>gephi-parent</artifactId>
<groupId>org.gephi</groupId>
<version>0.9-SNAPSHOT</version>
<relativePath>../..</relativePath>
<relativePath>../..</relativePath>
</parent>
<groupId>org.gephi</groupId>
@@ -18,7 +18,7 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
<artifactId>graph-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -50,11 +50,14 @@ import java.util.concurrent.TimeUnit;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import org.gephi.data.attributes.type.Interval;
import org.gephi.data.attributes.type.TimeInterval;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.TimeFormat;
import org.gephi.attribute.time.Interval;
import org.gephi.dynamic.DynamicUtilities;
import org.gephi.dynamic.api.DynamicController;
import org.gephi.dynamic.api.DynamicModel;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.lib.validation.PositiveNumberValidator;
import org.gephi.statistics.spi.DynamicStatistics;
import org.gephi.ui.components.richtooltip.RichTooltip;
@@ -76,6 +79,7 @@ public class DynamicSettingsPanel extends javax.swing.JPanel {
private TimeUnit windowTimeUnit = TimeUnit.DAYS;
private TimeUnit tickTimeUnit = TimeUnit.DAYS;
private Interval bounds = null;
public DynamicSettingsPanel() {
initComponents();
@@ -107,42 +111,29 @@ public class DynamicSettingsPanel extends javax.swing.JPanel {
}
});
}
Interval bounds = null;
public void setup(DynamicStatistics dynamicStatistics) {
DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
DynamicModel model = dynamicController.getModel();
TimeInterval visibleInterval = model.getVisibleInterval();
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getGraphModel();
AttributeModel attributeModel = graphController.getAttributeModel();
TimeFormat timeFormat = attributeModel.getTimeFormat();
//Bounds
bounds = dynamicStatistics.getBounds();
if (bounds == null) {
double low = visibleInterval.getLow();
if (Double.isInfinite(low)) {
low = model.getMin();
}
double high = visibleInterval.getHigh();
if (Double.isInfinite(high)) {
high = model.getMax();
}
bounds = new Interval(low, high);
}
String boundsStr = "";
if (model.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) {
boundsStr = bounds.getLow() + " - " + bounds.getHigh();
} else {
boundsStr = DynamicUtilities.getXMLDateStringFromDouble(bounds.getLow()) + " - " + DynamicUtilities.getXMLDateStringFromDouble(bounds.getHigh());
bounds = graphModel.getTimeBoundsVisible();
}
String boundsStr = timeFormat.print(bounds.getLow())+" - "+timeFormat.print(bounds.getHigh());
currentIntervalLabel.setText(boundsStr);
//TimeUnit
if (model.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) {
if (timeFormat.equals(TimeFormat.DOUBLE)) {
windowTimeUnitCombo.setVisible(false);
tickTimeUnitCombo.setVisible(false);
}
//Set latest selected item
if (!model.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) {
if (!timeFormat.equals(TimeFormat.DOUBLE)) {
loadDefaultTimeUnits();
}
@@ -151,7 +142,7 @@ public class DynamicSettingsPanel extends javax.swing.JPanel {
if(bounds.getHigh() - bounds.getLow() > 1) {
initValue = 1.;
}
if (model.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) {
if (timeFormat.equals(TimeFormat.DOUBLE)) {
windowTextField.setText(initValue + "");
tickTextField.setText(initValue + "");
} else {
@@ -162,6 +153,7 @@ public class DynamicSettingsPanel extends javax.swing.JPanel {
//Add listeners
windowTimeUnitCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getItem() != windowTimeUnitCombo.getSelectedItem()) {
refreshWindowTimeUnit();
@@ -171,6 +163,7 @@ public class DynamicSettingsPanel extends javax.swing.JPanel {
tickTimeUnitCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getItem() != tickTimeUnitCombo.getSelectedItem()) {
refreshTickTimeUnit();
@@ -43,9 +43,6 @@ package org.gephi.desktop.statistics;
import java.util.ArrayList;
import org.gephi.desktop.statistics.api.StatisticsControllerUI;
import org.gephi.dynamic.api.DynamicController;
import org.gephi.dynamic.api.DynamicModelEvent;
import org.gephi.dynamic.api.DynamicModelListener;
import org.gephi.statistics.api.StatisticsController;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsUI;
@@ -61,23 +58,23 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsControllerUI.class)
public class StatisticsControllerUIImpl implements StatisticsControllerUI {
private final DynamicModelListener dynamicModelListener;
// private final DynamicModelListener dynamicModelListener;
private StatisticsModelUIImpl model;
public StatisticsControllerUIImpl() {
dynamicModelListener = new DynamicModelListener() {
public void dynamicModelChanged(DynamicModelEvent event) {
if (event.getEventType().equals(DynamicModelEvent.EventType.IS_DYNAMIC_GRAPH)) {
boolean isDynamic = (Boolean) event.getData();
for (StatisticsUI ui : Lookup.getDefault().lookupAll(StatisticsUI.class)) {
if (ui.getCategory().equals(StatisticsUI.CATEGORY_DYNAMIC)) {
setStatisticsUIVisible(ui, isDynamic);
}
}
}
}
};
// dynamicModelListener = new DynamicModelListener() {
//
// public void dynamicModelChanged(DynamicModelEvent event) {
// if (event.getEventType().equals(DynamicModelEvent.EventType.IS_DYNAMIC_GRAPH)) {
// boolean isDynamic = (Boolean) event.getData();
// for (StatisticsUI ui : Lookup.getDefault().lookupAll(StatisticsUI.class)) {
// if (ui.getCategory().equals(StatisticsUI.CATEGORY_DYNAMIC)) {
// setStatisticsUIVisible(ui, isDynamic);
// }
// }
// }
// }
// };
}
public void setup(StatisticsModelUIImpl model) {
@@ -88,25 +85,25 @@ public class StatisticsControllerUIImpl implements StatisticsControllerUI {
unsetup();
if (model != null) {
DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
boolean isDynamic = dynamicController.getModel(model.getWorkspace()).isDynamicGraph();
if (!isDynamic) {
for (StatisticsUI ui : Lookup.getDefault().lookupAll(StatisticsUI.class)) {
if (ui.getCategory().equals(StatisticsUI.CATEGORY_DYNAMIC)) {
setStatisticsUIVisible(ui, false);
}
}
}
//Add listener
dynamicController.addModelListener(dynamicModelListener);
// DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
// boolean isDynamic = dynamicController.getModel(model.getWorkspace()).isDynamicGraph();
// if (!isDynamic) {
// for (StatisticsUI ui : Lookup.getDefault().lookupAll(StatisticsUI.class)) {
// if (ui.getCategory().equals(StatisticsUI.CATEGORY_DYNAMIC)) {
// setStatisticsUIVisible(ui, false);
// }
// }
// }
// //Add listener
//
// dynamicController.addModelListener(dynamicModelListener);
}
}
public void unsetup() {
if (model != null) {
DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
dynamicController.removeModelListener(dynamicModelListener);
// DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
// dynamicController.removeModelListener(dynamicModelListener);
}
}
@@ -69,15 +69,15 @@ import org.openide.windows.TopComponent;
* @author Patick J. McSweeney
*/
@ConvertAsProperties(dtd = "-//org.gephi.desktop.statistics//Statistics//EN",
autostore = false)
autostore = false)
@TopComponent.Description(preferredID = "StatisticsTopComponent",
iconBase = "org/gephi/desktop/statistics/resources/small.png",
persistenceType = TopComponent.PERSISTENCE_ALWAYS)
iconBase = "org/gephi/desktop/statistics/resources/small.png",
persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(mode = "filtersmode", openAtStartup = true, roles = {"overview"})
@ActionID(category = "Window", id = "org.gephi.desktop.statistics.StatisticsTopComponent")
@ActionReference(path = "Menu/Window", position = 1200)
@TopComponent.OpenActionRegistration(displayName = "#CTL_StatisticsTopComponent",
preferredID = "StatisticsTopComponent")
preferredID = "StatisticsTopComponent")
public final class StatisticsTopComponent extends TopComponent implements ChangeListener {
//Model
@@ -1,10 +0,0 @@
package org.gephi.io.importer.api;
/**
*
* @author mbastian
*/
public enum TimeFormat {
DATE, DATETIME, DOUBLE, TIMESTAMP
}
-4
Ver Arquivo
@@ -16,10 +16,6 @@
<name>StatisticsAPI</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dynamic-api</artifactId>
@@ -42,20 +42,18 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.TimestampIndex;
import org.gephi.attribute.time.Interval;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.api.*;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.type.Interval;
import org.gephi.data.attributes.type.TimeInterval;
import org.gephi.dynamic.api.DynamicController;
import org.gephi.dynamic.api.DynamicGraph;
import org.gephi.dynamic.api.DynamicModel;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.Node;
import org.gephi.project.api.ProjectController;
import org.gephi.utils.longtask.spi.LongTask;
import org.gephi.utils.longtask.api.LongTaskExecutor;
@@ -86,10 +84,12 @@ public class StatisticsControllerImpl implements StatisticsController {
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.addWorkspaceListener(new WorkspaceListener() {
@Override
public void initialize(Workspace workspace) {
workspace.add(new StatisticsModelImpl());
}
@Override
public void select(Workspace workspace) {
model = workspace.getLookup().lookup(StatisticsModelImpl.class);
if (model == null) {
@@ -98,12 +98,15 @@ public class StatisticsControllerImpl implements StatisticsController {
}
}
@Override
public void unselect(Workspace workspace) {
}
@Override
public void close(Workspace workspace) {
}
@Override
public void disable() {
model = null;
}
@@ -118,6 +121,7 @@ public class StatisticsControllerImpl implements StatisticsController {
}
}
@Override
public void execute(final Statistics statistics, LongTaskListener listener) {
StatisticsBuilder builder = getBuilder(statistics.getClass());
LongTaskExecutor executor = new LongTaskExecutor(true, "Statistics " + builder.getName(), 10);
@@ -129,6 +133,7 @@ public class StatisticsControllerImpl implements StatisticsController {
final DynamicLongTask dynamicLongTask = new DynamicLongTask((DynamicStatistics) statistics);
executor.execute(dynamicLongTask, new Runnable() {
@Override
public void run() {
executeDynamic((DynamicStatistics) statistics, dynamicLongTask);
}
@@ -137,6 +142,7 @@ public class StatisticsControllerImpl implements StatisticsController {
LongTask task = statistics instanceof LongTask ? (LongTask) statistics : null;
executor.execute(task, new Runnable() {
@Override
public void run() {
execute(statistics);
}
@@ -144,13 +150,14 @@ public class StatisticsControllerImpl implements StatisticsController {
}
}
@Override
public void execute(Statistics statistics) {
if (statistics instanceof DynamicStatistics) {
executeDynamic((DynamicStatistics) statistics, null);
} else {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getModel();
AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
GraphModel graphModel = graphController.getGraphModel();
AttributeModel attributeModel = graphController.getAttributeModel();
statistics.execute(graphModel, attributeModel);
model.addReport(statistics);
}
@@ -158,42 +165,23 @@ public class StatisticsControllerImpl implements StatisticsController {
private void executeDynamic(DynamicStatistics statistics, DynamicLongTask dynamicLongTask) {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getModel();
AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
DynamicModel dynamicModel = dynamicController.getModel();
AttributeModel attributeModel = attributeController.getModel();
if (!dynamicModel.isDynamicGraph()) {
throw new IllegalArgumentException("The current graph must be a dynamic graph");
}
GraphModel graphModel = graphController.getGraphModel();
AttributeModel attributeModel = graphController.getAttributeModel();
double window = statistics.getWindow();
double tick = statistics.getTick();
Interval bounds = statistics.getBounds();
if (bounds == null) {
TimeInterval visibleInterval = dynamicModel.getVisibleInterval();
double low = visibleInterval.getLow();
if (Double.isInfinite(low)) {
low = dynamicModel.getMin();
}
double high = visibleInterval.getHigh();
if (Double.isInfinite(high)) {
high = dynamicModel.getMax();
}
bounds = new Interval(low, high);
bounds = graphModel.getTimeBoundsVisible();
statistics.setBounds(bounds);
}
if (dynamicLongTask != null) {
//Count
int c = (int) ((bounds.getHigh() - window - bounds.getLow()) / tick);
dynamicLongTask.start(c);
}
HierarchicalGraph graph = graphModel.getHierarchicalGraphVisible();
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graph, bounds);
//Init
statistics.execute(graphModel, attributeModel);
@@ -201,7 +189,24 @@ public class StatisticsControllerImpl implements StatisticsController {
for (double low = bounds.getLow(); low <= bounds.getHigh() - window; low += tick) {
double high = low + window;
Graph g = dynamicGraph.getSnapshotGraph(low, high);
// Graph g = dynamicGraph.getSnapshotGraph(low, high);
GraphView currentView = graphModel.getVisibleView();
Graph graph = graphModel.getGraphVisible();
GraphView view = graphModel.createView();
Graph g = graphModel.getGraph(view);
TimestampIndex<Node> nodeIndex = graphModel.getNodeTimestampIndex(currentView);
for(Node node : nodeIndex.get(low, high)) {
g.addNode(node);
}
TimestampIndex<Edge> edgeIndex = graphModel.getEdgeTimestampIndex(currentView);
for(Edge edge : edgeIndex.get(low, high)) {
g.addEdge(edge);
}
statistics.loop(g.getView(), new Interval(low, high));
@@ -45,7 +45,6 @@ package org.gephi.statistics.api;
import org.gephi.project.api.Workspace;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.gephi.statistics.spi.StatisticsUI;
import org.gephi.utils.longtask.api.LongTaskListener;
import org.gephi.utils.longtask.spi.LongTask;
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.spi;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.type.Interval;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.time.Interval;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
@@ -42,7 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.spi;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.graph.api.GraphModel;
/**
-4
Ver Arquivo
@@ -16,10 +16,6 @@
<name>StatisticsPlugin</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dynamic-api</artifactId>
@@ -1,43 +1,43 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
@@ -47,19 +47,16 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.statistics.spi.Statistics;
import org.gephi.graph.api.Node;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.utils.longtask.spi.LongTask;
import org.gephi.utils.progress.Progress;
import org.gephi.utils.progress.ProgressTicket;
@@ -68,16 +65,19 @@ import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.openide.util.Lookup;
import org.gephi.graph.api.NodeIterable;
import org.openide.util.Lookup;
/**
* Ref: Matthieu Latapy, Main-memory Triangle Computations for Very Large (Sparse (Power-Law)) Graphs,
* in Theoretical Computer Science (TCS) 407 (1-3), pages 458-473, 2008
* Ref: Matthieu Latapy, Main-memory Triangle Computations for Very Large
* (Sparse (Power-Law)) Graphs, in Theoretical Computer Science (TCS) 407 (1-3),
* pages 458-473, 2008
*
* @author pjmcswee
*/
class Renumbering implements Comparator<EdgeWrapper> {
@Override
public int compare(EdgeWrapper o1, EdgeWrapper o2) {
if (o1.wrapper.getID() < o2.wrapper.getID()) {
return -1;
@@ -114,7 +114,9 @@ class ArrayWrapper implements Comparable {
private int ID;
public Node node;
/** Empty Constructor/ */
/**
* Empty Constructor/
*/
ArrayWrapper() {
}
@@ -183,6 +185,7 @@ class ArrayWrapper implements Comparable {
* @param o
* @return
*/
@Override
public int compareTo(Object o) {
ArrayWrapper aw = (ArrayWrapper) o;
if (aw.length() < length()) {
@@ -202,13 +205,21 @@ class ArrayWrapper implements Comparable {
public class ClusteringCoefficient implements Statistics, LongTask {
public static final String CLUSTERING_COEFF = "clustering";
/** The avergage Clustering Coefficient.*/
/**
* The avergage Clustering Coefficient.
*/
private double avgClusteringCoeff;
/**Indicates should treat graph as undirected.*/
/**
* Indicates should treat graph as undirected.
*/
private boolean isDirected;
/** Indicates statistics should stop processing/*/
/**
* Indicates statistics should stop processing/
*/
private boolean isCanceled;
/** Keeps track of Progress made. */
/**
* Keeps track of Progress made.
*/
private ProgressTicket progress;
private int[] triangles;
private ArrayWrapper[] network;
@@ -219,56 +230,59 @@ public class ClusteringCoefficient implements Statistics, LongTask {
public ClusteringCoefficient() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
if (graphController != null && graphController.getGraphModel() != null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
public double getAverageClusteringCoefficient() {
return avgClusteringCoeff;
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph hgraph = null;
isDirected = graphModel.isDirected();
Graph hgraph = null;
if (isDirected) {
hgraph = graphModel.getHierarchicalDirectedGraphVisible();
hgraph = graphModel.getDirectedGraphVisible();
} else {
hgraph = graphModel.getHierarchicalUndirectedGraphVisible();
hgraph = graphModel.getUndirectedGraphVisible();
}
execute(hgraph, attributeModel);
}
public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {
public void execute(Graph hgraph, AttributeModel attributeModel) {
isCanceled = false;
if(isDirected)
if (isDirected) {
bruteForce(hgraph, attributeModel);
else
} else {
triangles(hgraph);
//Set results in columns
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn clusteringCol = nodeTable.getColumn(CLUSTERING_COEFF);
if (clusteringCol == null) {
clusteringCol = nodeTable.addColumn(CLUSTERING_COEFF, "Clustering Coefficient", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
}
AttributeColumn triCount = null;
if(!isDirected){
//Set results in columns
Table nodeTable = attributeModel.getNodeTable();
Column clusteringCol = nodeTable.getColumn(CLUSTERING_COEFF);
if (clusteringCol == null) {
clusteringCol = nodeTable.addColumn(CLUSTERING_COEFF, "Clustering Coefficient", Double.class, new Double(0));
}
Column triCount = null;
if (!isDirected) {
triCount = nodeTable.getColumn("Triangles");
if (triCount == null) {
triCount = nodeTable.addColumn("Triangles", "Number of triangles", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
triCount = nodeTable.addColumn("Triangles", "Number of triangles", Integer.class, new Integer(0));
}
}
for (int v = 0; v < N; v++) {
if (network[v].length() > 1) {
AttributeRow row = (AttributeRow) network[v].node.getNodeData().getAttributes();
row.setValue(clusteringCol, nodeClustering[v]);
if(!isDirected)
row.setValue(triCount, triangles[v]);
network[v].node.setAttribute(clusteringCol, nodeClustering[v]);
if (!isDirected) {
network[v].node.setAttribute(triCount, triangles[v]);
}
}
}
}
@@ -302,7 +316,6 @@ public class ClusteringCoefficient implements Statistics, LongTask {
}
}
if (v > network[v].get(right)) {
return (right);
} else {
@@ -343,6 +356,7 @@ public class ClusteringCoefficient implements Statistics, LongTask {
} else if (network[u].get(iu) > network[v].get(iv)) {
iv++;
} else { /* neighbor in common */
w = network[u].get(iu);
if (w >= K) {
triangles[w] += count;
@@ -353,7 +367,7 @@ public class ClusteringCoefficient implements Statistics, LongTask {
}
}
public void triangles(HierarchicalGraph hgraph) {
public void triangles(Graph hgraph) {
int ProgressCount = 0;
Progress.start(progress, 7 * hgraph.getNodeCount());
@@ -363,10 +377,14 @@ public class ClusteringCoefficient implements Statistics, LongTask {
N = hgraph.getNodeCount();
nodeClustering = new double[N];
/** Create network for processing */
/**
* Create network for processing
*/
network = new ArrayWrapper[N];
/** */
/**
*
*/
HashMap<Node, Integer> indicies = new HashMap<Node, Integer>();
int index = 0;
for (Node s : hgraph.getNodes()) {
@@ -381,18 +399,18 @@ public class ClusteringCoefficient implements Statistics, LongTask {
HashMap<Node, EdgeWrapper> neighborTable = new HashMap<Node, EdgeWrapper>();
if (!isDirected) {
for (Edge edge : hgraph.getEdgesAndMetaEdges(node)) {
for (Edge edge : hgraph.getEdges(node)) {
Node neighbor = hgraph.getOpposite(node, edge);
neighborTable.put(neighbor, new EdgeWrapper(1, network[indicies.get(neighbor)]));
}
} else {
for (Edge in : ((HierarchicalDirectedGraph) hgraph).getInEdgesAndMetaInEdges(node)) {
Node neighbor = in.getSource().getNodeData().getNode(hgraph.getView().getViewId());
for (Edge in : ((DirectedGraph) hgraph).getInEdges(node)) {
Node neighbor = in.getSource();
neighborTable.put(neighbor, new EdgeWrapper(1, network[indicies.get(neighbor)]));
}
for (Edge out : ((HierarchicalDirectedGraph) hgraph).getOutEdgesAndMetaOutEdges(node)) {
Node neighbor = out.getTarget().getNodeData().getNode(hgraph.getView().getViewId());
for (Edge out : ((DirectedGraph) hgraph).getOutEdges(node)) {
Node neighbor = out.getTarget();
EdgeWrapper ew = neighborTable.get(neighbor);
if (ew == null) {
neighborTable.put(neighbor, new EdgeWrapper(1, network[indicies.get(neighbor)]));
@@ -433,7 +451,6 @@ public class ClusteringCoefficient implements Statistics, LongTask {
triangles = new int[N];
K = (int) Math.sqrt(N);
for (int v = 0; v < K && v < N; v++) {
newVertex(v);
Progress.progress(progress, ++ProgressCount);
@@ -484,72 +501,73 @@ public class ClusteringCoefficient implements Statistics, LongTask {
hgraph.readUnlock();
}
private void bruteForce(HierarchicalGraph hgraph, AttributeModel attributeModel) {
//The atrributes computed by the statistics
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn clusteringCol = nodeTable.getColumn("clustering");
if (clusteringCol == null) {
clusteringCol = nodeTable.addColumn("clustering", "Clustering Coefficient", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
}
float totalCC = 0;
hgraph.readLock();
Progress.start(progress, hgraph.getNodeCount());
int node_count = 0;
for (Node node : hgraph.getNodes()) {
float nodeCC = 0;
int neighborhood = 0;
NodeIterable neighbors1 = hgraph.getNeighbors(node);
for (Node neighbor1 : neighbors1) {
neighborhood++;
NodeIterable neighbors2 = hgraph.getNeighbors(node);
for (Node neighbor2 : neighbors2) {
if (neighbor1 == neighbor2) {
continue;
}
if (isDirected) {
if (((HierarchicalDirectedGraph) hgraph).getEdge(neighbor1, neighbor2) != null) {
nodeCC++;
}
if (((HierarchicalDirectedGraph) hgraph).getEdge(neighbor2, neighbor1) != null) {
nodeCC++;
}
} else {
if (hgraph.isAdjacent(neighbor1, neighbor2)) {
nodeCC++;
}
}
}
}
nodeCC /= 2.0;
if (neighborhood > 1) {
float cc = nodeCC / (.5f * neighborhood * (neighborhood - 1));
if (isDirected) {
cc = nodeCC / (neighborhood * (neighborhood - 1));
}
AttributeRow row = (AttributeRow) node.getNodeData().getAttributes();
row.setValue(clusteringCol, cc);
totalCC += cc;
}
if (isCanceled) {
break;
}
node_count++;
Progress.progress(progress, node_count);
}
avgClusteringCoeff = totalCC / hgraph.getNodeCount();
hgraph.readUnlockAll();
private void bruteForce(Graph hgraph, AttributeModel attributeModel) {
//The atrributes computed by the statistics
Table nodeTable = attributeModel.getNodeTable();
Column clusteringCol = nodeTable.getColumn("clustering");
if (clusteringCol == null) {
clusteringCol = nodeTable.addColumn("clustering", "Clustering Coefficient", Double.class, new Double(0));
}
float totalCC = 0;
hgraph.readLock();
Progress.start(progress, hgraph.getNodeCount());
int node_count = 0;
for (Node node : hgraph.getNodes()) {
float nodeCC = 0;
int neighborhood = 0;
NodeIterable neighbors1 = hgraph.getNeighbors(node);
for (Node neighbor1 : neighbors1) {
neighborhood++;
NodeIterable neighbors2 = hgraph.getNeighbors(node);
for (Node neighbor2 : neighbors2) {
if (neighbor1 == neighbor2) {
continue;
}
if (isDirected) {
if (hgraph.isAdjacent(neighbor1, neighbor2)) {
nodeCC++;
}
if (hgraph.isAdjacent(neighbor2, neighbor1)) {
nodeCC++;
}
} else {
if (hgraph.isAdjacent(neighbor1, neighbor2)) {
nodeCC++;
}
}
}
}
nodeCC /= 2.0;
if (neighborhood > 1) {
float cc = nodeCC / (.5f * neighborhood * (neighborhood - 1));
if (isDirected) {
cc = nodeCC / (neighborhood * (neighborhood - 1));
}
node.setAttribute(clusteringCol, cc);
totalCC += cc;
}
if (isCanceled) {
break;
}
node_count++;
Progress.progress(progress, node_count);
}
avgClusteringCoeff = totalCC / hgraph.getNodeCount();
hgraph.readUnlockAll();
}
@Override
public String getReport() {
//distribution of values
Map<Double, Integer> dist = new HashMap<Double, Integer>();
@@ -584,20 +602,20 @@ public class ClusteringCoefficient implements Statistics, LongTask {
NumberFormat f = new DecimalFormat("#0.000");
if(isDirected){
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>";
+ "<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>"
@@ -610,7 +628,7 @@ public class ClusteringCoefficient implements Statistics, LongTask {
+ "<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>";
}
}
}
public void setDirected(boolean isDirected) {
@@ -621,11 +639,13 @@ public class ClusteringCoefficient implements Statistics, LongTask {
return isDirected;
}
@Override
public boolean cancel() {
isCanceled = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket ProgressTicket) {
this.progress = ProgressTicket;
}
@@ -1,43 +1,43 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
@@ -48,20 +48,17 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.EdgeIterable;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalUndirectedGraph;
import org.gephi.graph.api.Node;
import org.gephi.graph.api.NodeIterable;
import org.gephi.graph.api.UndirectedGraph;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
import org.gephi.utils.progress.Progress;
@@ -91,48 +88,51 @@ public class ConnectedComponents implements Statistics, LongTask {
public ConnectedComponents() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
if (graphController != null && graphController.getGraphModel() != null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
isDirected = graphModel.isDirected();
isCanceled = false;
HierarchicalUndirectedGraph undirectedGraph = graphModel.getHierarchicalUndirectedGraphVisible();
UndirectedGraph undirectedGraph = graphModel.getUndirectedGraphVisible();
weaklyConnected(undirectedGraph, attributeModel);
if (isDirected) {
HierarchicalDirectedGraph directedGraph = graphModel.getHierarchicalDirectedGraphVisible();
DirectedGraph directedGraph = graphModel.getDirectedGraphVisible();
top_tarjans(directedGraph, attributeModel);
}
}
public void weaklyConnected(HierarchicalUndirectedGraph hgraph, AttributeModel attributeModel) {
public void weaklyConnected(UndirectedGraph graph, AttributeModel attributeModel) {
isCanceled = false;
componentCount = 0;
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn componentCol = nodeTable.getColumn(WEAKLY);
Table nodeTable = attributeModel.getNodeTable();
Column componentCol = nodeTable.getColumn(WEAKLY);
if (componentCol == null) {
componentCol = nodeTable.addColumn(WEAKLY, "Component ID", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
componentCol = nodeTable.addColumn(WEAKLY, "Component ID", Integer.class, new Integer(0));
}
List<Integer> sizeList = new ArrayList<Integer>();
hgraph.readLock();
graph.readLock();
HashMap<Node, Integer> indicies = new HashMap<Node, Integer>();
int index = 0;
for (Node s : hgraph.getNodes()) {
for (Node s : graph.getNodes()) {
indicies.put(s, index);
index++;
}
int N = hgraph.getNodeCount();
int N = graph.getNodeCount();
//Keep track of which nodes have been seen
int[] color = new int[N];
Progress.start(progress, hgraph.getNodeCount());
Progress.start(progress, graph.getNodeCount());
int seenCount = 0;
while (seenCount < N) {
//The search Q
@@ -141,7 +141,7 @@ public class ConnectedComponents implements Statistics, LongTask {
LinkedList<Node> component = new LinkedList<Node>();
//Seed the seach Q
NodeIterable iter = hgraph.getNodes();
NodeIterable iter = graph.getNodes();
for (Node first : iter) {
if (color[indicies.get(first)] == 0) {
Q.add(first);
@@ -153,7 +153,7 @@ public class ConnectedComponents implements Statistics, LongTask {
//While there are more nodes to search
while (!Q.isEmpty()) {
if (isCanceled) {
hgraph.readUnlock();
graph.readUnlock();
return;
}
//Get the next Node and add it to the component list
@@ -161,11 +161,11 @@ public class ConnectedComponents implements Statistics, LongTask {
component.add(u);
//Iterate over all of u's neighbors
EdgeIterable edgeIter = hgraph.getEdgesAndMetaEdges(u);
EdgeIterable edgeIter = graph.getEdges(u);
//For each neighbor
for (Edge edge : edgeIter) {
Node reachable = hgraph.getOpposite(u, edge);
Node reachable = graph.getOpposite(u, edge);
int id = indicies.get(reachable);
//If this neighbor is unvisited
if (color[id] == 0) {
@@ -181,13 +181,12 @@ public class ConnectedComponents implements Statistics, LongTask {
seenCount++;
}
for (Node s : component) {
AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
row.setValue(componentCol, componentCount);
s.setAttribute(componentCol, componentCount);
}
sizeList.add(component.size());
componentCount++;
}
hgraph.readUnlock();
graph.readUnlock();
componentsSize = new int[sizeList.size()];
for (int i = 0; i < sizeList.size(); i++) {
@@ -195,24 +194,24 @@ public class ConnectedComponents implements Statistics, LongTask {
}
}
public void top_tarjans(HierarchicalDirectedGraph hgraph, AttributeModel attributeModel) {
public void top_tarjans(DirectedGraph graph, AttributeModel attributeModel) {
count = 1;
stronglyCount = 0;
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn componentCol = nodeTable.getColumn(STRONG);
Table nodeTable = attributeModel.getNodeTable();
Column componentCol = nodeTable.getColumn(STRONG);
if (componentCol == null) {
componentCol = nodeTable.addColumn(STRONG, "Strongly-Connected ID", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
componentCol = nodeTable.addColumn(STRONG, "Strongly-Connected ID", Integer.class, new Integer(0));
}
hgraph.readLock();
graph.readLock();
HashMap<Node, Integer> indicies = new HashMap<Node, Integer>();
int v = 0;
for (Node s : hgraph.getNodes()) {
for (Node s : graph.getNodes()) {
indicies.put(s, v);
v++;
}
int N = hgraph.getNodeCount();
int N = graph.getNodeCount();
int[] index = new int[N];
int[] low_index = new int[N];
@@ -223,7 +222,7 @@ public class ConnectedComponents implements Statistics, LongTask {
//LinkedList<Node> component = new LinkedList<Node>();
//Seed the seach Q
Node first = null;
NodeIterable iter = hgraph.getNodes();
NodeIterable iter = graph.getNodes();
for (Node u : iter) {
if (index[indicies.get(u)] == 0) {
first = u;
@@ -232,25 +231,25 @@ public class ConnectedComponents implements Statistics, LongTask {
}
}
if (first == null) {
hgraph.readUnlockAll();
graph.readUnlockAll();
return;
}
tarjans(componentCol, S, hgraph, first, index, low_index, indicies);
tarjans(componentCol, S, graph, first, index, low_index, indicies);
}
}
private void tarjans(AttributeColumn col, LinkedList<Node> S, HierarchicalDirectedGraph hgraph, Node f, int[] index, int[] low_index, HashMap<Node, Integer> indicies) {
private void tarjans(Column col, LinkedList<Node> S, DirectedGraph graph, Node f, int[] index, int[] low_index, HashMap<Node, Integer> indicies) {
int id = indicies.get(f);
index[id] = count;
low_index[id] = count;
count++;
S.addFirst(f);
EdgeIterable edgeIter = hgraph.getOutEdgesAndMetaOutEdges(f);
EdgeIterable edgeIter = graph.getOutEdges(f);
for (Edge e : edgeIter) {
Node u = hgraph.getOpposite(f, e);
Node u = graph.getOpposite(f, e);
int x = indicies.get(u);
if (index[x] == 0) {
tarjans(col, S, hgraph, u, index, low_index, indicies);
tarjans(col, S, graph, u, index, low_index, indicies);
low_index[id] = Math.min(low_index[x], low_index[id]);
} else if (S.contains(u)) {
low_index[id] = Math.min(low_index[id], index[x]);
@@ -260,8 +259,7 @@ public class ConnectedComponents implements Statistics, LongTask {
Node v = null;
while (v != f) {
v = S.removeFirst();
AttributeRow row = (AttributeRow) v.getNodeData().getAttributes();
row.setValue(col, stronglyCount);
v.setAttribute(col, stronglyCount);
}
stronglyCount++;
}
@@ -296,15 +294,16 @@ public class ConnectedComponents implements Statistics, LongTask {
return maxIndex;
}
@Override
public String getReport() {
Map<Integer, Integer> sizeDist = new HashMap<Integer, Integer>();
for(int v : componentsSize) {
if(!sizeDist.containsKey(v)) {
for (int v : componentsSize) {
if (!sizeDist.containsKey(v)) {
sizeDist.put(v, 0);
}
sizeDist.put(v, sizeDist.get(v) + 1);
}
//Distribution series
XYSeries dSeries = ChartUtils.createXYSeries(sizeDist, "Size Distribution");
@@ -327,7 +326,6 @@ public class ConnectedComponents implements Statistics, LongTask {
NumberFormat f = new DecimalFormat("#0.000");
String report = "<HTML> <BODY> <h1>Connected Components Report </h1> "
+ "<hr>"
+ "<br>"
@@ -336,7 +334,7 @@ public class ConnectedComponents implements Statistics, LongTask {
+ "<br> <h2> Results: </h2>"
+ "Number of Weakly Connected Components: " + componentCount + "<br>"
+ (isDirected ? "Number of Stronlgy Connected Components: " + stronglyCount + "<br>" : "")
+ "<br /><br />"+imageFile
+ "<br /><br />" + imageFile
+ "<br />" + "<h2> Algorithm: </h2>"
+ "Robert Tarjan, <i>Depth-First Search and Linear Graph Algorithms</i>, in SIAM Journal on Computing 1 (2): 146–160 (1972)<br />"
+ "</BODY> </HTML>";
@@ -344,11 +342,13 @@ public class ConnectedComponents implements Statistics, LongTask {
return report;
}
@Override
public boolean cancel() {
isCanceled = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
progress = progressTicket;
}
@@ -45,16 +45,13 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Origin;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
@@ -96,58 +93,47 @@ public class Degree implements Statistics, LongTask {
*
* @param graphModel
*/
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph graph = graphModel.getHierarchicalGraphVisible();
Graph graph = graphModel.getGraphVisible();
execute(graph, attributeModel);
}
public void execute(HierarchicalGraph graph, AttributeModel attributeModel) {
isDirected = graph instanceof DirectedGraph;
public void execute(Graph graph, AttributeModel attributeModel) {
isDirected = graph.isDirected();
isCanceled = false;
inDegreeDist = new HashMap<Integer, Integer>();
outDegreeDist = new HashMap<Integer, Integer>();
degreeDist = new HashMap<Integer, Integer>();
//Attributes cols
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeTable graphTable = attributeModel.getGraphTable();
AttributeColumn inCol = nodeTable.getColumn(INDEGREE);
AttributeColumn outCol = nodeTable.getColumn(OUTDEGREE);
AttributeColumn degCol = nodeTable.getColumn(DEGREE);
AttributeColumn avgDegreeCol = graphTable.getColumn(AVERAGE_DEGREE);
Table nodeTable = attributeModel.getNodeTable();
Column inCol = nodeTable.getColumn(INDEGREE);
Column outCol = nodeTable.getColumn(OUTDEGREE);
Column degCol = nodeTable.getColumn(DEGREE);
if (isDirected) {
if (inCol == null) {
inCol = nodeTable.addColumn(INDEGREE, NbBundle.getMessage(Degree.class, "Degree.nodecolumn.InDegree"), AttributeType.INT, AttributeOrigin.COMPUTED, 0);
inCol = nodeTable.addColumn(INDEGREE, NbBundle.getMessage(Degree.class, "Degree.nodecolumn.InDegree"), Integer.class, 0);
}
if (outCol == null) {
outCol = nodeTable.addColumn(OUTDEGREE, NbBundle.getMessage(Degree.class, "Degree.nodecolumn.OutDegree"), AttributeType.INT, AttributeOrigin.COMPUTED, 0);
outCol = nodeTable.addColumn(OUTDEGREE, NbBundle.getMessage(Degree.class, "Degree.nodecolumn.OutDegree"), Integer.class, 0);
}
}
if (degCol == null) {
degCol = nodeTable.addColumn(DEGREE, NbBundle.getMessage(Degree.class, "Degree.nodecolumn.Degree"), AttributeType.INT, AttributeOrigin.COMPUTED, 0);
degCol = nodeTable.addColumn(DEGREE, NbBundle.getMessage(Degree.class, "Degree.nodecolumn.Degree"), Integer.class, 0);
}
if(avgDegreeCol == null) {
avgDegreeCol = graphTable.addColumn(AVERAGE_DEGREE, NbBundle.getMessage(Degree.class, "Degree.graphcolumn.AverageDegree"), AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0);
}
int i = 0;
graph.readLock();
Progress.start(progress, graph.getNodeCount());
HierarchicalDirectedGraph directedGraph = null;
if(isDirected) {
directedGraph = graph.getGraphModel().getHierarchicalDirectedGraphVisible();
}
Progress.start(progress, graph.getNodeCount());
for (Node n : graph.getNodes()) {
AttributeRow row = (AttributeRow) n.getNodeData().getAttributes();
if (isDirected) {
int inDegree = directedGraph.getTotalInDegree(n);
int outDegree = directedGraph.getTotalOutDegree(n);
row.setValue(inCol, inDegree);
row.setValue(outCol, outDegree);
int inDegree = ((DirectedGraph)graph).getInDegree(n);
int outDegree = ((DirectedGraph)graph).getOutDegree(n);
n.setAttribute(inCol, inDegree);
n.setAttribute(outCol, outDegree);
if (!inDegreeDist.containsKey(inDegree)) {
inDegreeDist.put(inDegree, 0);
}
@@ -157,8 +143,8 @@ public class Degree implements Statistics, LongTask {
}
outDegreeDist.put(outDegree, outDegreeDist.get(outDegree) + 1);
}
int degree = graph.getTotalDegree(n);
row.setValue(degCol, degree);
int degree = graph.getDegree(n);
n.setAttribute(degCol, degree);
avgDegree += degree;
if (!degreeDist.containsKey(degree)) {
degreeDist.put(degree, 0);
@@ -168,20 +154,22 @@ public class Degree implements Statistics, LongTask {
if (isCanceled) {
break;
}
i++;
Progress.progress(progress, i);
Progress.progress(progress);
}
avgDegree /= graph.getNodeCount();
graph.getAttributes().setValue(avgDegreeCol.getIndex(), avgDegree);
graph.setAttribute(AVERAGE_DEGREE, avgDegree);
graph.readUnlockAll();
Progress.finish(progress);
}
/**
*
* @return
*/
@Override
public String getReport() {
String report = "";
if (isDirected) {
@@ -294,6 +282,7 @@ public class Degree implements Statistics, LongTask {
*
* @return
*/
@Override
public boolean cancel() {
this.isCanceled = true;
return true;
@@ -303,6 +292,7 @@ public class Degree implements Statistics, LongTask {
*
* @param progressTicket
*/
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
this.progress = progressTicket;
}
@@ -1,61 +1,57 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.EdgeIterable;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.HierarchicalUndirectedGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
@@ -79,23 +75,24 @@ public class EigenvectorCentrality implements Statistics, LongTask {
private double[] centralities;
private double sumChange;
private ProgressTicket progress;
/** */
/**
* */
private boolean isCanceled;
private boolean isDirected;
public EigenvectorCentrality() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
if (graphController != null && graphController.getGraphModel() != null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
public void setNumRuns(int numRuns) {
this.numRuns = numRuns;
}
/**
*
*
* @return
*/
public int getNumRuns() {
@@ -103,7 +100,7 @@ public class EigenvectorCentrality implements Statistics, LongTask {
}
/**
*
*
* @return
*/
public boolean isDirected() {
@@ -111,7 +108,7 @@ public class EigenvectorCentrality implements Statistics, LongTask {
}
/**
*
*
* @param isDirected
*/
public void setDirected(boolean isDirected) {
@@ -123,22 +120,26 @@ public class EigenvectorCentrality implements Statistics, LongTask {
* @param graphModel
* @param attributeModel
*/
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph graph = null;
isDirected = graphModel.isDirected();
isCanceled = false;
Graph graph;
if (isDirected) {
graph = graphModel.getHierarchicalDirectedGraphVisible();
graph = graphModel.getDirectedGraphVisible();
} else {
graph = graphModel.getHierarchicalUndirectedGraphVisible();
graph = graphModel.getUndirectedGraphVisible();
}
execute(graph, attributeModel);
}
public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {
public void execute(Graph hgraph, AttributeModel attributeModel) {
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn eigenCol = nodeTable.getColumn(EIGENVECTOR);
Table nodeTable = attributeModel.getNodeTable();
Column eigenCol = nodeTable.getColumn(EIGENVECTOR);
if (eigenCol == null) {
eigenCol = nodeTable.addColumn(EIGENVECTOR, "Eigenvector Centrality", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
eigenCol = nodeTable.addColumn(EIGENVECTOR, "Eigenvector Centrality", Double.class, new Double(0));
}
int N = hgraph.getNodeCount();
@@ -164,9 +165,9 @@ public class EigenvectorCentrality implements Statistics, LongTask {
Node u = indicies.get(i);
EdgeIterable iter = null;
if (isDirected) {
iter = ((HierarchicalDirectedGraph) hgraph).getInEdgesAndMetaInEdges(u);
iter = ((DirectedGraph) hgraph).getInEdges(u);
} else {
iter = ((HierarchicalUndirectedGraph) hgraph).getEdgesAndMetaEdges(u);
iter = hgraph.getEdges(u);
}
for (Edge e : iter) {
@@ -199,8 +200,7 @@ public class EigenvectorCentrality implements Statistics, LongTask {
for (int i = 0; i < N; i++) {
Node s = indicies.get(i);
AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
row.setValue(eigenCol, centralities[i]);
s.setAttribute(eigenCol, centralities[i]);
if (isCanceled) {
return;
}
@@ -211,9 +211,10 @@ public class EigenvectorCentrality implements Statistics, LongTask {
}
/**
*
*
* @return
*/
@Override
public String getReport() {
//distribution of values
Map<Double, Integer> dist = new HashMap<Double, Integer>();
@@ -246,7 +247,7 @@ public class EigenvectorCentrality implements Statistics, LongTask {
ChartUtils.decorateChart(chart);
ChartUtils.scaleChart(chart, dSeries, true);
String imageFile = ChartUtils.renderChart(chart, "eigenvector-centralities.png");
String report = "<HTML> <BODY> <h1>Eigenvector Centrality Report</h1> "
+ "<hr>"
+ "<h2> Parameters: </h2>"
@@ -261,11 +262,13 @@ public class EigenvectorCentrality implements Statistics, LongTask {
}
@Override
public boolean cancel() {
this.isCanceled = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
this.progress = progressTicket;
@@ -43,12 +43,10 @@ package org.gephi.statistics.plugin;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.graph.api.GraphController;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.statistics.spi.Statistics;
import org.openide.util.Lookup;
/**
*
@@ -61,13 +59,6 @@ public class GraphDensity implements Statistics {
/** */
private boolean isDirected;
public GraphDensity() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
}
}
public void setDirected(boolean isDirected) {
this.isDirected = isDirected;
}
@@ -80,17 +71,19 @@ public class GraphDensity implements Statistics {
return density;
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph hgraph;
isDirected = graphModel.isDirected();
Graph graph;
if (isDirected) {
hgraph = graphModel.getHierarchicalDirectedGraphVisible();
graph = graphModel.getDirectedGraphVisible();
} else {
hgraph = graphModel.getHierarchicalUndirectedGraphVisible();
graph = graphModel.getUndirectedGraphVisible();
}
double edgesCount = hgraph.getTotalEdgeCount();
double nodesCount = hgraph.getNodeCount();
double edgesCount = graph.getEdgeCount();
double nodesCount = graph.getNodeCount();
double multiplier = 1;
if (!isDirected) {
@@ -103,6 +96,7 @@ public class GraphDensity implements Statistics {
*
* @return
*/
@Override
public String getReport() {
NumberFormat f = new DecimalFormat("#0.000");
@@ -1,44 +1,44 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
import java.io.IOException;
@@ -49,12 +49,9 @@ import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map;
import java.util.Stack;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.utils.TempDirUtils;
import org.gephi.utils.TempDirUtils.TempDir;
import org.gephi.utils.longtask.spi.LongTask;
@@ -69,8 +66,8 @@ import org.openide.util.Exceptions;
import org.openide.util.Lookup;
/**
* Ref: Ulrik Brandes, A Faster Algorithm for Betweenness Centrality,
* in Journal of Mathematical Sociology 25(2):163-177, (2001)
* Ref: Ulrik Brandes, A Faster Algorithm for Betweenness Centrality, in Journal
* of Mathematical Sociology 25(2):163-177, (2001)
*
* @author pjmcswee
*/
@@ -79,75 +76,88 @@ public class GraphDistance implements Statistics, LongTask {
public static final String BETWEENNESS = "betweenesscentrality";
public static final String CLOSENESS = "closnesscentrality";
public static final String ECCENTRICITY = "eccentricity";
/** */
/**
* */
private double[] betweenness;
/** */
/**
* */
private double[] closeness;
/** */
/**
* */
private double[] eccentricity;
/** */
/**
* */
private int diameter;
private int radius;
/** */
/**
* */
private double avgDist;
/** */
/**
* */
private int N;
/** */
/**
* */
private boolean isDirected;
/** */
/**
* */
private ProgressTicket progress;
/** */
/**
* */
private boolean isCanceled;
private int shortestPaths;
private boolean isNormalized;
public GraphDistance() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
}
}
public double getPathLength() {
return avgDist;
}
/**
*
*
* @return
*/
public double getDiameter() {
return diameter;
}
public GraphDistance() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getGraphModel() != null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
/**
*
* @param graphModel
* @param attributeModel
*/
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph graph = null;
isDirected = graphModel.isDirected();
Graph graph = null;
if (isDirected) {
graph = graphModel.getHierarchicalDirectedGraphVisible();
graph = graphModel.getDirectedGraphVisible();
} else {
graph = graphModel.getHierarchicalUndirectedGraphVisible();
graph = graphModel.getUndirectedGraphVisible();
}
execute(graph, attributeModel);
}
public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {
public void execute(Graph hgraph, AttributeModel attributeModel) {
isCanceled = false;
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn eccentricityCol = nodeTable.getColumn(ECCENTRICITY);
AttributeColumn closenessCol = nodeTable.getColumn(CLOSENESS);
AttributeColumn betweenessCol = nodeTable.getColumn(BETWEENNESS);
Table nodeTable = attributeModel.getNodeTable();
Column eccentricityCol = nodeTable.getColumn(ECCENTRICITY);
Column closenessCol = nodeTable.getColumn(CLOSENESS);
Column betweenessCol = nodeTable.getColumn(BETWEENNESS);
if (eccentricityCol == null) {
eccentricityCol = nodeTable.addColumn(ECCENTRICITY, "Eccentricity", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
eccentricityCol = nodeTable.addColumn(ECCENTRICITY, "Eccentricity", Double.class, new Double(0));
}
if (closenessCol == null) {
closenessCol = nodeTable.addColumn(CLOSENESS, "Closeness Centrality", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
closenessCol = nodeTable.addColumn(CLOSENESS, "Closeness Centrality", Double.class, new Double(0));
}
if (betweenessCol == null) {
betweenessCol = nodeTable.addColumn(BETWEENNESS, "Betweenness Centrality", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
betweenessCol = nodeTable.addColumn(BETWEENNESS, "Betweenness Centrality", Double.class, new Double(0));
}
hgraph.readLock();
@@ -196,9 +206,9 @@ public class GraphDistance implements Statistics, LongTask {
EdgeIterable edgeIter = null;
if (isDirected) {
edgeIter = ((HierarchicalDirectedGraph) hgraph).getOutEdgesAndMetaOutEdges(v);
edgeIter = ((DirectedGraph) hgraph).getOutEdges(v);
} else {
edgeIter = hgraph.getEdgesAndMetaEdges(v);
edgeIter = hgraph.getEdges(v);
}
for (Edge edge : edgeIter) {
@@ -259,7 +269,6 @@ public class GraphDistance implements Statistics, LongTask {
avgDist /= shortestPaths;//mN * (mN - 1.0f);
for (Node s : hgraph.getNodes()) {
AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
int s_index = indicies.get(s);
if (!isDirected) {
@@ -269,9 +278,9 @@ public class GraphDistance implements Statistics, LongTask {
closeness[s_index] = (closeness[s_index] == 0) ? 0 : 1.0 / closeness[s_index];
betweenness[s_index] /= isDirected ? (N - 1) * (N - 2) : (N - 1) * (N - 2) / 2;
}
row.setValue(eccentricityCol, eccentricity[s_index]);
row.setValue(closenessCol, closeness[s_index]);
row.setValue(betweenessCol, betweenness[s_index]);
s.setAttribute(eccentricityCol, eccentricity[s_index]);
s.setAttribute(closenessCol, closeness[s_index]);
s.setAttribute(betweenessCol, betweenness[s_index]);
}
hgraph.readUnlock();
}
@@ -330,6 +339,7 @@ public class GraphDistance implements Statistics, LongTask {
*
* @return
*/
@Override
public String getReport() {
String htmlIMG1 = "";
String htmlIMG2 = "";
@@ -364,9 +374,10 @@ public class GraphDistance implements Statistics, LongTask {
}
/**
*
*
* @return
*/
@Override
public boolean cancel() {
this.isCanceled = true;
return true;
@@ -376,6 +387,7 @@ public class GraphDistance implements Statistics, LongTask {
*
* @param progressTicket
*/
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
this.progress = progressTicket;
}
@@ -1,62 +1,58 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.EdgeIterable;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.HierarchicalUndirectedGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
@@ -70,8 +66,8 @@ import org.jfree.data.xy.XYSeriesCollection;
import org.openide.util.Lookup;
/**
* Ref: Jon M. Kleinberg, Authoritative Sources in a Hyperlinked Environment,
* in Journal of the ACM 46 (5): 604–632 (1999)
* Ref: Jon M. Kleinberg, Authoritative Sources in a Hyperlinked Environment, in
* Journal of the ACM 46 (5): 604–632 (1999)
*
* @author pjmcswee
*/
@@ -91,8 +87,8 @@ public class Hits implements Statistics, LongTask {
public Hits() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
useUndirected = graphController.getModel().isUndirected();
if (graphController != null && graphController.getGraphModel() != null) {
useUndirected = graphController.getGraphModel().isUndirected();
}
}
@@ -101,24 +97,25 @@ public class Hits implements Statistics, LongTask {
}
/**
*
*
* @return
*/
public boolean getUndirected() {
return useUndirected;
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph graph = null;
Graph graph = null;
if (useUndirected) {
graph = graphModel.getHierarchicalUndirectedGraphVisible();
graph = graphModel.getUndirectedGraphVisible();
} else {
graph = graphModel.getHierarchicalDirectedGraphVisible();
graph = graphModel.getDirectedGraphVisible();
}
execute(graph, attributeModel);
}
public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {
public void execute(Graph hgraph, AttributeModel attributeModel) {
hgraph.readLock();
int N = hgraph.getNodeCount();
@@ -139,21 +136,20 @@ public class Hits implements Statistics, LongTask {
index++;
if (!useUndirected) {
if (((HierarchicalDirectedGraph) hgraph).getTotalOutDegree(node) > 0) {
if (((DirectedGraph) hgraph).getOutDegree(node) > 0) {
hub_list.add(node);
}
if (((HierarchicalDirectedGraph) hgraph).getTotalInDegree(node) > 0) {
if (((DirectedGraph) hgraph).getInDegree(node) > 0) {
auth_list.add(node);
}
} else {
if (((HierarchicalUndirectedGraph) hgraph).getTotalDegree(node) > 0) {
if (hgraph.getDegree(node) > 0) {
hub_list.add(node);
auth_list.add(node);
}
}
}
for (Node node : hub_list) {
int n_index = indicies.get(node);
hubs[n_index] = 1.0f;
@@ -173,9 +169,9 @@ public class Hits implements Statistics, LongTask {
temp_authority[n_index] = authority[n_index];
EdgeIterable edge_iter;
if (!useUndirected) {
edge_iter = ((HierarchicalDirectedGraph) hgraph).getInEdgesAndMetaInEdges(node);
edge_iter = ((DirectedGraph) hgraph).getInEdges(node);
} else {
edge_iter = ((HierarchicalUndirectedGraph) hgraph).getEdgesAndMetaEdges(node);
edge_iter = hgraph.getEdges(node);
}
for (Edge edge : edge_iter) {
Node target = hgraph.getOpposite(node, edge);
@@ -197,9 +193,9 @@ public class Hits implements Statistics, LongTask {
temp_hubs[n_index] = hubs[n_index];
EdgeIterable edge_iter;
if (!useUndirected) {
edge_iter = ((HierarchicalDirectedGraph) hgraph).getInEdgesAndMetaInEdges(node);
edge_iter = ((DirectedGraph) hgraph).getInEdges(node);
} else {
edge_iter = ((HierarchicalUndirectedGraph) hgraph).getEdgesAndMetaEdges(node);
edge_iter = hgraph.getEdges(node);
}
for (Edge edge : edge_iter) {
Node target = hgraph.getOpposite(node, edge);
@@ -227,7 +223,6 @@ public class Hits implements Statistics, LongTask {
}
}
authority = temp_authority;
hubs = temp_hubs;
temp_authority = new double[N];
@@ -238,21 +233,20 @@ public class Hits implements Statistics, LongTask {
}
}
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn authorityCol = nodeTable.getColumn(AUTHORITY);
AttributeColumn hubsCol = nodeTable.getColumn(HUB);
Table nodeTable = attributeModel.getNodeTable();
Column authorityCol = nodeTable.getColumn(AUTHORITY);
Column hubsCol = nodeTable.getColumn(HUB);
if (authorityCol == null) {
authorityCol = nodeTable.addColumn(AUTHORITY, "Authority", AttributeType.FLOAT, AttributeOrigin.COMPUTED, new Float(0));
authorityCol = nodeTable.addColumn(AUTHORITY, "Authority", Float.class, new Float(0));
}
if (hubsCol == null) {
hubsCol = nodeTable.addColumn(HUB, "Hub", AttributeType.FLOAT, AttributeOrigin.COMPUTED, new Float(0));
hubsCol = nodeTable.addColumn(HUB, "Hub", Float.class, new Float(0));
}
for (Node s : hgraph.getNodes()) {
int s_index = indicies.get(s);
AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
row.setValue(authorityCol, (float) authority[s_index]);
row.setValue(hubsCol, (float) hubs[s_index]);
s.setAttribute(authorityCol, (float) authority[s_index]);
s.setAttribute(hubsCol, (float) hubs[s_index]);
}
hgraph.readUnlockAll();
@@ -262,6 +256,7 @@ public class Hits implements Statistics, LongTask {
*
* @return
*/
@Override
public String getReport() {
//distribution of hub values
Map<Double, Integer> distHubs = new HashMap<Double, Integer>();
@@ -329,7 +324,6 @@ public class Hits implements Statistics, LongTask {
ChartUtils.scaleChart(chart2, dAuthsSeries, true);
String imageFile2 = ChartUtils.renderChart(chart2, "authorities.png");
String report = "<HTML> <BODY> <h1> HITS Metric Report </h1>"
+ "<hr>"
+ "<br />"
@@ -347,6 +341,7 @@ public class Hits implements Statistics, LongTask {
*
* @return
*/
@Override
public boolean cancel() {
isCanceled = true;
return true;
@@ -356,6 +351,7 @@ public class Hits implements Statistics, LongTask {
*
* @param progressTicket
*/
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
progress = progressTicket;
}
@@ -1,52 +1,54 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s): Thomas Aynaud <taynaud@gmail.com>
Contributor(s): Thomas Aynaud <taynaud@gmail.com>
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
import org.gephi.data.attributes.api.*;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalUndirectedGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
@@ -73,7 +75,7 @@ public class Modularity implements Statistics, LongTask {
private boolean isRandomized = false;
private boolean useWeight = true;
private double resolution = 1.;
public void setRandom(boolean isRandomized) {
this.isRandomized = isRandomized;
}
@@ -81,15 +83,15 @@ public class Modularity implements Statistics, LongTask {
public boolean getRandom() {
return isRandomized;
}
public void setUseWeight(boolean useWeight) {
public void setUseWeight(boolean useWeight) {
this.useWeight = useWeight;
}
public boolean getUseWeight() {
return useWeight;
}
public void setResolution(double resolution) {
this.resolution = resolution;
}
@@ -98,11 +100,13 @@ public class Modularity implements Statistics, LongTask {
return resolution;
}
@Override
public boolean cancel() {
this.isCanceled = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
this.progress = progressTicket;
}
@@ -126,7 +130,7 @@ public class Modularity implements Statistics, LongTask {
HashMap<Modularity.Community, Integer>[] nodeConnectionsCount;
HashMap<Node, Integer> map;
Community[] nodeCommunities;
HierarchicalUndirectedGraph graph;
Graph graph;
double[] weights;
double graphWeightSum;
LinkedList<ModEdge>[] topology;
@@ -134,7 +138,7 @@ public class Modularity implements Statistics, LongTask {
int N;
HashMap<Integer, Community> invMap;
CommunityStructure(HierarchicalUndirectedGraph hgraph) {
CommunityStructure(Graph hgraph) {
this.graph = hgraph;
N = hgraph.getNodeCount();
invMap = new HashMap<Integer, Community>();
@@ -156,12 +160,12 @@ public class Modularity implements Statistics, LongTask {
Community hidden = new Community(structure);
hidden.nodes.add(index);
invMap.put(index, hidden);
communities.add(nodeCommunities[index]);
communities.add(nodeCommunities[index]);
index++;
if (isCanceled) {
return;
}
}
}
for (Node node : hgraph.getNodes()) {
int node_index = map.get(node);
@@ -173,10 +177,10 @@ public class Modularity implements Statistics, LongTask {
}
int neighbor_index = map.get(neighbor);
float weight = 1;
if(useWeight) {
weight = hgraph.getEdge(node, neighbor).getWeight();
}
if (useWeight) {
weight = (float) hgraph.getEdge(node, neighbor).getWeight();
}
weights[node_index] += weight;
Modularity.ModEdge me = new ModEdge(node_index, neighbor_index, weight);
topology[node_index].add(me);
@@ -221,9 +225,6 @@ public class Modularity implements Statistics, LongTask {
nodeConnectionsCount[neighbor].put(to, neighCountEdgesTo + 1);
}
///////////////////
Modularity.Community adjCom = nodeCommunities[neighbor];
Float wEdgesto = adjCom.connectionsWeight.get(to);
@@ -232,7 +233,7 @@ public class Modularity implements Statistics, LongTask {
} else {
adjCom.connectionsWeight.put(to, wEdgesto + e.weight);
}
Integer cEdgesto = adjCom.connectionsCount.get(to);
if (cEdgesto == null) {
adjCom.connectionsCount.put(to, 1);
@@ -246,7 +247,7 @@ public class Modularity implements Statistics, LongTask {
} else {
nodeConnectionsWeight[node].put(adjCom, nodeEdgesTo + e.weight);
}
Integer nodeCountEdgesTo = nodeConnectionsCount[node].get(adjCom);
if (nodeCountEdgesTo == null) {
nodeConnectionsCount[node].put(adjCom, 1);
@@ -261,21 +262,20 @@ public class Modularity implements Statistics, LongTask {
} else {
to.connectionsWeight.put(adjCom, comEdgesto + e.weight);
}
Integer comCountEdgesto = to.connectionsCount.get(adjCom);
if (comCountEdgesto == null) {
to.connectionsCount.put(adjCom, 1);
} else {
to.connectionsCount.put(adjCom, comCountEdgesto + 1);
}
}
}
}
private void removeNodeFrom(int node, Community from) {
Community community = nodeCommunities[node];
for (ModEdge e : topology[node]) {
int neighbor = e.target;
@@ -304,9 +304,7 @@ public class Modularity implements Statistics, LongTask {
adjCom.connectionsWeight.put(community, oEdgesto - e.weight);
adjCom.connectionsCount.put(community, oCountEdgesto - 1);
}
if (node == neighbor) {
continue;
}
@@ -333,7 +331,6 @@ public class Modularity implements Statistics, LongTask {
nodeConnectionsCount[node].put(adjCom, nodeCountEgesTo - 1);
}
}
from.remove(new Integer(node));
}
@@ -367,13 +364,14 @@ public class Modularity implements Statistics, LongTask {
hidden.nodes.addAll(oldHidden.nodes);
}
newInvMap.put(index, hidden);
for(Modularity.Community adjCom : iter) {
for (Modularity.Community adjCom : iter) {
int target = communities.indexOf(adjCom);
float weight = com.connectionsWeight.get(adjCom);
if(target == index)
weightSum += 2.*weight;
else
if (target == index) {
weightSum += 2. * weight;
} else {
weightSum += weight;
}
ModEdge e = new ModEdge(index, target, weight);
newTopology[index].add(e);
}
@@ -403,6 +401,7 @@ public class Modularity implements Statistics, LongTask {
}
class Community {
double weightSum;
CommunityStructure structure;
LinkedList<Integer> nodes;
@@ -449,12 +448,13 @@ public class Modularity implements Statistics, LongTask {
}
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalUndirectedGraph hgraph = graphModel.getHierarchicalUndirectedGraphVisible();
Graph hgraph = graphModel.getUndirectedGraphVisible();
execute(hgraph, attributeModel);
}
public void execute(HierarchicalUndirectedGraph hgraph, AttributeModel attributeModel) {
public void execute(Graph hgraph, AttributeModel attributeModel) {
isCanceled = false;
Progress.start(progress);
Random rand = new Random();
@@ -483,12 +483,12 @@ public class Modularity implements Statistics, LongTask {
Community bestCommunity = null;
Community nodecom = structure.nodeCommunities[i];
Set<Community> iter = structure.nodeConnectionsWeight[i].keySet();
for(Community com : iter) {
for (Community com : iter) {
double qValue = q(i, com);
if (qValue > best) {
best = qValue;
bestCommunity = com;
}
}
}
if ((structure.nodeCommunities[i] != bestCommunity) && (bestCommunity != null)) {
structure.moveNodeTo(i, bestCommunity);
@@ -525,40 +525,39 @@ public class Modularity implements Statistics, LongTask {
}
for (Node node : hgraph.getNodes()) {
int index = structure.map.get(node);
if(useWeight) {
if (useWeight) {
degreeCount[comStructure[index]] += nodeDegrees[index];
} else {
degreeCount[comStructure[index]] += hgraph.getTotalDegree(node);
} else {
degreeCount[comStructure[index]] += hgraph.getDegree(node);
}
}
modularity = finalQ(comStructure, degreeCount, hgraph, attributeModel, totalWeight, 1.);
modularityResolution = finalQ(comStructure, degreeCount, hgraph, attributeModel, totalWeight, resolution);
hgraph.readUnlock();
}
private double finalQ(int[] struct, double[] degrees, HierarchicalUndirectedGraph hgraph, AttributeModel attributeModel, double totalWeight, double usedResolution) {
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn modCol = nodeTable.getColumn(MODULARITY_CLASS);
private double finalQ(int[] struct, double[] degrees, Graph hgraph, AttributeModel attributeModel, double totalWeight, double usedResolution) {
Table nodeTable = attributeModel.getNodeTable();
Column modCol = nodeTable.getColumn(MODULARITY_CLASS);
if (modCol == null) {
modCol = nodeTable.addColumn(MODULARITY_CLASS, "Modularity Class", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
modCol = nodeTable.addColumn(MODULARITY_CLASS, "Modularity Class", Integer.class, new Integer(0));
}
double res = 0;
double[] internal = new double[degrees.length];
for (Node n : hgraph.getNodes()) {
int n_index = structure.map.get(n);
AttributeRow row = (AttributeRow) n.getNodeData().getAttributes();
row.setValue(modCol, struct[n_index]);
n.setAttribute(modCol, struct[n_index]);
for (Node neighbor : hgraph.getNeighbors(n)) {
if (n == neighbor) {
continue;
}
int neigh_index = structure.map.get(neighbor);
if (struct[neigh_index] == struct[n_index]) {
if(useWeight) {
if (useWeight) {
internal[struct[neigh_index]] += hgraph.getEdge(n, neighbor).getWeight();
} else {
internal[struct[neigh_index]]++;
@@ -577,17 +576,18 @@ public class Modularity implements Statistics, LongTask {
return modularity;
}
@Override
public String getReport() {
//Distribution series
Map<Integer, Integer> sizeDist = new HashMap<Integer, Integer>();
for(Node n : structure.graph.getNodes()) {
Integer v = (Integer) n.getNodeData().getAttributes().getValue(MODULARITY_CLASS);
if(!sizeDist.containsKey(v)) {
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();
@@ -607,20 +607,19 @@ public class Modularity implements Statistics, LongTask {
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>"
+ "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 />" + 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>"
@@ -1,62 +1,59 @@
/*
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Patick J. McSweeney <pjmcswee@syr.edu>, Sebastien Heymann <seb@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.EdgeIterable;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.HierarchicalUndirectedGraph;
import org.gephi.graph.api.Node;
import org.gephi.graph.api.UndirectedGraph;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
import org.gephi.utils.progress.Progress;
@@ -69,32 +66,39 @@ import org.jfree.data.xy.XYSeriesCollection;
import org.openide.util.Lookup;
/**
* Ref: Sergey Brin, Lawrence Page, The Anatomy of a Large-Scale Hypertextual Web Search Engine,
* in Proceedings of the seventh International Conference on the World Wide Web (WWW1998):107-117
* Ref: Sergey Brin, Lawrence Page, The Anatomy of a Large-Scale Hypertextual
* Web Search Engine, in Proceedings of the seventh International Conference on
* the World Wide Web (WWW1998):107-117
*
* @author pjmcswee
*/
public class PageRank implements Statistics, LongTask {
public static final String PAGERANK = "pageranks";
/** */
/**
* */
private ProgressTicket progress;
/** */
/**
* */
private boolean isCanceled;
/** */
/**
* */
private double epsilon = 0.001;
/** */
/**
* */
private double probability = 0.85;
private boolean useEdgeWeight = false;
/** */
/**
* */
private double[] pageranks;
/** */
/**
* */
private boolean isDirected;
public PageRank() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
if (graphController != null && graphController.getGraphModel() != null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
@@ -110,17 +114,18 @@ public class PageRank implements Statistics, LongTask {
return isDirected;
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph graph;
Graph graph;
if (isDirected) {
graph = graphModel.getHierarchicalDirectedGraphVisible();
graph = graphModel.getDirectedGraphVisible();
} else {
graph = graphModel.getHierarchicalUndirectedGraphVisible();
graph = graphModel.getUndirectedGraphVisible();
}
execute(graph, attributeModel);
}
public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {
public void execute(Graph hgraph, AttributeModel attributeModel) {
isCanceled = false;
hgraph.readLock();
@@ -144,9 +149,9 @@ public class PageRank implements Statistics, LongTask {
double sum = 0;
EdgeIterable eIter;
if (isDirected) {
eIter = ((HierarchicalDirectedGraph) hgraph).getOutEdgesAndMetaOutEdges(s);
eIter = ((DirectedGraph) hgraph).getOutEdges(s);
} else {
eIter = ((HierarchicalUndirectedGraph) hgraph).getEdgesAndMetaEdges(s);
eIter = ((UndirectedGraph) hgraph).getEdges(s);
}
for (Edge edge : eIter) {
sum += edge.getWeight();
@@ -162,9 +167,9 @@ public class PageRank implements Statistics, LongTask {
int s_index = indicies.get(s);
boolean out;
if (isDirected) {
out = ((HierarchicalDirectedGraph) hgraph).getTotalOutDegree(s) > 0;
out = ((DirectedGraph) hgraph).getOutDegree(s) > 0;
} else {
out = hgraph.getTotalDegree(s) > 0;
out = hgraph.getDegree(s) > 0;
}
if (out) {
@@ -185,9 +190,9 @@ public class PageRank implements Statistics, LongTask {
EdgeIterable eIter;
if (isDirected) {
eIter = ((HierarchicalDirectedGraph) hgraph).getInEdgesAndMetaInEdges(s);
eIter = ((DirectedGraph) hgraph).getInEdges(s);
} else {
eIter = ((HierarchicalUndirectedGraph) hgraph).getEdgesAndMetaEdges(s);
eIter = hgraph.getEdges(s);
}
for (Edge edge : eIter) {
@@ -195,9 +200,9 @@ public class PageRank implements Statistics, LongTask {
int neigh_index = indicies.get(neighbor);
int normalize;
if (isDirected) {
normalize = ((HierarchicalDirectedGraph) hgraph).getTotalOutDegree(neighbor);
normalize = ((DirectedGraph) hgraph).getOutDegree(neighbor);
} else {
normalize = ((HierarchicalUndirectedGraph) hgraph).getTotalDegree(neighbor);
normalize = hgraph.getDegree(neighbor);
}
if (useEdgeWeight) {
double weight = edge.getWeight() / weights[neigh_index];
@@ -226,16 +231,15 @@ public class PageRank implements Statistics, LongTask {
}
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn pangeRanksCol = nodeTable.getColumn(PAGERANK);
Table nodeTable = attributeModel.getNodeTable();
Column pangeRanksCol = nodeTable.getColumn(PAGERANK);
if (pangeRanksCol == null) {
pangeRanksCol = nodeTable.addColumn(PAGERANK, "PageRank", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
pangeRanksCol = nodeTable.addColumn(PAGERANK, "PageRank", Double.class, new Double(0));
}
for (Node s : hgraph.getNodes()) {
int s_index = indicies.get(s);
AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
row.setValue(pangeRanksCol, pageranks[s_index]);
s.setAttribute(pangeRanksCol, pageranks[s_index]);
}
hgraph.readUnlockAll();
@@ -245,6 +249,7 @@ public class PageRank implements Statistics, LongTask {
*
* @return
*/
@Override
public String getReport() {
//distribution of values
Map<Double, Integer> dist = new HashMap<Double, Integer>();
@@ -277,7 +282,7 @@ public class PageRank implements Statistics, LongTask {
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>"
@@ -297,6 +302,7 @@ public class PageRank implements Statistics, LongTask {
*
* @return
*/
@Override
public boolean cancel() {
isCanceled = true;
return true;
@@ -306,6 +312,7 @@ public class PageRank implements Statistics, LongTask {
*
* @param progressTicket
*/
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
progress = progressTicket;
}
@@ -46,17 +46,12 @@ import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.spi.Statistics;
import org.gephi.utils.longtask.spi.LongTask;
@@ -89,31 +84,32 @@ public class WeightedDegree implements Statistics, LongTask {
return avgWDegree;
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
HierarchicalGraph graph = graphModel.getHierarchicalGraphVisible();
Graph graph = graphModel.getGraphVisible();
execute(graph, attributeModel);
}
public void execute(HierarchicalGraph graph, AttributeModel attributeModel) {
isDirected = graph instanceof DirectedGraph;
public void execute(Graph graph, AttributeModel attributeModel) {
isDirected = graph.isDirected();
isCanceled = false;
degreeDist = new HashMap<Double, Integer>();
inDegreeDist = new HashMap<Double, Integer>();
outDegreeDist = new HashMap<Double, Integer>();
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn degCol = nodeTable.getColumn(WDEGREE);
AttributeColumn inCol = nodeTable.getColumn(WINDEGREE);
AttributeColumn outCol = nodeTable.getColumn(WOUTDEGREE);
Table nodeTable = attributeModel.getNodeTable();
Column degCol = nodeTable.getColumn(WDEGREE);
Column inCol = nodeTable.getColumn(WINDEGREE);
Column outCol = nodeTable.getColumn(WOUTDEGREE);
if (degCol == null) {
degCol = nodeTable.addColumn(WDEGREE, "Weighted Degree", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0);
degCol = nodeTable.addColumn(WDEGREE, "Weighted Degree", Double.class, 0.0);
}
if (isDirected) {
if (inCol == null) {
inCol = nodeTable.addColumn(WINDEGREE, "Weighted In-Degree", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0);
inCol = nodeTable.addColumn(WINDEGREE, "Weighted In-Degree", Double.class, 0.0);
}
if (outCol == null) {
outCol = nodeTable.addColumn(WOUTDEGREE, "Weighted Out-Degree", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0);
outCol = nodeTable.addColumn(WOUTDEGREE, "Weighted Out-Degree", Double.class, 0.0);
}
}
@@ -123,24 +119,22 @@ public class WeightedDegree implements Statistics, LongTask {
int i = 0;
for (Node n : graph.getNodes()) {
AttributeRow row = (AttributeRow) n.getNodeData().getAttributes();
double totalWeight = 0;
if (isDirected) {
HierarchicalDirectedGraph hdg = graph.getGraphModel().getHierarchicalDirectedGraph();
double totalInWeight = 0;
double totalOutWeight = 0;
for (Iterator it = graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext();) {
for (Iterator it = graph.getEdges(n).iterator(); it.hasNext();) {
Edge e = (Edge) it.next();
if (e.getSource().getNodeData().equals(n.getNodeData())) {
if (e.getSource().equals(n)) {
totalOutWeight += e.getWeight();
}
if (e.getTarget().getNodeData().equals(n.getNodeData())) {
if (e.getTarget().equals(n)) {
totalInWeight += e.getWeight();
}
}
totalWeight = totalInWeight + totalOutWeight;
row.setValue(inCol, totalInWeight);
row.setValue(outCol, totalOutWeight);
n.setAttribute(inCol, totalInWeight);
n.setAttribute(outCol, totalOutWeight);
if (!inDegreeDist.containsKey(totalInWeight)) {
inDegreeDist.put(totalInWeight, 0);
}
@@ -150,13 +144,13 @@ public class WeightedDegree implements Statistics, LongTask {
}
outDegreeDist.put(totalOutWeight, outDegreeDist.get(totalOutWeight) + 1);
} else {
for (Iterator it = graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext();) {
for (Iterator it = graph.getEdges(n).iterator(); it.hasNext();) {
Edge e = (Edge) it.next();
totalWeight += e.getWeight();
}
}
row.setValue(degCol, totalWeight);
n.setAttribute(degCol, totalWeight);
avgWDegree += totalWeight;
if (!degreeDist.containsKey(totalWeight)) {
@@ -176,6 +170,7 @@ public class WeightedDegree implements Statistics, LongTask {
graph.readUnlockAll();
}
@Override
public String getReport() {
String report = "";
@@ -282,11 +277,13 @@ public class WeightedDegree implements Statistics, LongTask {
return report;
}
@Override
public boolean cancel() {
this.isCanceled = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
this.progress = progressTicket;
}
@@ -38,31 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.ClusteringCoefficient;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service=StatisticsBuilder.class)
public class ClusteringCoefficientBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(ClusteringCoefficientBuilder.class, "ClusteringCoefficent.name");
}
public Statistics getStatistics() {
return new ClusteringCoefficient();
}
public Class<? extends Statistics> getStatisticsClass() {
return ClusteringCoefficient.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.ClusteringCoefficient;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service=StatisticsBuilder.class)
public class ClusteringCoefficientBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(ClusteringCoefficientBuilder.class, "ClusteringCoefficent.name");
}
@Override
public Statistics getStatistics() {
return new ClusteringCoefficient();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return ClusteringCoefficient.class;
}
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service=StatisticsBuilder.class)
public class ConnectedComponentsBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(ConnectedComponentsBuilder.class, "ConnectedComponents.name");
}
@Override
public Statistics getStatistics() {
return new ConnectedComponents();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return ConnectedComponents.class;
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsBuilder.class)
public class DegreeBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(DegreeBuilder.class, "InOutDegree.name");
}
@Override
public Statistics getStatistics() {
return new Degree();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return Degree.class;
}
@@ -38,31 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.GraphDensity;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* The statistics builder the graph denstiy statistics
* @author pjmcswee
*/
@ServiceProvider(service=StatisticsBuilder.class)
public class DensityBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(DensityBuilder.class, "GraphDensity.name");
}
public Statistics getStatistics() {
return new GraphDensity();
}
public Class<? extends Statistics> getStatisticsClass() {
return GraphDensity.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.GraphDensity;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* The statistics builder the graph denstiy statistics
* @author pjmcswee
*/
@ServiceProvider(service=StatisticsBuilder.class)
public class DensityBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(DensityBuilder.class, "GraphDensity.name");
}
@Override
public Statistics getStatistics() {
return new GraphDensity();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return GraphDensity.class;
}
}
@@ -38,32 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.EigenvectorCentrality;
import org.gephi.statistics.plugin.Hits;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class EigenvectorCentralityBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(HitsBuilder.class, "EigenvectorCentrality.name");
}
public Statistics getStatistics() {
return new EigenvectorCentrality();
}
public Class<? extends Statistics> getStatisticsClass() {
return EigenvectorCentrality.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.EigenvectorCentrality;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class EigenvectorCentralityBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(HitsBuilder.class, "EigenvectorCentrality.name");
}
@Override
public Statistics getStatistics() {
return new EigenvectorCentrality();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return EigenvectorCentrality.class;
}
}
@@ -38,31 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.GraphDistance;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service=StatisticsBuilder.class)
public class GraphDistanceBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(GraphDistanceBuilder.class, "GraphDistance.name");
}
public Statistics getStatistics() {
return new GraphDistance();
}
public Class<? extends Statistics> getStatisticsClass() {
return GraphDistance.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.GraphDistance;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service=StatisticsBuilder.class)
public class GraphDistanceBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(GraphDistanceBuilder.class, "GraphDistance.name");
}
@Override
public Statistics getStatistics() {
return new GraphDistance();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return GraphDistance.class;
}
}
@@ -38,31 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.Hits;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class HitsBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(HitsBuilder.class, "Hits.name");
}
public Statistics getStatistics() {
return new Hits();
}
public Class<? extends Statistics> getStatisticsClass() {
return Hits.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.Hits;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class HitsBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(HitsBuilder.class, "Hits.name");
}
@Override
public Statistics getStatistics() {
return new Hits();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return Hits.class;
}
}
@@ -38,31 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.Modularity;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class ModularityBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(ModularityBuilder.class, "Modularity.name");
}
public Statistics getStatistics() {
return new Modularity();
}
public Class<? extends Statistics> getStatisticsClass() {
return Modularity.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.Modularity;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class ModularityBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(ModularityBuilder.class, "Modularity.name");
}
@Override
public Statistics getStatistics() {
return new Modularity();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return Modularity.class;
}
}
@@ -38,31 +38,34 @@ made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.PageRank;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class PageRankBuilder implements StatisticsBuilder {
public String getName() {
return NbBundle.getMessage(PageRankBuilder.class, "PageRank.name");
}
public Statistics getStatistics() {
return new PageRank();
}
public Class<? extends Statistics> getStatisticsClass() {
return PageRank.class;
}
}
*/
package org.gephi.statistics.plugin.builder;
import org.gephi.statistics.plugin.PageRank;
import org.gephi.statistics.spi.Statistics;
import org.gephi.statistics.spi.StatisticsBuilder;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author pjmcswee
*/
@ServiceProvider(service = StatisticsBuilder.class)
public class PageRankBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(PageRankBuilder.class, "PageRank.name");
}
@Override
public Statistics getStatistics() {
return new PageRank();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return PageRank.class;
}
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsBuilder.class)
public class WeightedDegreeBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(WeightedDegreeBuilder.class, "WeightedDegree.name");
}
@Override
public Statistics getStatistics() {
return new WeightedDegree();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return WeightedDegree.class;
}
@@ -45,19 +45,15 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.type.DynamicDouble;
import org.gephi.data.attributes.type.Interval;
import org.gephi.dynamic.api.DynamicController;
import org.gephi.dynamic.api.DynamicModel;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.attribute.time.Interval;
import org.gephi.attribute.time.TimestampDoubleSet;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.plugin.ChartUtils;
import org.gephi.statistics.plugin.ClusteringCoefficient;
@@ -90,48 +86,38 @@ public class DynamicClusteringCoefficient implements DynamicStatistics, LongTask
private boolean cancel = false;
private ClusteringCoefficient clusteringCoefficientStat;
//Cols
private AttributeColumn dynamicCoefficientColumn;
private Column dynamicCoefficientColumn;
//Average
private AttributeColumn dynamicAverageCoefficientColumn;
private DynamicDouble averages;
private Column dynamicAverageCoefficientColumn;
private Map<Double, Double> averages;
public DynamicClusteringCoefficient() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
if (graphController != null && graphController.getGraphModel()!= null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
this.graphModel = graphModel;
this.isDirected = graphModel.isDirected();
this.averages = new HashMap<Double, Double>();
//Attributes cols
if (!averageOnly) {
AttributeTable nodeTable = attributeModel.getNodeTable();
Table nodeTable = attributeModel.getNodeTable();
dynamicCoefficientColumn = nodeTable.getColumn(DYNAMIC_CLUSTERING_COEFFICIENT);
if (dynamicCoefficientColumn == null) {
dynamicCoefficientColumn = nodeTable.addColumn(DYNAMIC_CLUSTERING_COEFFICIENT, NbBundle.getMessage(DynamicClusteringCoefficient.class, "DynamicClusteringCoefficient.nodecolumn.ClusteringCoefficient"), AttributeType.DYNAMIC_DOUBLE, AttributeOrigin.COMPUTED, new DynamicDouble());
dynamicCoefficientColumn = nodeTable.addColumn(DYNAMIC_CLUSTERING_COEFFICIENT, NbBundle.getMessage(DynamicClusteringCoefficient.class, "DynamicClusteringCoefficient.nodecolumn.ClusteringCoefficient"), TimestampDoubleSet.class, null);
}
}
//Column
AttributeTable graphTable = attributeModel.getGraphTable();
dynamicAverageCoefficientColumn = graphTable.getColumn(DYNAMIC_AVG_CLUSTERING_COEFFICIENT);
if (dynamicAverageCoefficientColumn == null) {
dynamicAverageCoefficientColumn = graphTable.addColumn(DYNAMIC_AVG_CLUSTERING_COEFFICIENT, NbBundle.getMessage(DynamicClusteringCoefficient.class, "DynamicClusteringCoefficient.graphcolumn.AvgClusteringCoefficient"), AttributeType.DYNAMIC_DOUBLE, AttributeOrigin.COMPUTED, new DynamicDouble());
}
}
@Override
public String getReport() {
//Transform to Map
Map<Double, Double> map = new HashMap<Double, Double>();
for (Interval<Double> interval : averages.getIntervals()) {
map.put(interval.getLow(), interval.getValue());
}
//Time series
XYSeries dSeries = ChartUtils.createXYSeries(map, "Clustering Coefficient Time Series");
XYSeries dSeries = ChartUtils.createXYSeries(averages, "Clustering Coefficient Time Series");
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
@@ -168,12 +154,13 @@ public class DynamicClusteringCoefficient implements DynamicStatistics, LongTask
return report;
}
@Override
public void loop(GraphView window, Interval interval) {
HierarchicalGraph graph = null;
Graph graph = null;
if (isDirected) {
graph = graphModel.getHierarchicalDirectedGraph(window);
graph = graphModel.getDirectedGraph(window);
} else {
graph = graphModel.getHierarchicalUndirectedGraph(window);
graph = graphModel.getUndirectedGraph(window);
}
graph.readLock();
@@ -188,14 +175,10 @@ public class DynamicClusteringCoefficient implements DynamicStatistics, LongTask
int i = 0;
for (Node n : graph.getNodes()) {
double coef = coefficients[i++];
Interval<Double> valInterval = new Interval<Double>(interval, coef);
DynamicDouble val = (DynamicDouble) n.getAttributes().getValue(dynamicCoefficientColumn.getIndex());
if (val == null) {
val = new DynamicDouble(valInterval);
} else {
val = new DynamicDouble(val, valInterval);
}
n.getAttributes().setValue(dynamicCoefficientColumn.getIndex(), val);
n.setAttribute(dynamicCoefficientColumn, coef, interval.getLow());
n.setAttribute(dynamicCoefficientColumn, coef, interval.getHigh());
if (cancel) {
break;
}
@@ -206,36 +189,44 @@ public class DynamicClusteringCoefficient implements DynamicStatistics, LongTask
//Average
double avg = clusteringCoefficientStat.getAverageClusteringCoefficient();
graph.setAttribute(DYNAMIC_AVG_CLUSTERING_COEFFICIENT, avg, interval.getLow());
graph.setAttribute(DYNAMIC_AVG_CLUSTERING_COEFFICIENT, avg, interval.getHigh());
averages = new DynamicDouble(averages, new Interval<Double>(interval.getLow(), interval.getHigh(), false, true, avg));
averages.put(interval.getLow(), avg);
averages.put(interval.getHigh(), avg);
}
@Override
public void end() {
clusteringCoefficientStat = null;
graphModel.getGraphVisible().getAttributes().setValue(dynamicAverageCoefficientColumn.getIndex(), averages);
}
@Override
public void setBounds(Interval bounds) {
this.bounds = bounds;
}
@Override
public void setWindow(double window) {
this.window = window;
}
@Override
public void setTick(double tick) {
this.tick = tick;
}
@Override
public double getWindow() {
return window;
}
@Override
public double getTick() {
return tick;
}
@Override
public Interval getBounds() {
return bounds;
}
@@ -256,11 +247,13 @@ public class DynamicClusteringCoefficient implements DynamicStatistics, LongTask
return averageOnly;
}
@Override
public boolean cancel() {
cancel = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
}
}
@@ -1,43 +1,43 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.dynamic;
@@ -45,19 +45,17 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.type.DynamicDouble;
import org.gephi.data.attributes.type.DynamicInteger;
import org.gephi.data.attributes.type.Interval;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.attribute.time.Interval;
import org.gephi.attribute.time.TimestampDoubleSet;
import org.gephi.attribute.time.TimestampIntegerSet;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.HierarchicalDirectedGraph;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Node;
import org.gephi.statistics.plugin.ChartUtils;
import org.gephi.statistics.spi.DynamicStatistics;
@@ -90,60 +88,49 @@ public class DynamicDegree implements DynamicStatistics, LongTask {
private boolean averageOnly;
private boolean cancel = false;
//Cols
private AttributeColumn dynamicInDegreeColumn;
private AttributeColumn dynamicOutDegreeColumn;
private AttributeColumn dynamicDegreeColumn;
private Column dynamicInDegreeColumn;
private Column dynamicOutDegreeColumn;
private Column dynamicDegreeColumn;
//Average
private AttributeColumn dynamicAverageDegreeColumn;
private DynamicDouble averages;
private Map<Double, Double> averages;
public DynamicDegree() {
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController != null && graphController.getModel() != null) {
isDirected = graphController.getModel().isDirected();
if (graphController != null && graphController.getGraphModel() != null) {
isDirected = graphController.getGraphModel().isDirected();
}
}
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
this.graphModel = graphModel;
this.isDirected = graphModel.isDirected();
this.averages = new HashMap<Double, Double>();
//Attributes cols
if (!averageOnly) {
AttributeTable nodeTable = attributeModel.getNodeTable();
Table nodeTable = attributeModel.getNodeTable();
dynamicInDegreeColumn = nodeTable.getColumn(DYNAMIC_INDEGREE);
dynamicOutDegreeColumn = nodeTable.getColumn(DYNAMIC_OUTDEGREE);
dynamicDegreeColumn = nodeTable.getColumn(DYNAMIC_DEGREE);
if (isDirected) {
if (dynamicInDegreeColumn == null) {
dynamicInDegreeColumn = nodeTable.addColumn(DYNAMIC_INDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.InDegree"), AttributeType.DYNAMIC_INT, AttributeOrigin.COMPUTED, new DynamicInteger());
dynamicInDegreeColumn = nodeTable.addColumn(DYNAMIC_INDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.InDegree"), TimestampIntegerSet.class, null);
}
if (dynamicOutDegreeColumn == null) {
dynamicOutDegreeColumn = nodeTable.addColumn(DYNAMIC_OUTDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.OutDegree"), AttributeType.DYNAMIC_INT, AttributeOrigin.COMPUTED, new DynamicInteger());
dynamicOutDegreeColumn = nodeTable.addColumn(DYNAMIC_OUTDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.OutDegree"), TimestampIntegerSet.class, null);
}
}
if (dynamicDegreeColumn == null) {
dynamicDegreeColumn = nodeTable.addColumn(DYNAMIC_DEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.Degree"), AttributeType.DYNAMIC_INT, AttributeOrigin.COMPUTED, new DynamicInteger());
dynamicDegreeColumn = nodeTable.addColumn(DYNAMIC_DEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.Degree"), TimestampIntegerSet.class, null);
}
}
//Avg Column
AttributeTable graphTable = attributeModel.getGraphTable();
dynamicAverageDegreeColumn = graphTable.getColumn(DYNAMIC_AVGDEGREE);
if (dynamicAverageDegreeColumn == null) {
dynamicAverageDegreeColumn = graphTable.addColumn(DYNAMIC_AVGDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.graphcolumn.AvgDegree"), AttributeType.DYNAMIC_DOUBLE, AttributeOrigin.COMPUTED, new DynamicDouble());
}
}
@Override
public String getReport() {
//Transform to Map
Map<Double, Double> map = new HashMap<Double, Double>();
for (Interval<Double> interval : averages.getIntervals()) {
map.put(interval.getLow(), interval.getValue());
}
//Time series
XYSeries dSeries = ChartUtils.createXYSeries(map, "Degree Time Series");
XYSeries dSeries = ChartUtils.createXYSeries(averages, "Degree Time Series");
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
@@ -174,53 +161,33 @@ public class DynamicDegree implements DynamicStatistics, LongTask {
+ "<br /><br />" + degreeImageFile;
/*for (Interval<Double> averages : averages) {
report += averages.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />";
}*/
report += averages.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />";
}*/
report += "<br /><br /></BODY></HTML>";
return report;
}
@Override
public void loop(GraphView window, Interval interval) {
HierarchicalGraph graph = graphModel.getHierarchicalGraph(window);
HierarchicalDirectedGraph directedGraph = null;
Graph graph = graphModel.getGraph(window);
DirectedGraph directedGraph = null;
if (isDirected) {
directedGraph = graphModel.getHierarchicalDirectedGraph(window);
directedGraph = graphModel.getDirectedGraph(window);
}
long sum = 0;
for (Node n : graph.getNodes().toArray()) {
int degree = graph.getTotalDegree(n);
int degree = graph.getDegree(n);
if (!averageOnly) {
Interval<Integer> degreeInInterval = new Interval<Integer>(interval, degree);
DynamicInteger val = (DynamicInteger) n.getAttributes().getValue(dynamicDegreeColumn.getIndex());
if (val == null) {
val = new DynamicInteger(degreeInInterval);
} else {
val = new DynamicInteger(val, degreeInInterval);
}
n.getAttributes().setValue(dynamicDegreeColumn.getIndex(), val);
n.setAttribute(dynamicDegreeColumn, degree, interval.getLow());
if (isDirected) {
int indegree = directedGraph.getTotalInDegree(n);
Interval<Integer> inDegreeInInterval = new Interval<Integer>(interval, indegree);
DynamicInteger inVal = (DynamicInteger) n.getAttributes().getValue(dynamicInDegreeColumn.getIndex());
if (inVal == null) {
inVal = new DynamicInteger(inDegreeInInterval);
} else {
inVal = new DynamicInteger(inVal, inDegreeInInterval);
}
n.getAttributes().setValue(dynamicInDegreeColumn.getIndex(), inVal);
int indegree = directedGraph.getInDegree(n);
n.setAttribute(dynamicInDegreeColumn, indegree, interval.getLow());
int outdegree = directedGraph.getTotalOutDegree(n);
Interval<Integer> outDegreeInInterval = new Interval<Integer>(interval, outdegree);
DynamicInteger outVal = (DynamicInteger) n.getAttributes().getValue(dynamicOutDegreeColumn.getIndex());
if (outVal == null) {
outVal = new DynamicInteger(outDegreeInInterval);
} else {
outVal = new DynamicInteger(outVal, outDegreeInInterval);
}
n.getAttributes().setValue(dynamicOutDegreeColumn.getIndex(), outVal);
int outdegree = directedGraph.getOutDegree(n);
n.setAttribute(dynamicOutDegreeColumn, outdegree, interval.getLow());
}
}
sum += degree;
@@ -230,34 +197,43 @@ public class DynamicDegree implements DynamicStatistics, LongTask {
}
double avg = sum / (double) graph.getNodeCount();
averages = new DynamicDouble(averages, new Interval<Double>(interval.getLow(), interval.getHigh(), false, true, avg));
averages.put(interval.getLow(), avg);
averages.put(interval.getHigh(), avg);
graph.setAttribute(DYNAMIC_AVGDEGREE, avg, interval.getLow());
graph.setAttribute(DYNAMIC_AVGDEGREE, avg, interval.getHigh());
}
@Override
public void end() {
graphModel.getGraphVisible().getAttributes().setValue(dynamicAverageDegreeColumn.getIndex(), averages);
}
@Override
public void setBounds(Interval bounds) {
this.bounds = bounds;
}
@Override
public void setWindow(double window) {
this.window = window;
}
@Override
public void setTick(double tick) {
this.tick = tick;
}
@Override
public double getWindow() {
return window;
}
@Override
public double getTick() {
return tick;
}
@Override
public Interval getBounds() {
return bounds;
}
@@ -278,11 +254,13 @@ public class DynamicDegree implements DynamicStatistics, LongTask {
return averageOnly;
}
@Override
public boolean cancel() {
cancel = true;
return true;
}
@Override
public void setProgressTicket(ProgressTicket progressTicket) {
}
}
@@ -45,16 +45,11 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.type.DynamicInteger;
import org.gephi.data.attributes.type.Interval;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.time.Interval;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.statistics.plugin.ChartUtils;
import org.gephi.statistics.spi.DynamicStatistics;
import org.jfree.chart.ChartFactory;
@@ -62,7 +57,6 @@ import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.openide.util.NbBundle;
/**
*
@@ -77,29 +71,18 @@ public class DynamicNbEdges implements DynamicStatistics {
private double tick;
private Interval bounds;
//Average
private AttributeColumn nbEdgesCol;
private DynamicInteger counts;
private Map<Double, Integer> counts;
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
this.graphModel = graphModel;
//Column
AttributeTable graphTable = attributeModel.getGraphTable();
nbEdgesCol = graphTable.getColumn(NB_EDGES);
if (nbEdgesCol == null) {
nbEdgesCol = graphTable.addColumn(NB_EDGES, NbBundle.getMessage(DynamicNbEdges.class, "DynamicNbNodes.graphcolumn.NbEdges"), AttributeType.DYNAMIC_INT, AttributeOrigin.COMPUTED, new DynamicInteger());
}
this.counts = new HashMap<Double, Integer>();
}
@Override
public String getReport() {
//Transform to Map
Map<Double, Integer> map = new HashMap<Double, Integer>();
for(Interval<Integer> interval : counts.getIntervals()) {
map.put(interval.getLow(), interval.getValue());
}
//Time series
XYSeries dSeries = ChartUtils.createXYSeries(map, "Nb Edges Time Series");
XYSeries dSeries = ChartUtils.createXYSeries(counts, "Nb Edges Time Series");
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
@@ -136,38 +119,48 @@ public class DynamicNbEdges implements DynamicStatistics {
return report;
}
@Override
public void loop(GraphView window, Interval interval) {
HierarchicalGraph graph = graphModel.getHierarchicalGraph(window);
Graph graph = graphModel.getGraph(window);
int count = graph.getEdgeCount();
graph.setAttribute(NB_EDGES, count, interval.getLow());
graph.setAttribute(NB_EDGES, count, interval.getHigh());
counts = new DynamicInteger(counts, new Interval<Integer>(interval.getLow(), interval.getHigh(), false, true, count));
counts.put(interval.getLow(), count);
counts.put(interval.getHigh(), count);
}
@Override
public void end() {
graphModel.getGraphVisible().getAttributes().setValue(nbEdgesCol.getIndex(), counts);
}
public void setBounds(Interval bounds) {
this.bounds = bounds;
}
@Override
public void setWindow(double window) {
this.window = window;
}
@Override
public void setTick(double tick) {
this.tick = tick;
}
@Override
public double getWindow() {
return window;
}
@Override
public double getTick() {
return tick;
}
@Override
public Interval getBounds() {
return bounds;
}
@@ -1,43 +1,43 @@
/*
Copyright 2008-2011 Gephi
Authors : Sébastien Heymann <sebastien.heymann@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2011 Gephi
Authors : Sébastien Heymann <sebastien.heymann@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.statistics.plugin.dynamic;
@@ -45,16 +45,11 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.type.DynamicInteger;
import org.gephi.data.attributes.type.Interval;
import org.gephi.attribute.api.AttributeModel;
import org.gephi.attribute.time.Interval;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.statistics.plugin.ChartUtils;
import org.gephi.statistics.spi.DynamicStatistics;
import org.jfree.chart.ChartFactory;
@@ -62,7 +57,6 @@ import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.openide.util.NbBundle;
/**
*
@@ -77,31 +71,18 @@ public class DynamicNbNodes implements DynamicStatistics {
private double tick;
private Interval bounds;
//Average
private AttributeColumn nbNodesCol;
private DynamicInteger counts;
private Map<Double, Integer> counts;
@Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
this.graphModel = graphModel;
//Column
AttributeTable graphTable = attributeModel.getGraphTable();
nbNodesCol = graphTable.getColumn(NB_NODES);
if (nbNodesCol == null) {
nbNodesCol = graphTable.addColumn(NB_NODES, NbBundle.getMessage(DynamicNbNodes.class, "DynamicNbNodes.graphcolumn.NbNodes"), AttributeType.DYNAMIC_INT, AttributeOrigin.COMPUTED, new DynamicInteger());
}
counts = new DynamicInteger();
graphModel.getGraphVisible().getAttributes().setValue(nbNodesCol.getIndex(), counts);
this.counts = new HashMap<Double, Integer>();
}
@Override
public String getReport() {
//Transform to Map
Map<Double, Integer> map = new HashMap<Double, Integer>();
for (Interval<Integer> interval : counts.getIntervals()) {
map.put(interval.getLow(), interval.getValue());
}
//Time series
XYSeries dSeries = ChartUtils.createXYSeries(map, "Nb Nodes Time Series");
XYSeries dSeries = ChartUtils.createXYSeries(counts, "Nb Nodes Time Series");
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(dSeries);
@@ -132,44 +113,55 @@ public class DynamicNbNodes implements DynamicStatistics {
+ "<br /><br />" + imageFile;
/*for (Interval<Integer> count : counts) {
report += count.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />";
}*/
report += count.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />";
}*/
report += "<br /><br /></BODY></HTML>";
return report;
}
@Override
public void loop(GraphView window, Interval interval) {
HierarchicalGraph graph = graphModel.getHierarchicalGraph(window);
Graph graph = graphModel.getGraph(window);
int count = graph.getNodeCount();
counts = new DynamicInteger(counts, new Interval<Integer>(interval.getLow(), interval.getHigh(), false, true, count));
graph.setAttribute(NB_NODES, count, interval.getLow());
graph.setAttribute(NB_NODES, count, interval.getHigh());
counts.put(interval.getLow(), count);
counts.put(interval.getHigh(), count);
}
@Override
public void end() {
graphModel.getGraphVisible().getAttributes().setValue(nbNodesCol.getIndex(), counts);
}
@Override
public void setBounds(Interval bounds) {
this.bounds = bounds;
}
@Override
public void setWindow(double window) {
this.window = window;
}
@Override
public void setTick(double tick) {
this.tick = tick;
}
@Override
public double getWindow() {
return window;
}
@Override
public double getTick() {
return tick;
}
@Override
public Interval getBounds() {
return bounds;
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsBuilder.class)
public class DynamicClusteringCoefficientBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(DynamicClusteringCoefficientBuilder.class, "DynamicClusteringCoefficient.name");
}
@Override
public Statistics getStatistics() {
return new DynamicClusteringCoefficient();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return DynamicClusteringCoefficient.class;
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsBuilder.class)
public class DynamicDegreeBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(DynamicDegreeBuilder.class, "DynamicDegree.name");
}
@Override
public Statistics getStatistics() {
return new DynamicDegree();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return DynamicDegree.class;
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsBuilder.class)
public class DynamicNbEdgesBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(DynamicNbNodesBuilder.class, "DynamicNbEdges.name");
}
@Override
public Statistics getStatistics() {
return new DynamicNbEdges();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return DynamicNbEdges.class;
}
@@ -54,14 +54,17 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = StatisticsBuilder.class)
public class DynamicNbNodesBuilder implements StatisticsBuilder {
@Override
public String getName() {
return NbBundle.getMessage(DynamicNbNodesBuilder.class, "DynamicNbNodes.name");
}
@Override
public Statistics getStatistics() {
return new DynamicNbNodes();
}
@Override
public Class<? extends Statistics> getStatisticsClass() {
return DynamicNbNodes.class;
}
-4
Ver Arquivo
@@ -16,10 +16,6 @@
<name>StatisticsPluginUI</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dynamic-api</artifactId>
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -29,7 +29,7 @@
<Component id="undirectedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="directedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="519" max="32767" attributes="0"/>
<EmptySpace pref="532" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -55,7 +55,7 @@ public class ClusteringCoefficientPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -113,7 +113,7 @@ public class ClusteringCoefficientPanel extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(undirectedRadioButton)
.addComponent(directedRadioButton))
.addContainerGap(519, Short.MAX_VALUE))
.addContainerGap(532, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -27,7 +27,7 @@
<Component id="directedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="undirectedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="26" max="32767" attributes="0"/>
<EmptySpace pref="39" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel2" max="32767" attributes="1"/>
<Component id="jLabel1" alignment="0" pref="420" max="32767" attributes="1"/>
@@ -56,7 +56,7 @@ public class ConnectedComponentPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -115,7 +115,7 @@ public class ConnectedComponentPanel extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(directedRadioButton)
.addComponent(undirectedRadioButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)))
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -76,11 +76,11 @@
</Component>
<Component class="org.jdesktop.swingx.JXLabel" name="descriptionLabel">
<Properties>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="DegreeDistributionPanel.descriptionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="verticalAlignment" type="int" value="1"/>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="org.jdesktop.swingx.JXHeader" name="header">
@@ -55,7 +55,7 @@ public class DegreeDistributionPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -103,7 +103,7 @@ public class DegreeDistributionPanel extends javax.swing.JPanel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -121,7 +121,7 @@ public class DegreeDistributionPanel extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(undirectedRadioButton)
.addGap(96, 96, 96)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 2, Short.MAX_VALUE)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -21,22 +21,18 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="header" alignment="0" pref="541" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="directedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="439" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="undirectedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="422" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Component id="iterationTextField" min="-2" pref="174" max="-2" attributes="0"/>
<EmptySpace pref="204" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="directedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="undirectedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Component id="iterationTextField" min="-2" pref="174" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -56,7 +56,7 @@ public class EigenvectorCentralityPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -127,18 +127,14 @@ public class EigenvectorCentralityPanel extends javax.swing.JPanel {
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(directedRadioButton)
.addContainerGap(439, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(undirectedRadioButton)
.addContainerGap(422, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(8, 8, 8)
.addComponent(iterationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(204, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(directedRadioButton)
.addComponent(undirectedRadioButton)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(8, 8, 8)
.addComponent(iterationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -21,15 +21,13 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="header" alignment="0" pref="477" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="undirectedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="358" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="directedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="375" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="undirectedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="directedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -55,7 +55,7 @@ public class GraphDensityPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -98,15 +98,13 @@ public class GraphDensityPanel extends javax.swing.JPanel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 443, Short.MAX_VALUE)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(undirectedRadioButton)
.addContainerGap(358, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(directedRadioButton)
.addContainerGap(372, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(undirectedRadioButton)
.addComponent(directedRadioButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -20,40 +20,43 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="header" alignment="0" pref="747" max="32767" attributes="0"/>
<Component id="header" alignment="0" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="262" max="-2" attributes="0"/>
<Component id="descriptionLabel" pref="448" max="32767" attributes="0"/>
<Component id="descriptionLabel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="directedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="260" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="normalizeButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="165" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="undirectedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="628" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="1"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="1"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jXLabel3" max="32767" attributes="0"/>
<Component id="jXLabel2" max="32767" attributes="0"/>
<Component id="jXLabel1" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="undirectedRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="1"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="1"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jXLabel3" max="32767" attributes="0"/>
<Component id="jXLabel2" max="32767" attributes="0"/>
<Component id="jXLabel1" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -124,11 +127,11 @@
</Component>
<Component class="org.jdesktop.swingx.JXLabel" name="descriptionLabel">
<Properties>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="GraphDistancePanel.descriptionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="verticalAlignment" type="int" value="1"/>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="org.jdesktop.swingx.JXHeader" name="header">
@@ -143,26 +146,26 @@
</Component>
<Component class="org.jdesktop.swingx.JXLabel" name="jXLabel1">
<Properties>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="GraphDistancePanel.jXLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="org.jdesktop.swingx.JXLabel" name="jXLabel2">
<Properties>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="GraphDistancePanel.jXLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="org.jdesktop.swingx.JXLabel" name="jXLabel3">
<Properties>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="GraphDistancePanel.jXLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
@@ -55,7 +55,7 @@ public class GraphDistancePanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -146,34 +146,35 @@ public class GraphDistancePanel extends javax.swing.JPanel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
.addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(262, 262, 262)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(directedRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 260, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(normalizeButton)
.addGap(165, 165, 165))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(undirectedRadioButton)
.addContainerGap(628, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jXLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jXLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jXLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(undirectedRadioButton)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jXLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jXLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jXLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -199,7 +200,7 @@ public class GraphDistancePanel extends javax.swing.JPanel {
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 10, Short.MAX_VALUE)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -120,11 +120,11 @@
</Component>
<Component class="org.jdesktop.swingx.JXLabel" name="descriptionLabel">
<Properties>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="HitsPanel.descriptionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="verticalAlignment" type="int" value="1"/>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="org.jdesktop.swingx.JXHeader" name="header">
@@ -142,7 +142,6 @@
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/gephi/ui/statistics/plugin/Bundle.properties" key="HitsPanel.epsilonLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@@ -151,6 +150,7 @@
<Font component="epsilonLabel" property="font" relativeSize="true" size="-1"/>
</FontInfo>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents>
@@ -55,7 +55,7 @@ public class HitsPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -129,11 +129,11 @@ public class HitsPanel extends javax.swing.JPanel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
.addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 662, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 622, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(directedRadioButton)
@@ -162,7 +162,7 @@ public class HitsPanel extends javax.swing.JPanel {
.addComponent(undirectedRadioButton)
.addComponent(epsilonLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(59, 59, 59)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -20,7 +20,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jXHeader1" alignment="0" pref="605" max="32767" attributes="0"/>
<Component id="jXHeader1" alignment="0" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -55,7 +55,7 @@ public class PageRankPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if(graphController.getModel().isUndirected()){
if(graphController.getGraphModel().isUndirected()){
directedRadioButton.setEnabled(false);
}
}
@@ -56,7 +56,7 @@ public class DynamicClusteringCoefficientPanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController.getModel().isUndirected()) {
if (graphController.getGraphModel().isUndirected()) {
directedRadioButton.setEnabled(false);
}
}
@@ -56,7 +56,7 @@ public class DynamicDegreePanel extends javax.swing.JPanel {
//Disable directed if the graph is undirecteds
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
if (graphController.getModel().isUndirected()) {
if (graphController.getGraphModel().isUndirected()) {
directedRadioButton.setEnabled(false);
}
}
@@ -2,24 +2,24 @@ OpenIDE-Module-Display-Category=Plugin
OpenIDE-Module-Name=Statistics Plugin UI
GraphDistancePanel.directedRadioButton.text=Directed
GraphDistancePanel.undirectedRadioButton.text=UnDirected
GraphDistancePanel.undirectedRadioButton.text=Undirected
ClusteringCoefficientPanel.jLabel1.text=Clustering Coefficent Metric
ClusteringCoefficientPanel.directedRadioButton.text=Directed
ClusteringCoefficientPanel.undirectedRadioButton.text=UnDirected
ClusteringCoefficientPanel.undirectedRadioButton.text=Undirected
DegreeDistributionPanel.directedRadioButton.text=Directed
DegreeDistributionPanel.undirectedRadioButton.text=UnDirected
DegreeDistributionPanel.undirectedRadioButton.text=Undirected
OpenIDE-Module-Short-Description=Standard statistics UI implementations
PageRankPanel.probTextField.text=
PageRankPanel.epsilonTextField.text=
HitsPanel.epsilonTextField.text=
GraphDensityPanel.directedRadioButton.text=Directed
GraphDensityPanel.undirectedRadioButton.text=UnDirected
GraphDensityPanel.undirectedRadioButton.text=Undirected
DegreeDistributionPanel.descriptionLabel.text=
GraphDistancePanel.descriptionLabel.text=
HitsPanel.labelEpsilon.text=Epsilon:
HitsPanel.descriptionLabel.text=
HitsPanel.directedRadioButton.text=Directed
HitsPanel.undirectedRadioButton.text=UnDirected
HitsPanel.undirectedRadioButton.text=Undirected
ModularityPanel.randomizeCheckbox.text=Randomize
ModularityPanel.desriptionLabel.text=
PageRankPanel.labelP.text=Probability (p):
@@ -50,7 +50,7 @@ PageRankPanel.jXLabel2.text=Stopping criterion, the smaller this value, the long
ModularityPanel.header.title=Modularity
ModularityPanel.header.description=Community detection algorithm.
ConnectedComponentPanel.header.description=Determines the number of connected components in the network.
ConnectedComponentPanel.undirectedRadioButton.text=UnDirected
ConnectedComponentPanel.undirectedRadioButton.text=Undirected
ConnectedComponentPanel.directedRadioButton.text=Directed
ConnectedComponentPanel.header.title=Connected Components
ConnectedComponentPanel.jLabel1.text=Detects strongly & weakly connected components
@@ -60,7 +60,7 @@ EigenvectorCentralityPanel.header.title=Eigenvector Centrality
EigenvectorCentralityPanel.iterationsTextField.text=jTextField1
EigenvectorCentralityPanel.labeliterations.text=Number of iterations:
EigenvectorCentralityPanel.directedButton.text=Directed
EigenvectorCentralityPanel.undirectedButton.text=UnDirected
EigenvectorCentralityPanel.undirectedButton.text=Undirected
GraphDistancePanel.normalizeButton.text=Normalize Centralities in [0,1]
ConnectedComponentUI.name=Connected Components
+14 -15
Ver Arquivo
@@ -217,20 +217,20 @@
<groupId>${project.groupId}</groupId>
<artifactId>spigot-plugin-ui</artifactId>
</dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>statistics-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>statistics-plugin</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>statistics-plugin-ui</artifactId>
</dependency>
<!-- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>statistics-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>statistics-plugin</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>statistics-plugin-ui</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<groupId>${project.groupId}</groupId>
<artifactId>timeline</artifactId>
</dependency>
-->
@@ -302,11 +302,10 @@
<groupId>${project.groupId}</groupId>
<artifactId>io-exporter-plugin</artifactId>
</dependency>
<!--
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>desktop-statistics</artifactId>
</dependency>-->
</dependency>
<!-- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>filters-api</artifactId>
+4
Ver Arquivo
@@ -1174,6 +1174,7 @@
<module>modules/DesktopProgress</module>
<module>modules/DesktopProject</module>
<module>modules/DesktopRecentFiles</module>
<module>modules/DesktopStatistics</module>
<module>modules/DirectoryChooser</module>
<module>modules/DynamicAPI</module>
<module>modules/ExportAPI</module>
@@ -1200,6 +1201,9 @@
<module>modules/ProjectAPI</module>
<module>modules/ProjectUI</module>
<module>modules/SettingsUpgrader</module>
<module>modules/StatisticsAPI</module>
<module>modules/StatisticsPlugin</module>
<module>modules/StatisticsPluginUI</module>
<module>modules/ToolsAPI</module>
<module>modules/UIComponents</module>
<module>modules/UIUtils</module>