本文整理汇总了Java中edu.uci.ics.jung.algorithms.importance.Ranking类的典型用法代码示例。如果您正苦于以下问题:Java Ranking类的具体用法?Java Ranking怎么用?Java Ranking使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ranking类属于edu.uci.ics.jung.algorithms.importance包,在下文中一共展示了Ranking类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recalculate
import edu.uci.ics.jung.algorithms.importance.Ranking; //导入依赖的package包/类
protected void recalculate(
Graph graph,
Vertex startingVertex,
boolean fixAxes) {
DegreeDistributionRanker degreeRanker =
new DegreeDistributionRanker(graph, true);
degreeRanker.setRemoveRankScoresOnFinalize(false);
degreeRanker.evaluate();
List rankingList = degreeRanker.getRankings();
Ranking degreeMax = (Ranking) rankingList.get(0);
Ranking degreeMin = (Ranking) rankingList.get(rankingList.size() - 1);
Set priors = new HashSet();
priors.add(startingVertex);
PageRankWithPriors pageRank =
new PageRankWithPriors( (DirectedGraph)graph, .2, priors, null);
pageRank.setRemoveRankScoresOnFinalize(false);
pageRank.evaluate();
rankingList = pageRank.getRankings();
Ranking pageRankMax = (Ranking) rankingList.get(0);
Ranking pageRankMin = (Ranking) rankingList.get(rankingList.size() - 1);
BetweennessCentrality bc = new BetweennessCentrality(graph, true);
bc.setRemoveRankScoresOnFinalize(false);
bc.evaluate();
rankingList = bc.getRankings();
Ranking betwennessMax = (Ranking) rankingList.get(0);
int minScaleRatio = (int) Math.floor(1.0 / pageRankMin.rankScore);
int maxScaleRatio = (int) Math.floor(1.0 / pageRankMax.rankScore);
if (fixAxes) {
mNodeSizePageRankSlider.setMaximum(minScaleRatio * 30);
mNodeSizePageRankSlider.setMinimum(maxScaleRatio * 10);
}
//Ranking min = (Ranking) rankingList.get(rankingList.size()-1);
// ChangeListener[] l =
// mNodeAcceptBetweennessSlider.getChangeListeners();
// for (int i = 0; i < l.length; i++) {
// mNodeAcceptBetweennessSlider.removeChangeListener(l[i]);
// }
if (fixAxes) {
mNodeAcceptBetweennessSlider.setMaximum(
(int) Math.ceil(betwennessMax.rankScore / 4.0));
mNodeAcceptBetweennessSlider.setMinimum(1);
}
// for (int i = 0; i < l.length; i++) {
// mNodeAcceptBetweennessSlider.addChangeListener(l[i]);
// }
minScaleRatio = (int) Math.floor(1.0 / degreeMin.rankScore);
maxScaleRatio = (int) Math.floor(1.0 / degreeMax.rankScore);
if (fixAxes) {
mNodeSizeDegreeSlider.setMaximum(minScaleRatio * 15);
mNodeSizeDegreeSlider.setMinimum(maxScaleRatio * 5);
}
mVizViewer.revalidate();
mVizViewer.repaint();
}