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

Java Distance类代码示例

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

本文整理汇总了Java中edu.uci.ics.jung.algorithms.shortestpath.Distance的典型用法代码示例。如果您正苦于以下问题:Java Distance类的具体用法?Java Distance怎么用?Java Distance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Distance类属于edu.uci.ics.jung.algorithms.shortestpath包,在下文中一共展示了Distance类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newLayout

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
private Layout<Node, Edge> newLayout(final Diagram diagram) {
    final Layout<Node, Edge> diagramLayout;
    if (layout != null && layout.startsWith("spring")) {
        diagramLayout = new SpringLayout<Node, Edge>(diagram, new ConstantTransformer(Integer.parseInt(config("spring", "100"))));
    } else if (layout != null && layout.startsWith("kk")) {
        Distance<Node> distance = new DijkstraDistance<Node, Edge>(diagram);
        if (layout.endsWith("unweight")) {
            distance = new UnweightedShortestPath<Node, Edge>(diagram);
        }
        diagramLayout = new KKLayout<Node, Edge>(diagram, distance);
    } else if (layout != null && layout.equalsIgnoreCase("circle")) {
        diagramLayout = new CircleLayout<Node, Edge>(diagram);
    } else if (layout != null && layout.equalsIgnoreCase("fr")) {
        diagramLayout = new FRLayout<Node, Edge>(diagram);
    } else {
        final LevelLayout levelLayout = new LevelLayout(diagram);
        levelLayout.adjust = adjust;

        diagramLayout = levelLayout;
    }
    return diagramLayout;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:23,代码来源:DiagramGenerator.java


示例2: averageDistances

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
/**
 * For each vertex <code>v</code> in <code>graph</code>, 
 * calculates the average shortest path length from <code>v</code> 
 * to all other vertices in <code>graph</code> using the metric 
 * specified by <code>d</code>, and returns the results in a
 * <code>Map</code> from vertices to <code>Double</code> values.
 * If there exists an ordered pair <code>&lt;u,v&gt;</code>
 * for which <code>d.getDistance(u,v)</code> returns <code>null</code>,
 * then the average distance value for <code>u</code> will be stored
 * as <code>Double.POSITIVE_INFINITY</code>).
 * 
 * <p>To calculate the average distances, ignoring edge weights if any:
 * <pre>
 * Map distances = GraphStatistics.averageDistances(g, new UnweightedShortestPath(g));
 * </pre>
 * To calculate the average distances respecting edge weights:
 * <pre>
 * DijkstraShortestPath dsp = new DijkstraShortestPath(g, nev);
 * Map distances = GraphStatistics.averageDistances(g, dsp);
 * </pre>
 * where <code>nev</code> is an instance of <code>NumberEdgeValue</code> that
 * is used to fetch the weight for each edge.
 * 
 * @see edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath
 * @see edu.uci.ics.jung.algorithms.shortestpath.DijkstraDistance
 */
public static Map averageDistances(ArchetypeGraph graph, Distance d)
{
    Map avg_dist = new HashMap();
    Set vertices = graph.getVertices();
    int n = graph.numVertices();
    for (Iterator outer = vertices.iterator(); outer.hasNext(); )
    {
        ArchetypeVertex v = (ArchetypeVertex)outer.next();
        double avgPathLength = 0;
        for (Iterator inner = vertices.iterator(); inner.hasNext(); )
        {
            ArchetypeVertex w = (ArchetypeVertex)inner.next();
            if (v != w) // don't include self-distances
            {
                Number dist = d.getDistance(v, w);
                if (dist == null)
                {
                    avgPathLength = Double.POSITIVE_INFINITY;
                    break;
                }
                avgPathLength += dist.doubleValue();
            }
        }
        avgPathLength /= (n - 1);
        avg_dist.put(v, new Double(avgPathLength));
    }
    return avg_dist;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:55,代码来源:GraphStatistics.java


示例3: KKLayout

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
/**
* Creates an instance for the specified graph and distance metric.
*/
  public KKLayout(Graph<V,E> g, Distance<V> distance){
      super(g);
      this.distance = distance;
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:8,代码来源:KKLayout.java


示例4: KKLayout

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
public KKLayout(Graph g, Distance distance)
{
    super(g);
    this.distance = distance;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:6,代码来源:KKLayout.java


示例5: createDistance

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Distance<V> createDistance() {
	return new DijkstraDistance(getGraph(), edgeWeights);
}
 
开发者ID:macc704,项目名称:KBDeX,代码行数:5,代码来源:KVertexClosenessCentralityWeightedScorer.java


示例6: createDistance

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Distance<V> createDistance() {
	return new UnweightedShortestPath(getGraph());
}
 
开发者ID:macc704,项目名称:KBDeX,代码行数:5,代码来源:KVertexClosenessCentralityScorer.java


示例7: DistanceCentralityScorer

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
/**
 * Creates an instance with the specified graph, distance metric, and 
 * averaging behavior.
 * 
 * @param graph     The graph on which the vertex scores are to be calculated.
 * @param distance  The metric to use for specifying the distance between 
 * pairs of vertices.
 * @param averaging Specifies whether the values returned is the sum of all 
 * v-distances or the mean v-distance.
 * @param ignore_missing	Specifies whether scores for missing distances 
 * are to ignore missing distances or be set to null.
 * @param ignore_self_distances	Specifies whether distances from a vertex
 * to itself should be included in its score.
 */
public DistanceCentralityScorer(Hypergraph<V,E> graph, Distance<V> distance, 
		boolean averaging, boolean ignore_missing, 
		boolean ignore_self_distances)
{
    this.graph = graph;
    this.distance = distance;
    this.averaging = averaging;
    this.ignore_missing = ignore_missing;
    this.ignore_self_distances = ignore_self_distances;
    this.output = new HashMap<V, Double>();
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:26,代码来源:DistanceCentralityScorer.java


示例8: ClosenessCentrality

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
/**
 * Creates an instance using the specified vertex/vertex distance metric.
 * @param graph the input
 * @param distance the vertex/vertex distance metric.
 */
public ClosenessCentrality(Hypergraph<V,E> graph, Distance<V> distance)
{
    super(graph, distance, true);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:10,代码来源:ClosenessCentrality.java


示例9: BarycenterScorer

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
/**
 * Creates an instance with the specified graph and distance metric.
 * @param graph the input graph
 * @param distance the distance metric to use
 */
public BarycenterScorer(Hypergraph<V,E> graph, Distance<V> distance)
{
    super(graph, distance, false);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:10,代码来源:BarycenterScorer.java


示例10: diameter

import edu.uci.ics.jung.algorithms.shortestpath.Distance; //导入依赖的package包/类
/**
 * Returns the diameter of <code>g</code> using the metric 
 * specified by <code>d</code>.  The diameter is defined to be
 * the maximum, over all pairs of vertices <code>u,v</code>,
 * of the length of the shortest path from <code>u</code> to 
 * <code>v</code>, or <code>Double.POSITIVE_INFINITY</code>
 * if any of these distances do not exist.
 * @see #diameter(ArchetypeGraph, Distance, boolean)
 */
public static double diameter(ArchetypeGraph g, Distance d)
{
    return diameter(g, d, false);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:14,代码来源:GraphStatistics.java



注:本文中的edu.uci.ics.jung.algorithms.shortestpath.Distance类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Property类代码示例发布时间:2022-05-22
下一篇:
Java ValueMap类代码示例发布时间: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