Search in sources :

Example 26 with Table

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

the class SearchReplaceUI method createSearchOptions.

private void createSearchOptions() {
    boolean onlyVisibleElements = Lookup.getDefault().lookup(DataTablesController.class).isShowOnlyVisible();
    searchResult = null;
    columnsToSearchComboBox.removeAllItems();
    Table table;
    if (mode == Mode.NODES_TABLE) {
        Node[] nodes;
        if (onlyVisibleElements) {
            //Search on visible nodes:
            nodes = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible().getNodes().toArray();
        } else {
            //Search on all nodes
            nodes = new Node[0];
        }
        searchOptions = new SearchOptions(nodes, null);
        table = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getNodeTable();
    } else {
        Edge[] edges;
        if (onlyVisibleElements) {
            //Search on visible edges:
            edges = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible().getEdges().toArray();
        } else {
            //Search on all edges
            edges = new Edge[0];
        }
        searchOptions = new SearchOptions(edges, null);
        table = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getEdgeTable();
    }
    //Fill possible columns to search (first value is all columns):
    columnsToSearchComboBox.addItem(NbBundle.getMessage(SearchReplaceUI.class, "SearchReplaceUI.allColumns"));
    for (Column c : table) {
        columnsToSearchComboBox.addItem(new ColumnWrapper(c));
    }
}
Also used : Table(org.gephi.graph.api.Table) Column(org.gephi.graph.api.Column) Node(org.gephi.graph.api.Node) SearchOptions(org.gephi.datalab.api.SearchReplaceController.SearchOptions) Edge(org.gephi.graph.api.Edge) GraphController(org.gephi.graph.api.GraphController) DataTablesController(org.gephi.datalab.api.datatables.DataTablesController)

Example 27 with Table

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

the class ConnectedComponents method initializeWeeklyConnectedColumn.

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

Example 28 with Table

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

the class PageRank method initializeAttributeColunms.

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

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