本文整理匯總了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();
}
}
示例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());
}
}
示例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);
}