List<Ranking> rankingList = new ArrayList<Ranking>();
GraphModel model = Lookup.getDefault().lookup(GraphController.class).getModel();
Graph graph = model.getGraphVisible();
//Topology
NodeRanking degreeRanking = RankingFactory.getNodeDegreeRanking(graph);
if (degreeRanking.getMinimumValue() != null && degreeRanking.getMaximumValue() != null && !degreeRanking.getMinimumValue().equals(degreeRanking.getMaximumValue())) {
rankingList.add(degreeRanking);
}
if (model.isDirected()) {
DirectedGraph directedGraph = model.getDirectedGraphVisible();
NodeRanking inDegreeRanking = RankingFactory.getNodeInDegreeRanking(directedGraph);
if (inDegreeRanking.getMinimumValue() != null && inDegreeRanking.getMaximumValue() != null && !inDegreeRanking.getMinimumValue().equals(inDegreeRanking.getMaximumValue())) {
rankingList.add(inDegreeRanking);
}
NodeRanking outDegreeRanking = RankingFactory.getNodeOutDegreeRanking(directedGraph);
if (outDegreeRanking.getMinimumValue() != null && outDegreeRanking.getMaximumValue() != null && !outDegreeRanking.getMinimumValue().equals(outDegreeRanking.getMaximumValue())) {
rankingList.add(outDegreeRanking);
}
}
if (model.isHierarchical()) {
HierarchicalGraph hierarchicalGraph = model.getHierarchicalGraphVisible();
NodeRanking childrenRanking = RankingFactory.getNodeChildrenCountRanking(hierarchicalGraph);
if (childrenRanking.getMinimumValue() != null && childrenRanking.getMaximumValue() != null && !childrenRanking.getMinimumValue().equals(childrenRanking.getMaximumValue())) {
rankingList.add(childrenRanking);
}
}
//Attributes
int nativeCount = rankingList.size();
for (AttributeColumn column : attributeController.getModel().getNodeTable().getColumns()) {
if (RankingFactory.isNumberColumn(column)) {
NodeRanking r = RankingFactory.getNodeAttributeRanking(column, graph);
if (r.getMinimumValue() != null && r.getMaximumValue() != null && !r.getMinimumValue().equals(r.getMaximumValue())) {
rankingList.add(r);
}
} else if (RankingFactory.isDynamicNumberColumn(column) && getDynamicModel() != null) {
TimeInterval visibleInterval = dynamicModel.getVisibleInterval();
NodeRanking r = RankingFactory.getNodeDynamicAttributeRanking(column, graph, visibleInterval, dynamicModel.getNumberEstimator());
if (r.getMinimumValue() != null && r.getMaximumValue() != null && !r.getMinimumValue().equals(r.getMaximumValue())) {
rankingList.add(r);
}
}
}