本文整理了Java中edu.uci.ics.jung.graph.Graph.getDest()
方法的一些代码示例,展示了Graph.getDest()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getDest()
方法的具体详情如下:
包路径:edu.uci.ics.jung.graph.Graph
类名称:Graph
方法名:getDest
[英]If directed_edge
is a directed edge in this graph, returns the destination; otherwise returns null
. The destination of a directed edge d
is defined to be the vertex incident to d
for which d
is an incoming edge. directed_edge
is guaranteed to be a directed edge if its EdgeType
is DIRECTED
.
[中]如果directed_edge
是此图中的有向边,则返回目标;否则返回null
。定向边d
的目标定义为与d
关联的顶点,其中d
是传入边。如果EdgeType
是DIRECTED
,则directed_edge
保证为定向边。
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
*/
public V getDest(E directed_edge) {
return delegate.getDest(directed_edge);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
*/
@Override
public V getDest(E directed_edge) {
return delegate.getDest(directed_edge);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
*/
@Override
public synchronized V getDest(E directed_edge) {
return delegate.getDest(directed_edge);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
*/
@Override
public V getDest(E directed_edge) {
return delegate.getDest(directed_edge);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
*/
public V getDest(E directed_edge) {
return delegate.getDest(directed_edge);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
*/
public synchronized V getDest(E directed_edge) {
return delegate.getDest(directed_edge);
}
代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer
/**
* Returns the destination of a directed edge.
* @param directed_edge The edge.
* @return The vertex.
*/
public Object getDest(Object directed_edge)
{
return delegate.getDest(directed_edge);
}
代码示例来源:origin: net.sf.jung/jung-visualization
public V getDest(E directedEdge) {
return graph.getDest(directedEdge);
}
public int getEdgeCount() {
代码示例来源:origin: org.opendaylight.nic/of-renderer
private boolean isDestination(final V target, final List<E> resultPath) {
return graph.getDest(resultPath.get(resultPath.size() - 1)).equals(target);
}
代码示例来源:origin: girtel/Net2Plan
private static <V, E> void validatePath(Graph<V, E> graph, V source, V target, List<E> path)
{
if (!graph.isSource(source, path.get(0))) throw new RuntimeException("Bad - Source node is not the first node in the path");
Iterator<E> it = path.iterator();
E originVertex = it.next();
while (it.hasNext())
{
E destinationVertex = it.next();
if (!graph.isSource(graph.getDest(originVertex), destinationVertex)) throw new RuntimeException("Bad - Path is not contiguous");
originVertex = destinationVertex;
}
if (!graph.isDest(target, path.get(path.size() - 1))) throw new RuntimeException("Bad - ");
}
代码示例来源:origin: org.opendaylight.nic/of-renderer
private List<E> restorePaths(final List<E> path, final V target, final List<E> partialMergedPaths) {
final List<E> resultPath = new ArrayList<>();
resultPath.add(path.get(0));
partialMergedPaths.remove(path.get(0));
if (!isDestination(target, resultPath)){
V currentDestination = graph.getDest(resultPath.get(resultPath.size() - 1));
for (E edge : partialMergedPaths){
if (graph.isSource(currentDestination, edge)) {
resultPath.add(edge);
partialMergedPaths.remove(edge);
break;
}
}
}
return resultPath;
}
代码示例来源:origin: com.github.fburato/highwheel-core
private void tarjan(final V v, final Graph<V, E> g) {
this.indexmap.put(v, this.index);
this.lowlinkmap.put(v, this.index);
this.index++;
this.stack.add(0, v);
for (final E e : g.getOutEdges(v)) {
final V n = g.getDest(e);
if (this.indexmap.get(n) == null) {
tarjan(n, g);
this.lowlinkmap.put(v,
Math.min(this.lowlinkmap.get(v), this.lowlinkmap.get(n)));
} else if (this.stack.contains(n)) {
this.lowlinkmap.put(v,
Math.min(this.lowlinkmap.get(v), this.indexmap.get(n)));
}
}
if (this.lowlinkmap.get(v).equals(this.indexmap.get(v))) {
final Set<V> component = new HashSet<V>();
V n;
do {
n = this.stack.remove(0);
component.add(n);
} while (n != v);
this.scc.add(component);
}
}
代码示例来源:origin: org.pitest/highwheel-core
private void tarjan(final V v, final Graph<V, E> g) {
this.indexmap.put(v, this.index);
this.lowlinkmap.put(v, this.index);
this.index++;
this.stack.add(0, v);
for (final E e : g.getOutEdges(v)) {
final V n = g.getDest(e);
if (this.indexmap.get(n) == null) {
tarjan(n, g);
this.lowlinkmap.put(v,
Math.min(this.lowlinkmap.get(v), this.lowlinkmap.get(n)));
} else if (this.stack.contains(n)) {
this.lowlinkmap.put(v,
Math.min(this.lowlinkmap.get(v), this.indexmap.get(n)));
}
}
if (this.lowlinkmap.get(v).equals(this.indexmap.get(v))) {
final Set<V> component = new HashSet<V>();
V n;
do {
n = this.stack.remove(0);
component.add(n);
} while (n != v);
this.scc.add(component);
}
}
代码示例来源:origin: girtel/Net2Plan
private List<E> recombinePaths(List<E> path, V target, List<E> union)
{
LinkedList<E> p = new LinkedList<E>(); /* provides getLast */
p.add(path.get(0));
union.remove(path.get(0));
V curDest;
while (!(curDest = graph.getDest(p.getLast())).equals(target))
{
boolean progress = false;
for (E e : union)
{
if (graph.isSource(curDest, e))
{
p.add(e);
progress = true;
union.remove(e);
break;
}
}
if (!progress) return null;
if (union.isEmpty())
{
if (!graph.isDest(target, p.getLast()))
throw new RuntimeException("Bad");
else
break;
}
}
return p;
}
代码示例来源:origin: org.opendaylight.nic/of-renderer
private void discardCommonReversedEdges(final Graph<V,E> graph, final List<E> path1, final List<E> path2) {
if (path1.size() == 0 || path2.size() == 0){
return;
} else {
final V source = graph.getSource(path1.get(0));
final V target = graph.getDest(path1.get(path1.size() - 1));
for(final E edge2 : path2){
for(final E edge1 : path1){
if (edge1.equals(edge2)){
if (graph.isSource(source, edge1) ||
graph.isSource(source, edge2) ||
graph.isDest(target, edge1) ||
graph.isDest(target, edge2)){
// Return only shortest path
path2.clear();
return;
}
path1.remove(edge1);
path2.remove(edge2);
break;
}
}
}
}
}
代码示例来源:origin: org.opendaylight.nic/of-renderer
protected List<E> reverseUpdateEdgesWeight(final Graph<V, E> graph, final Transformer<V, Number> transformer,
final List<E> shortestPath, final V initial, final V destination) {
for(final E edge1 : shortestPath){
V src = graph.getSource(edge1);
V dst = graph.getDest(edge1);
graph.removeEdge(edge1);
graph.addEdge(edge1, dst, src, EdgeType.DIRECTED);
}
final List<E> edges = new ArrayList<>(graph.getEdges());
final Map<E, Number> map = new LinkedHashMap<>();
edges.forEach(edge -> {
final V source = graph.getSource(edge);
final V dest = graph.getDest(edge);
Number cost = calculateCost(transformer, edge, source, dest);
map.put(edge,cost);
});
final DijkstraShortestPath<V, E> reversedDijkstra =
new DijkstraShortestPath<>(graph, MapTransformer.getInstance(map));
DijkstraShortestPath<V, E> validatedShortestPath = checkPath(initial, destination, reversedDijkstra);
return validatedShortestPath != null ? reversedDijkstra.getPath(initial, destination) : new ArrayList<>();
}
代码示例来源:origin: uk.gov.dstl.baleen/baleen-orderers
/** Find and remove simple loops (e.g. a -> b -> a) from a Jung graph */
public static <V, E> void removeLoops(Graph<V, E> graph) {
for (V v : graph.getVertices()) {
for (E e : graph.getOutEdges(v)) {
V dest = graph.getDest(e);
E returnEdge = graph.findEdge(dest, v);
if (returnEdge != null) {
LOGGER.warn(
"Loop detected between {} and {}. Original order will be preserved.",
getName(v),
getName(dest));
graph.removeEdge(returnEdge);
}
}
}
}
代码示例来源:origin: dstl/baleen
/** Find and remove simple loops (e.g. a -> b -> a) from a Jung graph */
public static <V, E> void removeLoops(Graph<V, E> graph) {
for (V v : graph.getVertices()) {
for (E e : graph.getOutEdges(v)) {
V dest = graph.getDest(e);
E returnEdge = graph.findEdge(dest, v);
if (returnEdge != null) {
LOGGER.warn(
"Loop detected between {} and {}. Original order will be preserved.",
getName(v),
getName(dest));
graph.removeEdge(returnEdge);
}
}
}
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default
Point2D dest = viewer.getGraphLayout().transform(graph.getDest(edge));
xmlw.writeStartElement("y:Point");
xmlw.writeAttribute("x", String.valueOf(source.getX()));
代码示例来源:origin: girtel/Net2Plan
/** This method reverse the path "path" in the graph "graph" and returns it.
*
* @param graph the input graph which will not be changed.
* @param path the path to reverse
* @return a new graph with the reversed path
* @since 0.3.0 */
private static <V, E> Graph<V, E> reverseEdges(Graph<V, E> graph, List<E> path)
{
if (graph == null || path == null) throw new IllegalArgumentException();
Graph<V, E> clone = new DirectedOrderedSparseMultigraph<V, E>();
for (V v : graph.getVertices())
clone.addVertex(v);
for (E e : graph.getEdges())
clone.addEdge(e, graph.getEndpoints(e));
for (E link : path)
{
V src = clone.getSource(link);
V dst = clone.getDest(link);
clone.removeEdge(link);
clone.addEdge(link, dst, src, EdgeType.DIRECTED);
}
return clone;
}
内容来源于网络,如有侵权,请联系作者删除!