本文整理汇总了Java中edu.uci.ics.jung.algorithms.shortestpath.DistanceStatistics类的典型用法代码示例。如果您正苦于以下问题:Java DistanceStatistics类的具体用法?Java DistanceStatistics怎么用?Java DistanceStatistics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DistanceStatistics类属于edu.uci.ics.jung.algorithms.shortestpath包,在下文中一共展示了DistanceStatistics类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: evaluateGraph
import edu.uci.ics.jung.algorithms.shortestpath.DistanceStatistics; //导入依赖的package包/类
@Override
protected String evaluateGraph(Graph<IVertex, IEdge> graph) {
return String.format("%.0f", DistanceStatistics.diameter(graph));
}
开发者ID:fabe85,项目名称:Alevin,代码行数:5,代码来源:NewTopologiesExperimentRig.java
示例2: initialize
import edu.uci.ics.jung.algorithms.shortestpath.DistanceStatistics; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void initialize() {
currentIteration = 0;
if(graph != null && size != null) {
double height = size.getHeight();
double width = size.getWidth();
int n = graph.getVertexCount();
dm = new double[n][n];
vertices = (V[])graph.getVertices().toArray();
xydata = new Point2D[n];
// assign IDs to all visible vertices
while(true) {
try {
int index = 0;
for(V v : graph.getVertices()) {
Point2D xyd = transform(v);
vertices[index] = v;
xydata[index] = xyd;
index++;
}
break;
} catch(ConcurrentModificationException cme) {}
}
diameter = DistanceStatistics.<V,E>diameter(graph, distance, true);
double L0 = Math.min(height, width);
L = (L0 / diameter) * length_factor; // length_factor used to be hardcoded to 0.9
//L = 0.75 * Math.sqrt(height * width / n);
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
Number d_ij = distance.getDistance(vertices[i], vertices[j]);
Number d_ji = distance.getDistance(vertices[j], vertices[i]);
double dist = diameter * disconnected_multiplier;
if (d_ij != null)
dist = Math.min(d_ij.doubleValue(), dist);
if (d_ji != null)
dist = Math.min(d_ji.doubleValue(), dist);
dm[i][j] = dm[j][i] = dist;
}
}
}
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:49,代码来源:KKLayout.java
示例3: actionPerformed
import edu.uci.ics.jung.algorithms.shortestpath.DistanceStatistics; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
final GraphViewerPanel viewerPanel = (GraphViewerPanel) frame.getTabbedPane().getSelectedComponent();
final MyVisualizationViewer vv = (MyVisualizationViewer) viewerPanel.getVisualizationViewer();
JFrame frame1 = new JFrame(" Graph Statistics ");
frame1.setSize(600, 400);
frame1.getContentPane().setLayout(new BorderLayout());
JTextPane text = new JTextPane();
text.setEditable(true);
double diameterCurrent = DistanceStatistics.diameter(viewerPanel.getCurrentGraph());
double diameterEntire = DistanceStatistics.diameter(viewerPanel.getEntireGraph());
// Transformer transformer = DistanceStatistics.averageDistances(viewerPanel.getCurrentGraph(), new UnweightedShortestPath(viewerPanel.getCurrentGraph()));
StringBuffer sb = new StringBuffer();
sb.append("Current Graph Number of Nodes: " + viewerPanel.getCurrentGraph().getVertexCount()+"\n");
sb.append("Current Graph Number of Edges: " + viewerPanel.getCurrentGraph().getEdgeCount()+"\n");
sb.append("Entire Graph Number of Nodes: " + viewerPanel.getEntireGraph().getVertexCount()+"\n");
sb.append("Entire Graph Number of Edges: " + viewerPanel.getEntireGraph().getEdgeCount()+"\n");
sb.append("Number of selected Nodes: " + viewerPanel.getPickedVerteces().size()+"\n");
sb.append(String.format("%s: %2f \n", "Current Graph Diameter", diameterCurrent));
sb.append(String.format("%s: %2f \n", "Entire Graph Diameter", diameterEntire));
// sb.append(transformer.toString());
// sb.append(String.format("%s: %2f \n", "AverageDistances",DistanceStatistics.averageDistances(viewerPanel.getCurrentGraph())));
text.setText(sb.toString());
JScrollPane scrollPane = new JScrollPane(text);
frame1.getContentPane().add("Center", scrollPane);
frame1.setVisible(true);
}
开发者ID:iTransformers,项目名称:netTransformer,代码行数:41,代码来源:GraphDistanceStatisticsMenuHandler.java
注:本文中的edu.uci.ics.jung.algorithms.shortestpath.DistanceStatistics类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论