public class AttributeColumnsControllerImpl extends Object implements AttributeColumnsController
AttributeColumnsController| Constructor and Description |
|---|
AttributeColumnsControllerImpl() |
| Modifier and Type | Method and Description |
|---|---|
org.gephi.graph.api.Column |
addAttributeColumn(org.gephi.graph.api.Table table,
String title,
Class type)
Adds a new column to the specified table with the given title and type of column.
|
Map<Object,Integer> |
calculateColumnValuesFrequencies(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Calculates the absolute frequency of appearance of each value of the given column and returns a Map containing each different value mapped to its frequency of appearance.
|
boolean |
canChangeColumnData(org.gephi.graph.api.Column column)
Indicates if the Data Laboratory API behaviour allows to change a value of the given column of a table.
|
boolean |
canClearColumnData(org.gephi.graph.api.Column column)
Indicates if the Data Laboratory API behaviour allows to set as null a value of the given column of a table.
|
boolean |
canConvertColumnToDynamic(org.gephi.graph.api.Column column)
Indicates if the Data Laboratory API behaviour allows to convert an existing column into its dynamic equivalent.
|
boolean |
canDeleteColumn(org.gephi.graph.api.Column column)
Indicates if the Data Laboratory API behaviour allows to delete the given column of a table.
|
void |
clearColumnData(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Clears all rows data for a given column of a table (nodes table or edges table)
|
void |
clearEdgeData(org.gephi.graph.api.Edge edge,
org.gephi.graph.api.Column[] columnsToClear)
Clears all edge attributes except computed attributes and id.
|
void |
clearEdgesData(org.gephi.graph.api.Edge[] edges,
org.gephi.graph.api.Column[] columnsToClear)
Clears all the edges attributes except computed attributes and id, checking first that the edges are in the graph.
|
void |
clearNodeData(org.gephi.graph.api.Node node,
org.gephi.graph.api.Column[] columnsToClear)
Clears all node attributes except computed attributes and id, checking first that the node is in the graph.
|
void |
clearNodesData(org.gephi.graph.api.Node[] nodes,
org.gephi.graph.api.Column[] columnsToClear)
Clears all the nodes attributes except computed attributes and id.
|
void |
clearRowData(org.gephi.graph.api.Element row,
org.gephi.graph.api.Column[] columnsToClear)
Clears row attributes except computed attributes and id if node/edge row.
|
org.gephi.graph.api.Column |
convertAttributeColumnToDynamic(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
double low,
double high)
Converts and replaces a table column with a dynamic column preserving original column values.
|
org.gephi.graph.api.Column |
convertAttributeColumnToNewDynamicColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
double low,
double high,
String newColumnTitle)
Converts a table column into a new dynamic column preserving original column values.
|
private org.gephi.graph.api.Column |
convertColumnToDynamic(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
double low,
double high,
String newColumnTitle) |
void |
copyColumnDataToOtherColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column sourceColumn,
org.gephi.graph.api.Column targetColumn)
Copies all row values of a column to another column.
|
void |
copyEdgeDataToOtherEdges(org.gephi.graph.api.Edge edge,
org.gephi.graph.api.Edge[] otherEdges,
org.gephi.graph.api.Column[] columnsToCopy)
Copies attributes data of the given edge to the other rows except computed attributes and id.
|
void |
copyNodeDataToOtherNodes(org.gephi.graph.api.Node node,
org.gephi.graph.api.Node[] otherNodes,
org.gephi.graph.api.Column[] columnsToCopy)
Copies attributes data of the given node to the other rows except computed attributes and id.
|
void |
copyRowDataToOtherRows(org.gephi.graph.api.Element row,
org.gephi.graph.api.Element[] otherRows,
org.gephi.graph.api.Column[] columnsToCopy)
Copies attributes data of the given row to the other rows except computed attributes and id if node/edge.
|
org.gephi.graph.api.Column |
createBooleanMatchesColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String newColumnTitle,
Pattern pattern)
Creates a new
BOOLEAN column from the given column and regular expression
filling it with boolean values that indicate if each of the old column values match the regular expression. |
org.gephi.graph.api.Column |
createFoundGroupsListColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String newColumnTitle,
Pattern pattern)
Creates a new
LIST_STRING column from the given column and regular expression with values that are
the list of matching groups for the given regular expression for each row. |
void |
deleteAttributeColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Deletes the specified column from a table if the table has the column and data laboratory behaviour allows to delete it (see
canDeleteColumn method). |
List<List<org.gephi.graph.api.Node>> |
detectNodeDuplicatesByColumn(org.gephi.graph.api.Column column,
boolean caseSensitive)
Finds and returns nodes duplicates based on the values of a given column of nodes table
|
org.gephi.graph.api.Column |
duplicateColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String title,
Class type)
Duplicates a given column of a table and copies al row values.
|
void |
fillColumnWithValue(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String value)
Fills the data values of a given column of a table with a value as a String,
parsing it for the
Class of the column. |
void |
fillEdgesColumnWithValue(org.gephi.graph.api.Edge[] edges,
org.gephi.graph.api.Column column,
String value)
Fills the data values of a given column of the indicated edges with a value as a String,
parsing it for the
Class of the column. |
void |
fillNodesColumnWithValue(org.gephi.graph.api.Node[] nodes,
org.gephi.graph.api.Column column,
String value)
Fills the data values of a given column of the indicated nodes with a value as a String,
parsing it for the
Class of the column. |
private List<Number> |
getArrayNumbers(Object arr)
Works for arrays of primitive and non primitive numbers.
|
Number[] |
getColumnNumbers(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Prepares an array with all not null numbers of all the rows of a given column.
|
private List<Number> |
getDynamicNumberColumnNumbers(org.gephi.graph.api.Element row,
org.gephi.graph.api.Column column)
Used for obtaining a list of the numbers of row of a dynamic number column.
|
private org.gephi.graph.api.Edge[] |
getEdgesArray()
Used for iterating through all edges of the graph
|
private org.gephi.graph.api.Node[] |
getNodesArray()
Used for iterating through all nodes of the graph
|
BigDecimal[] |
getNumberOrNumberListColumnStatistics(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Calculates all statistics at once from a number/number list column using
MathUtils class. |
Number[] |
getRowNumbers(org.gephi.graph.api.Element row,
org.gephi.graph.api.Column[] columns)
Prepares an array with all not null numbers of a row using only the given columns.
|
Number[] |
getRowsColumnNumbers(org.gephi.graph.api.Element[] rows,
org.gephi.graph.api.Column column)
Prepares an array only with all not null numbers the indicated rows of a given column.
|
org.gephi.graph.api.Element[] |
getTableAttributeRows(org.gephi.graph.api.Table table)
Returns all rows of a given table (node or edges table).
|
int |
getTableRowsCount(org.gephi.graph.api.Table table)
Counts the number of rows of a table (nodes or edges table) and returns the result.
|
void |
importCSVToEdgesTable(org.gephi.graph.api.Graph graph,
File file,
Character separator,
Charset charset,
String[] columnNames,
Class[] columnTypes,
boolean createNewNodes)
Method for importing csv data to edges table.
|
void |
importCSVToNodesTable(org.gephi.graph.api.Graph graph,
File file,
Character separator,
Charset charset,
String[] columnNames,
Class[] columnTypes,
boolean assignNewNodeIds)
Method for importing CSV file data to nodes table.
|
boolean |
isEdgeColumn(org.gephi.graph.api.Column column) |
boolean |
isEdgeTable(org.gephi.graph.api.Table table)
Checks if the given table is edges table.
|
boolean |
isNodeColumn(org.gephi.graph.api.Column column) |
boolean |
isNodeTable(org.gephi.graph.api.Table table)
Checks if the given table is nodes table.
|
boolean |
isTableColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column) |
void |
mergeRowsValues(org.gephi.graph.api.Column[] columns,
AttributeRowsMergeStrategy[] mergeStrategies,
org.gephi.graph.api.Element[] rows,
org.gephi.graph.api.Element selectedRow,
org.gephi.graph.api.Element resultRow)
Merges the given rows values to the given result row using one merge strategy for each column of the table.
|
void |
negateBooleanColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Negates not null values of a given
BOOLEAN or LIST_BOOLEANcolumn. |
private void |
negateColumnBooleanType(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Used to negate the values of a single boolean column.
|
private void |
negateColumnListBooleanType(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
Used to negate all values of a list of boolean values column.
|
boolean |
setAttributeValue(Object value,
org.gephi.graph.api.Element row,
org.gephi.graph.api.Column column)
Sets a value to the given row,column pair (cell).
|
public boolean setAttributeValue(Object value, org.gephi.graph.api.Element row, org.gephi.graph.api.Column column)
AttributeColumnsControllerSets a value to the given row,column pair (cell). If the class of the value is not the column type class,
it will try to parse the toString representation of the value.
Takes care to avoid parsing exceptions of the target column type.
Also, this will not set a null value to a column that can't have null values (see canClearColumnData method) if the given object is null or the parsing fails.
setAttributeValue in interface AttributeColumnsControllervalue - Value to set, can be nullrow - Rowcolumn - Columnpublic org.gephi.graph.api.Column addAttributeColumn(org.gephi.graph.api.Table table,
String title,
Class type)
AttributeColumnsControllerAdds a new column to the specified table with the given title and type of column.
The title for the new column can't be repeated in the table, null or an empty string.
.The id of the column will be set to the same as the title, but if the first TimeInterval column of the table is created it will be given the default dynamic time interval id to be able to use dynamic filters.
The AttributeOrigin of the column will be set to DATA.
Default column value will be set to null.
addAttributeColumn in interface AttributeColumnsControllertable - Table to add the columntitle - Title for the new column, can't be repeated in the table, null or empty stringtype - Type for the new columnpublic void deleteAttributeColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
AttributeColumnsControllerDeletes the specified column from a table if the table has the column and data laboratory behaviour allows to delete it (see canDeleteColumn method).
deleteAttributeColumn in interface AttributeColumnsControllertable - Table to delete the columncolumn - Column to deletepublic org.gephi.graph.api.Column convertAttributeColumnToDynamic(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
double low,
double high)
AttributeColumnsControllerConverts and replaces a table column with a dynamic column preserving original column values.
This should be used only in columns where the canConvertColumnToDynamic returns true
For graphs with INTERVAL TimeRepresentation, the new values have a default interval that uses the low and high parameters.
For graphs with TIMESTAMP TimeRepresentation, the new values have a default timestamp that uses the low parameter, high parameter is ignored.
convertAttributeColumnToDynamic in interface AttributeColumnsControllertable - Table of the columncolumn - Column to convert and replacelow - Low bound for default interval or default timestamphigh - High bound for default interval or ignored for timestampspublic org.gephi.graph.api.Column convertAttributeColumnToNewDynamicColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
double low,
double high,
String newColumnTitle)
AttributeColumnsControllerConverts a table column into a new dynamic column preserving original column values. The original column is kept intact
For graphs with INTERVAL TimeRepresentation, the new values have a default interval that uses the low and high parameters.
For graphs with TIMESTAMP TimeRepresentation, the new values have a default timestamp that uses the low parameter, high parameter is ignored.
convertAttributeColumnToNewDynamicColumn in interface AttributeColumnsControllertable - Table of the columncolumn - Column to convert to dynamiclow - Low bound for default interval or default timestamphigh - High bound for default interval or ignored for timestampsnewColumnTitle - Title for the new dynamic columnprivate org.gephi.graph.api.Column convertColumnToDynamic(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
double low,
double high,
String newColumnTitle)
public org.gephi.graph.api.Column duplicateColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String title,
Class type)
AttributeColumnsControllerDuplicates a given column of a table and copies al row values.
If the Class for the new column is different from the old column type, it will try to parse each value. If it is not possible, the value will be set to null.
The title for the new column can't be repeated in the table, null or an empty string.
.The id of the column will be set to the title.
The AttributeOrigin of the column will be set to DATA.
Default column value will be set to null.
duplicateColumn in interface AttributeColumnsControllertable - Table of the column to duplicatecolumn - Column to duplicatetitle - Title for the new columntype - Class for the new columnpublic void copyColumnDataToOtherColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column sourceColumn,
org.gephi.graph.api.Column targetColumn)
AttributeColumnsControllerCopies all row values of a column to another column.
If the Class for the target is different from the source column type, it will try to parse each value. If it is not possible, the value will be set to null.
Source and target columns must be different.
copyColumnDataToOtherColumn in interface AttributeColumnsControllertable - Table of the columnssourceColumn - Source columntargetColumn - Target columnpublic void fillColumnWithValue(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String value)
AttributeColumnsControllerFills the data values of a given column of a table with a value as a String,
parsing it for the Class of the column. If it is not possible to parse,
the value will be set to null.
fillColumnWithValue in interface AttributeColumnsControllertable - Table of the columncolumn - Column to fillvalue - String representation of the value for each row of the columnpublic void fillNodesColumnWithValue(org.gephi.graph.api.Node[] nodes,
org.gephi.graph.api.Column column,
String value)
AttributeColumnsControllerFills the data values of a given column of the indicated nodes with a value as a String,
parsing it for the Class of the column. If it is not possible to parse,
the value will be set to null.
fillNodesColumnWithValue in interface AttributeColumnsControllernodes - Nodes to fillcolumn - Column to fillvalue - String representation of the value for the column for each nodepublic void fillEdgesColumnWithValue(org.gephi.graph.api.Edge[] edges,
org.gephi.graph.api.Column column,
String value)
AttributeColumnsControllerFills the data values of a given column of the indicated edges with a value as a String,
parsing it for the Class of the column. If it is not possible to parse,
the value will be set to null.
fillEdgesColumnWithValue in interface AttributeColumnsControlleredges - Edges to fillcolumn - Column to fillvalue - String representation of the value for the column for each edgepublic void clearColumnData(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
AttributeColumnsControllerClears all rows data for a given column of a table (nodes table or edges table)
clearColumnData in interface AttributeColumnsControllertable - Table to clear column datacolumn - Column to clear datapublic Map<Object,Integer> calculateColumnValuesFrequencies(org.gephi.graph.api.Table table, org.gephi.graph.api.Column column)
AttributeColumnsControllerCalculates the absolute frequency of appearance of each value of the given column and returns a Map containing each different value mapped to its frequency of appearance.
calculateColumnValuesFrequencies in interface AttributeColumnsControllertable - Table of the columncolumn - Column to calculate values frequenciespublic org.gephi.graph.api.Column createBooleanMatchesColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String newColumnTitle,
Pattern pattern)
AttributeColumnsControllerCreates a new BOOLEAN column from the given column and regular expression
filling it with boolean values that indicate if each of the old column values match the regular expression.
Title for the new column can't be repeated in the table, null or empty.
createBooleanMatchesColumn in interface AttributeColumnsControllertable - Table of the column to matchcolumn - Column to matchnewColumnTitle - Title for the new boolean columnpattern - Regular expression to matchpublic void negateBooleanColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
AttributeColumnsControllerNegates not null values of a given BOOLEAN or LIST_BOOLEANcolumn.
Throws IllegalArgumentException if the column does not have BOOLEAN or LIST_BOOLEAN Class.
negateBooleanColumn in interface AttributeColumnsControllertable - Table of the column to negatecolumn - Boolean column to negatepublic org.gephi.graph.api.Column createFoundGroupsListColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column,
String newColumnTitle,
Pattern pattern)
AttributeColumnsControllerCreates a new LIST_STRING column from the given column and regular expression with values that are
the list of matching groups for the given regular expression for each row.
The title for the new column can't be repeated in the table, null or an empty string.
.createFoundGroupsListColumn in interface AttributeColumnsControllertable - Table of the column to matchcolumn - Column to matchnewColumnTitle - Title for the new boolean columnpattern - Regular expression to matchpublic void clearNodeData(org.gephi.graph.api.Node node,
org.gephi.graph.api.Column[] columnsToClear)
AttributeColumnsControllerClears all node attributes except computed attributes and id, checking first that the node is in the graph.
Columns to clear can be specified, but id and computed columns will not be cleared.
clearNodeData in interface AttributeColumnsControllernode - Node to clear datacolumnsToClear - Columns of the node to clear. All columns will be cleared if it is nullpublic void clearNodesData(org.gephi.graph.api.Node[] nodes,
org.gephi.graph.api.Column[] columnsToClear)
AttributeColumnsControllerClears all the nodes attributes except computed attributes and id.
Columns to clear can be specified, but id and computed columns will not be cleared.
clearNodesData in interface AttributeColumnsControllernodes - Array of nodes to clear datacolumnsToClear - Columns of the nodes to clear. All columns will be cleared if it is nullpublic void clearEdgeData(org.gephi.graph.api.Edge edge,
org.gephi.graph.api.Column[] columnsToClear)
AttributeColumnsControllerClears all edge attributes except computed attributes and id.
Columns to clear can be specified, but id and computed columns will not be cleared.
clearEdgeData in interface AttributeColumnsControlleredge - Edge to clear datacolumnsToClear - Columns of the edge to clear. All columns will be cleared if it is nullpublic void clearEdgesData(org.gephi.graph.api.Edge[] edges,
org.gephi.graph.api.Column[] columnsToClear)
AttributeColumnsControllerClears all the edges attributes except computed attributes and id, checking first that the edges are in the graph.
Columns to clear can be specified, but id and computed columns will not be cleared.
clearEdgesData in interface AttributeColumnsControlleredges - Array of edges to clear datacolumnsToClear - Columns of the edges to clear. All columns will be cleared if it is nullpublic void clearRowData(org.gephi.graph.api.Element row,
org.gephi.graph.api.Column[] columnsToClear)
AttributeColumnsControllerClears row attributes except computed attributes and id if node/edge row.
Columns to clear can be specified, but id of node/edge and computed columns will not be cleared.
clearRowData in interface AttributeColumnsControllerrow - Array of rows to clear datacolumnsToClear - Columns of the row to clear. All columns will be cleared if it is nullpublic void copyNodeDataToOtherNodes(org.gephi.graph.api.Node node,
org.gephi.graph.api.Node[] otherNodes,
org.gephi.graph.api.Column[] columnsToCopy)
AttributeColumnsControllerCopies attributes data of the given node to the other rows except computed attributes and id.
Columns to copy can be specified, but id node and computed columns will not be copied.
copyNodeDataToOtherNodes in interface AttributeColumnsControllernode - Node to copy data fromotherNodes - Nodes to copy data tocolumnsToCopy - Columns of the node to copy. All columns will be copied if it is nullpublic void copyEdgeDataToOtherEdges(org.gephi.graph.api.Edge edge,
org.gephi.graph.api.Edge[] otherEdges,
org.gephi.graph.api.Column[] columnsToCopy)
AttributeColumnsControllerCopies attributes data of the given edge to the other rows except computed attributes and id.
Columns to copy can be specified, but id edge and computed columns will not be copied.
copyEdgeDataToOtherEdges in interface AttributeColumnsControlleredge - Edge to copy data fromotherEdges - Edges to copy data tocolumnsToCopy - Columns of the edge to copy. All columns will be copied if it is nullpublic void copyRowDataToOtherRows(org.gephi.graph.api.Element row,
org.gephi.graph.api.Element[] otherRows,
org.gephi.graph.api.Column[] columnsToCopy)
AttributeColumnsControllerCopies attributes data of the given row to the other rows except computed attributes and id if node/edge.
Columns to copy can be specified, but id of node/edge and computed columns will not be copied.
copyRowDataToOtherRows in interface AttributeColumnsControllerrow - Row to copy data fromotherRows - Rows to copy data tocolumnsToCopy - Columns of the row to copy. All columns will be copied if it is nullpublic org.gephi.graph.api.Element[] getTableAttributeRows(org.gephi.graph.api.Table table)
AttributeColumnsControllerReturns all rows of a given table (node or edges table).
Used for iterating through all attribute rows of a table
getTableAttributeRows in interface AttributeColumnsControllertable - Table to get attribute rowspublic int getTableRowsCount(org.gephi.graph.api.Table table)
AttributeColumnsControllerCounts the number of rows of a table (nodes or edges table) and returns the result.
Uses GraphElementsController getNodesCount and getEdgesCount to calculate the result.
getTableRowsCount in interface AttributeColumnsControllertablepublic boolean isNodeTable(org.gephi.graph.api.Table table)
AttributeColumnsControllerChecks if the given table is nodes table.
isNodeTable in interface AttributeColumnsControllertable - Table to checkpublic boolean isEdgeTable(org.gephi.graph.api.Table table)
AttributeColumnsControllerChecks if the given table is edges table.
isEdgeTable in interface AttributeColumnsControllertable - Table to checkpublic boolean canDeleteColumn(org.gephi.graph.api.Column column)
AttributeColumnsControllerIndicates if the Data Laboratory API behaviour allows to delete the given column of a table.
The behaviour is: Any column that does not have a AttributeOrigin of type PROPERTY can be deleted.
canDeleteColumn in interface AttributeColumnsControllercolumn - Column to check if it can be deletedpublic boolean isTableColumn(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
isTableColumn in interface AttributeColumnsControllerpublic boolean isNodeColumn(org.gephi.graph.api.Column column)
isNodeColumn in interface AttributeColumnsControllerpublic boolean isEdgeColumn(org.gephi.graph.api.Column column)
isEdgeColumn in interface AttributeColumnsControllerpublic boolean canChangeColumnData(org.gephi.graph.api.Column column)
AttributeColumnsControllerIndicates if the Data Laboratory API behaviour allows to change a value of the given column of a table.
The behaviour is: Only values of columns with AttributeOrigin of type DATA or a node/edge label and weight column can be changed. (but weight can't be null. see canClearColumnData method).
canChangeColumnData in interface AttributeColumnsControllercolumn - Column to check if values can be changedpublic boolean canClearColumnData(org.gephi.graph.api.Column column)
AttributeColumnsControllerIndicates if the Data Laboratory API behaviour allows to set as null a value of the given column of a table.
The behaviour is: Only values of columns with AttributeOrigin of type DATA or a node/edge label column can be set to null. Edge weight can't be null
canClearColumnData in interface AttributeColumnsControllercolumn - Column to check if values can be changedpublic boolean canConvertColumnToDynamic(org.gephi.graph.api.Column column)
AttributeColumnsControllerIndicates if the Data Laboratory API behaviour allows to convert an existing column into its dynamic equivalent.
The behaviour is: Only values of columns with AttributeOrigin of type DATA and edge weight can be converted.
canConvertColumnToDynamic in interface AttributeColumnsControllercolumn - Column to check if can be convertedpublic BigDecimal[] getNumberOrNumberListColumnStatistics(org.gephi.graph.api.Table table, org.gephi.graph.api.Column column)
AttributeColumnsControllerCalculates all statistics at once from a number/number list column using MathUtils class.
Returns an array of length=8 of BigDecimal numbers with the results in the following order:
The column can only be a number/number list column.
Otherwise, a IllegalArgumentException will be thrown.
getNumberOrNumberListColumnStatistics in interface AttributeColumnsControllertable - Table of the columncolumn - Column to get statisticspublic Number[] getColumnNumbers(org.gephi.graph.api.Table table, org.gephi.graph.api.Column column)
AttributeColumnsControllerPrepares an array with all not null numbers of all the rows of a given column.
The column can only be a number/number list column.
Otherwise, a IllegalArgumentException will be thrown.
getColumnNumbers in interface AttributeColumnsControllertable - Table of the column to get numberscolumn - Column to get numberspublic Number[] getRowsColumnNumbers(org.gephi.graph.api.Element[] rows, org.gephi.graph.api.Column column)
AttributeColumnsControllerPrepares an array only with all not null numbers the indicated rows of a given column.
The column can only be a number/number list column.
Otherwise, a IllegalArgumentException will be thrown.
getRowsColumnNumbers in interface AttributeColumnsControllerrows - Rows to get numberscolumn - Column to get numberspublic Number[] getRowNumbers(org.gephi.graph.api.Element row, org.gephi.graph.api.Column[] columns)
AttributeColumnsControllerPrepares an array with all not null numbers of a row using only the given columns.
The columns can only be number/dynamic number/number list columns (in any combination).
All numbers intervals of a dynamic number column will be used.
Otherwise, a IllegalArgumentException will be thrown.
getRowNumbers in interface AttributeColumnsControllerrow - Row to get numberscolumns - Columns of the row to usepublic void importCSVToNodesTable(org.gephi.graph.api.Graph graph,
File file,
Character separator,
Charset charset,
String[] columnNames,
Class[] columnTypes,
boolean assignNewNodeIds)
AttributeColumnsControllerMethod for importing CSV file data to nodes table.
Only special case is treating columns is id columns: first column found named 'id' (case insensitive) will be used as node id, others will be ignored.
No special column must be provided.
If a column name is not already in nodes table, it will be created with the corresponding columnType index.
If a node id already exists, depending on assignNewNodeIds, a new id will be assigned to it or instead, the already existing node attributes will be updated with the CSV data
importCSVToNodesTable in interface AttributeColumnsControllergraph - Graph to import nodesfile - CSV fileseparator - Separator of values of the CSV filecharset - Charset of the CSV filecolumnNames - Names of the columns in the CSV file to usecolumnTypes - Types of the columns in the CSV file to use when creating columnsassignNewNodeIds - Indicates if nodes should be assigned new ids when the ids are already in nodes table or not provided.public void importCSVToEdgesTable(org.gephi.graph.api.Graph graph,
File file,
Character separator,
Charset charset,
String[] columnNames,
Class[] columnTypes,
boolean createNewNodes)
AttributeColumnsControllerMethod for importing csv data to edges table.
Column named 'Source' and 'Target' (case insensitive) should be provided. Any row that does not provide a source and target nodes ids will be ignored.
If no 'Type' (case insensitive) column is provided, all edges will be directed.
If an edge already exists and cannot be created, it will be ignored but the weight of the existing edge will be increased with each repetition.
Special cases are id, source, target and type columns:
importCSVToEdgesTable in interface AttributeColumnsControllergraph - Graph to import edgesfile - CSV fileseparator - Separator of values of the CSV filecharset - Charset of the CSV filecolumnNames - Names of the columns in the CSV file to usecolumnTypes - Types of the columns in the CSV file to use when creating columnscreateNewNodes - Indicates if missing nodes should be created when an edge declares a source or target id not already existingpublic void mergeRowsValues(org.gephi.graph.api.Column[] columns,
AttributeRowsMergeStrategy[] mergeStrategies,
org.gephi.graph.api.Element[] rows,
org.gephi.graph.api.Element selectedRow,
org.gephi.graph.api.Element resultRow)
AttributeColumnsControllerMerges the given rows values to the given result row using one merge strategy for each column of the table.
The number of columns must be equal to the number of merge strategies provided
No parameters can be null except selectedRow (first row will be used in case selectedRow is null)
If any strategy is null, the value of the selectedRow will be used
mergeRowsValues in interface AttributeColumnsControllercolumns - Columns to apply a merge strategy in each rowmergeStrategies - Strategies for each column in columnsrows - Rows to merge (at least 1)selectedRow - Main selected row or null (first row will be used in case selectedRow is null)resultRow - Already existing row to put the values onpublic List<List<org.gephi.graph.api.Node>> detectNodeDuplicatesByColumn(org.gephi.graph.api.Column column, boolean caseSensitive)
AttributeColumnsControllerFinds and returns nodes duplicates based on the values of a given column of nodes table
A node is a duplicate of other if they have the same value (String representation of the values is used) in the given column.
This is useful to be used to automatically merge duplicated nodes
detectNodeDuplicatesByColumn in interface AttributeColumnsControllercolumn - Column to use values to detect duplicatescaseSensitive - Case insensitivity when comparing the column valuesprivate org.gephi.graph.api.Node[] getNodesArray()
private org.gephi.graph.api.Edge[] getEdgesArray()
private void negateColumnBooleanType(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
private void negateColumnListBooleanType(org.gephi.graph.api.Table table,
org.gephi.graph.api.Column column)
private List<Number> getDynamicNumberColumnNumbers(org.gephi.graph.api.Element row, org.gephi.graph.api.Column column)
row - Rowcolumn - Column with dynamic typeCopyright © 2007–2016 Gephi Consortium. All rights reserved.