• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DistanceStatistics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SessionManager类代码示例发布时间:2022-05-22
下一篇:
Java NumberModel类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap