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


Java Graph.getEndpoints方法代码示例

本文整理汇总了Java中edu.uci.ics.jung.graph.Graph.getEndpoints方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.getEndpoints方法的具体用法?Java Graph.getEndpoints怎么用?Java Graph.getEndpoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uci.ics.jung.graph.Graph的用法示例。


在下文中一共展示了Graph.getEndpoints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transform

import edu.uci.ics.jung.graph.Graph; //导入方法依赖的package包/类
@Override
public Shape transform(Context<Graph<V, E>, E> context) {

	// --- Get the shape for this edge, returning either the --------------
	// --- shared instance or, in the case of self-loop edges, the --------
	// --- SimpleLoop shared instance.
	
	Graph<V,E> graph = context.graph;
   	E e = context.element;
       
       Pair<V> endpoints = graph.getEndpoints(e);
       if(endpoints != null) {
       	boolean isLoop = endpoints.getFirst().equals(endpoints.getSecond());
       	if (isLoop) {
       		return this.getLoop().transform(context);
       	}
       }
       // --- Return the edge shape ------------------------------------------
       if (e instanceof GraphEdge) {
       	return this.getGeneralPath((GraphEdge)e);
       } else {
       	return this.getLine();
       }
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:25,代码来源:EdgeShapePolyline.java

示例2: main

import edu.uci.ics.jung.graph.Graph; //导入方法依赖的package包/类
public static void main(String[] args) {
	// create FNSS topology
	Topology topology = new Topology();
	topology.addEdge("1", "2", new Edge());
	topology.addEdge("2", "3", new Edge());
	
	// convert to JGraphT
	Graph<String, Edge> graph = JUNGConverter.getGraph(topology);
	
	// Find shortest paths
	String source = "3";
	String destination = "1";
	DijkstraShortestPath<String, Edge> shortestPath = 
			new DijkstraShortestPath<String, Edge>(graph);
	List<Edge> path = shortestPath.getPath(source, destination);

	// Print results
	System.out.println("Shortest path from " + source + " to " + destination + ":");
	for (Edge e : path) {
		Pair<String> endpoints = graph.getEndpoints(e);
		System.out.println(endpoints.getFirst() + " -> " + endpoints.getSecond());
	}
}
 
开发者ID:fnss,项目名称:fnss-java,代码行数:24,代码来源:ExampleJUNG.java

示例3: DeleteEdgeUndoableAction

import edu.uci.ics.jung.graph.Graph; //导入方法依赖的package包/类
public DeleteEdgeUndoableAction(Graph<Vertex, Edge> graph, Edge edge) {
	this.graph = graph;
	this.edge = edge;
	this.endpoints = graph.getEndpoints(edge);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:6,代码来源:DeleteEdgeUndoableAction.java


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