當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。