当前位置: 首页>>代码示例>>Java>>正文


Java UnweightedShortestPath类代码示例

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


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

示例1: getShortPrefix

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的package包/类
/** Returns a sequence of names labelling a shortest path from the initial node to node q. */
@SuppressWarnings("unchecked")
protected static List<Label> getShortPrefix(DirectedSparseGraph model, Vertex q){
	Vertex init = DeterministicDirectedSparseGraph.findInitial(model);
	UnweightedShortestPath p = new UnweightedShortestPath(model);
	Iterator<Edge> pathIt =  ShortestPathUtils.getPath(p, init, q).iterator();
	List<Label> list = new LinkedList<Label>();
	while(pathIt.hasNext()){
		Edge e = pathIt.next();
		Set<Label> s = (Set<Label>)e.getUserDatum(JUConstants.LABEL);
		Label[] strings = s.toArray(new Label[0]);
		list.add(strings[0]);
	}
		
	return list;
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:17,代码来源:Test_Orig_RPNIBlueFringeLearner.java

示例2: newLayout

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的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

示例3: initializeLocationsFromLayout

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的package包/类
public void initializeLocationsFromLayout(EmittedLayout sla) {
    super.initializeLocationsFromLayout(sla);
    vertices = sla.visVertexMap.keySet();

    int n = vertices.size();
    dm = new DenseDoubleMatrix2D(n, n);

    Graph theGraph = (Graph) ((Vertex) vertices.iterator().next())
            .getGraph();
    unweightedShortestPaths = new UnweightedShortestPath(theGraph);

    id = Indexer.getAndUpdateIndexer(theGraph, LAYOUT_INDEX_KEY);

    // This is practically fast, but it would be the best if we have an
    // implementation of All Pairs Shortest Paths(APSP) algorithm.
    diameter = getDiameter(n, id);

    int width = sla.getScreenSize().width;
    int height = sla.getScreenSize().height;

    double L0 = height > width ? width : height;
    L = L0 / diameter * 0.9;

    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            double dist = getDistance((Vertex) id.getVertex(i), (Vertex) id
                    .getVertex(j));
            dm.setQuick(i, j, dist);
            dm.setQuick(j, i, dist);
        }
    }
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:33,代码来源:KKLayout.java

示例4: getPath

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的package包/类
public List<E> getPath(V source, V target) {
    return (ShortestPathUtils.getPath(this.graph, new UnweightedShortestPath<V, E>(this.graph), source, target));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:4,代码来源:InnerGraphInformation.java

示例5: KKLayout

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

示例6: KKLayout

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

示例7: diameter

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的package包/类
/**
 * Returns the diameter of <code>g</code>, ignoring edge weights.
 * @see #diameter(ArchetypeGraph, Distance, boolean)
 */
public static double diameter(ArchetypeGraph g)
{
    return diameter(g, new UnweightedShortestPath((Graph)g));
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:9,代码来源:GraphStatistics.java

示例8: createDistance

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

示例9: DistanceCentralityScorer

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的package包/类
/**
 * Creates an instance with the specified graph and averaging behavior
 * whose vertex distances are calculated on the unweighted graph.  
 * 
 * @param graph         The graph on which the vertex scores are to be 
 * calculated.
 * @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, boolean averaging,
        boolean ignore_missing, boolean ignore_self_distances)
{
    this(graph, new UnweightedShortestPath<V,E>(graph), averaging, 
    	ignore_missing, ignore_self_distances);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:20,代码来源:DistanceCentralityScorer.java

示例10: averageDistances

import edu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath; //导入依赖的package包/类
/**
 * For each vertex <code>v</code> in <code>g</code>, 
 * calculates the average shortest path length from <code>v</code> 
 * to all other vertices in <code>g</code>, ignoring edge weights.
 * @see #diameter(ArchetypeGraph, Distance)
 */
public static Map averageDistances(ArchetypeGraph g)
{
    return averageDistances(g, new UnweightedShortestPath((Graph)g));
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:11,代码来源:GraphStatistics.java


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