Search in sources :

Example 6 with Table

use of org.gephi.graph.api.Table in project gephi by gephi.

the class DynamicDegree method execute.

@Override
public void execute(GraphModel graphModel) {
    this.graphModel = graphModel;
    this.isDirected = graphModel.isDirected();
    this.averages = new HashMap<>();
    //Attributes cols
    if (!averageOnly) {
        TimeRepresentation tr = graphModel.getConfiguration().getTimeRepresentation();
        Table nodeTable = graphModel.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"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalIntegerMap.class : TimestampIntegerMap.class, null);
            }
            if (dynamicOutDegreeColumn == null) {
                dynamicOutDegreeColumn = nodeTable.addColumn(DYNAMIC_OUTDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.OutDegree"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalIntegerMap.class : TimestampIntegerMap.class, null);
            }
        }
        if (dynamicDegreeColumn == null) {
            dynamicDegreeColumn = nodeTable.addColumn(DYNAMIC_DEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.Degree"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalIntegerMap.class : TimestampIntegerMap.class, null);
        }
    }
}
Also used : Table(org.gephi.graph.api.Table) TimeRepresentation(org.gephi.graph.api.TimeRepresentation)

Example 7 with Table

use of org.gephi.graph.api.Table in project gephi by gephi.

the class ConnectedComponents method initializeStronglyConnectedColumn.

private Column initializeStronglyConnectedColumn(GraphModel graphModel) {
    Table nodeTable = graphModel.getNodeTable();
    Column componentCol = nodeTable.getColumn(STRONG);
    if (componentCol == null) {
        componentCol = nodeTable.addColumn(STRONG, "Strongly-Connected ID", Integer.class, new Integer(0));
    }
    return componentCol;
}
Also used : Table(org.gephi.graph.api.Table) Column(org.gephi.graph.api.Column)

Example 8 with Table

use of org.gephi.graph.api.Table in project gephi by gephi.

the class EigenvectorCentrality method initializeAttributeColunms.

private Column initializeAttributeColunms(GraphModel graphModel) {
    Table nodeTable = graphModel.getNodeTable();
    Column eigenCol = nodeTable.getColumn(EIGENVECTOR);
    if (eigenCol == null) {
        eigenCol = nodeTable.addColumn(EIGENVECTOR, "Eigenvector Centrality", Double.class, new Double(0));
    }
    return eigenCol;
}
Also used : Table(org.gephi.graph.api.Table) Column(org.gephi.graph.api.Column)

Example 9 with Table

use of org.gephi.graph.api.Table in project gephi by gephi.

the class DataTableTopComponent method availableColumnsButtonActionPerformed.

//GEN-LAST:event_configurationButtonActionPerformed
private void availableColumnsButtonActionPerformed(java.awt.event.ActionEvent evt) {
    //GEN-FIRST:event_availableColumnsButtonActionPerformed
    Table table;
    AvailableColumnsModel availableColumnsModel;
    if (isShowingNodesTable()) {
        table = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getNodeTable();
    } else {
        table = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getEdgeTable();
    }
    availableColumnsModel = getTableAvailableColumnsModel(table);
    DialogDescriptor dd = new DialogDescriptor(new AvailableColumnsPanel(table, availableColumnsModel).getValidationPanel(), NbBundle.getMessage(DataTableTopComponent.class, "AvailableColumnsPanel.title"));
    dd.setOptions(new Object[] { DialogDescriptor.OK_OPTION });
    DialogDisplayer.getDefault().notify(dd);
    refreshAllOnce();
}
Also used : NodesDataTable(org.gephi.desktop.datalab.tables.NodesDataTable) Table(org.gephi.graph.api.Table) EdgesDataTable(org.gephi.desktop.datalab.tables.EdgesDataTable) DialogDescriptor(org.openide.DialogDescriptor) GraphController(org.gephi.graph.api.GraphController)

Example 10 with Table

use of org.gephi.graph.api.Table in project gephi by gephi.

the class MergeNodes method setup.

@Override
public void setup(Node[] nodes, Node clickedNode) {
    this.nodes = nodes;
    selectedNode = clickedNode != null ? clickedNode : nodes[0];
    Table nodeTable = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getNodeTable();
    List<Column> columnsList = new ArrayList<>();
    for (Column column : nodeTable) {
        if (!column.isReadOnly()) {
            columnsList.add(column);
        }
    }
    columns = columnsList.toArray(new Column[0]);
    mergeStrategies = new AttributeRowsMergeStrategy[columns.length];
    deleteMergedNodes = NbPreferences.forModule(MergeNodes.class).getBoolean(DELETE_MERGED_NODES_SAVED_PREFERENCES, true);
}
Also used : Table(org.gephi.graph.api.Table) Column(org.gephi.graph.api.Column) ArrayList(java.util.ArrayList)

Aggregations

Table (org.gephi.graph.api.Table)28 Column (org.gephi.graph.api.Column)22 Node (org.gephi.graph.api.Node)10 GraphController (org.gephi.graph.api.GraphController)7 Edge (org.gephi.graph.api.Edge)5 GraphElementsController (org.gephi.datalab.api.GraphElementsController)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 EdgesDataTable (org.gephi.desktop.datalab.tables.EdgesDataTable)3 NodesDataTable (org.gephi.desktop.datalab.tables.NodesDataTable)3 TimeFormat (org.gephi.graph.api.TimeFormat)3 TimeRepresentation (org.gephi.graph.api.TimeRepresentation)3 DateTimeZone (org.joda.time.DateTimeZone)3 CsvReader (com.csvreader.CsvReader)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 AttributeColumnsController (org.gephi.datalab.api.AttributeColumnsController)2 SearchResult (org.gephi.datalab.api.SearchReplaceController.SearchResult)2 DataTablesController (org.gephi.datalab.api.datatables.DataTablesController)2