edu.uci.ics.jung.graph.Graph.findEdge()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中edu.uci.ics.jung.graph.Graph.findEdge()方法的一些代码示例,展示了Graph.findEdge()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.findEdge()方法的具体详情如下:
包路径:edu.uci.ics.jung.graph.Graph
类名称:Graph
方法名:findEdge

Graph.findEdge介绍

暂无

代码示例

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

/**
 * Returns the first edge between the two vertices.
 * @param v1 The first vertex.
 * @param v2 The second vertex.
 * @return The edge or <code>null</code> if there is no incident edge
 * between the vertices.
 */
public Object findEdge(Object v1, Object v2)
{
  return (IComponentGroup)delegate.findEdge(v1, v2);
}

代码示例来源:origin: geogebra/geogebra

/**
 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object,
 *      java.lang.Object)
 */
@Override
public synchronized E findEdge(V v1, V v2) {
  return delegate.findEdge(v1, v2);
}

代码示例来源:origin: geogebra/geogebra

/**
 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object,
 *      java.lang.Object)
 */
@Override
public E findEdge(V v1, V v2) {
  return delegate.findEdge(v1, v2);
}

代码示例来源:origin: net.sf.jung/jung-api

/**
 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object, java.lang.Object)
 */
public E findEdge(V v1, V v2) {
  return delegate.findEdge(v1, v2);
}

代码示例来源:origin: geogebra/geogebra

/**
 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object,
 *      java.lang.Object)
 */
@Override
public E findEdge(V v1, V v2) {
  return delegate.findEdge(v1, v2);
}

代码示例来源:origin: net.sf.jung/jung-api

/**
 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object, java.lang.Object)
 */
public synchronized E findEdge(V v1, V v2) {
  return delegate.findEdge(v1, v2);
}

代码示例来源:origin: net.sf.jung/jung-api

/**
 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object, java.lang.Object)
 */
public E findEdge(V v1, V v2) {
  return delegate.findEdge(v1, v2);
}

代码示例来源:origin: net.sf.jung/jung-visualization

public E findEdge(V v1, V v2) {
  return graph.findEdge(v1, v2);
}
public Collection<E> findEdgeSet(V v1, V v2) {

代码示例来源:origin: net.sf.jung/jung-algorithms

/**
 * Returns the weight of the edge from <code>v1</code> to <code>v2</code>
 * plus the weight of the edge from <code>v2</code> to <code>v1</code>;
 * if either edge does not exist, it is treated as an edge with weight 0. 
 * Undirected edges are treated as two antiparallel directed edges (that
 * is, if there is one undirected edge with weight <i>w</i> connecting 
 * <code>v1</code> to <code>v2</code>, the value returned is 2<i>w</i>).
 * Ignores parallel edges; if there are any such, one is chosen at random.
 * Throws <code>NullPointerException</code> if either edge is 
 * present but not assigned a weight by the constructor-specified
 * <code>NumberEdgeValue</code>.
 * 
 * @param v1 the first vertex of the pair whose property is being measured
 * @param v2 the second vertex of the pair whose property is being measured
 * @return the weights of the edges {@code<v1, v2>} and {@code <v2, v1>}
 */
protected double mutualWeight(V v1, V v2)
{
  E e12 = g.findEdge(v1,v2);
  E e21 = g.findEdge(v2,v1);
  double w12 = (e12 != null ? edge_weight.apply(e12).doubleValue() : 0);
  double w21 = (e21 != null ? edge_weight.apply(e21).doubleValue() : 0);
  
  return w12 + w21;
}

代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2

/**
 * Returns the weight of the edge from <code>v1</code> to <code>v2</code>
 * plus the weight of the edge from <code>v2</code> to <code>v1</code>;
 * if either edge does not exist, it is treated as an edge with weight 0. 
 * Undirected edges are treated as two antiparallel directed edges (that
 * is, if there is one undirected edge with weight <i>w</i> connecting 
 * <code>v1</code> to <code>v2</code>, the value returned is 2<i>w</i>).
 * Ignores parallel edges; if there are any such, one is chosen at random.
 * Throws <code>NullPointerException</code> if either edge is 
 * present but not assigned a weight by the constructor-specified
 * <code>NumberEdgeValue</code>.
 */
protected double mutualWeight(V v1, V v2)
{
  E e12 = g.findEdge(v1,v2);
  E e21 = g.findEdge(v2,v1);
  double w12 = (e12 != null ? edge_weight.transform(e12).doubleValue() : 0);
  double w21 = (e21 != null ? edge_weight.transform(e21).doubleValue() : 0);
  
  return w12 + w21;
}

代码示例来源:origin: geogebra/geogebra

/**
 * @param target
 * @param e
 * @param incident
 */
private static <S, T> void populateTarget(Graph<S, Collection<T>> target,
    T e, ArrayList<S> incident) {
  for (int i = 0; i < incident.size(); i++) {
    S v1 = incident.get(i);
    for (int j = i + 1; j < incident.size(); j++) {
      S v2 = incident.get(j);
      Collection<T> e_coll = target.findEdge(v1, v2);
      if (e_coll == null) {
        e_coll = new ArrayList<T>();
        target.addEdge(e_coll, v1, v2);
      }
      e_coll.add(e);
    }
  }
}

代码示例来源:origin: geogebra/geogebra

/**
 * Returns the weight of the edge from <code>v1</code> to <code>v2</code>
 * plus the weight of the edge from <code>v2</code> to <code>v1</code>; if
 * either edge does not exist, it is treated as an edge with weight 0.
 * Undirected edges are treated as two antiparallel directed edges (that is,
 * if there is one undirected edge with weight <i>w</i> connecting
 * <code>v1</code> to <code>v2</code>, the value returned is 2<i>w</i>).
 * Ignores parallel edges; if there are any such, one is chosen at random.
 * Throws <code>NullPointerException</code> if either edge is present but
 * not assigned a weight by the constructor-specified
 * <code>NumberEdgeValue</code>.
 */
protected double mutualWeight(V v1, V v2) {
  E e12 = g.findEdge(v1, v2);
  E e21 = g.findEdge(v2, v1);
  double w12 = (e12 != null ? edge_weight.transform(e12).doubleValue()
      : 0);
  double w21 = (e21 != null ? edge_weight.transform(e21).doubleValue()
      : 0);
  return w12 + w21;
}

代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2

/**
 * @param target
 * @param e
 * @param incident
 */
private static <S,T> void populateTarget(Graph<S, Collection<T>> target, T e,
    ArrayList<S> incident)
{
  for (int i = 0; i < incident.size(); i++)
  {
    S v1 = incident.get(i);
    for (int j = i+1; j < incident.size(); j++)
    {
      S v2 = incident.get(j);
      Collection<T> e_coll = target.findEdge(v1, v2);
      if (e_coll == null)
      {
        e_coll = new ArrayList<T>();
        target.addEdge(e_coll, v1, v2);
      }
      e_coll.add(e);
    }
  }
}

代码示例来源:origin: net.sf.jung/jung-algorithms

/**
 * @param target
 * @param e
 * @param incident
 */
private static <S,T> void populateTarget(Graph<S, Collection<T>> target, T e,
    ArrayList<S> incident)
{
  for (int i = 0; i < incident.size(); i++)
  {
    S v1 = incident.get(i);
    for (int j = i+1; j < incident.size(); j++)
    {
      S v2 = incident.get(j);
      Collection<T> e_coll = target.findEdge(v1, v2);
      if (e_coll == null)
      {
        e_coll = new ArrayList<T>();
        target.addEdge(e_coll, v1, v2);
      }
      e_coll.add(e);
    }
  }
}

代码示例来源:origin: net.sf.jung/jung-algorithms

continue;
newGraph.addVertex(t);
Collection<V> v_coll = newGraph.findEdge(v, t);
if (v_coll == null)

代码示例来源: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: uk.gov.dstl.baleen/baleen-orderers

private void addAnnotatorDependencies(
  Graph<AnalysisEngine, Integer> graph, AnalysisEngine ae1, AnalysisEngine ae2) {
 // If there's already a dependency, then just return as we don't want multiple edges
 if (graph.findEdge(ae1, ae2) != null) return;
 // If the inputs of ae1 match the outputs of ae2, then ae1 is dependent on ae2
 // We don't need to check both ways as this will be caught by the loop, although
 // we could be more efficient here.
 AnalysisEngineAction a1 = getAction(ae1);
 AnalysisEngineAction a2 = getAction(ae2);
 if (overlaps(a1.getInputs(), a2.getOutputs())) {
  graph.addEdge(++edgeId, ae2, ae1, EdgeType.DIRECTED);
  return;
 }
}

代码示例来源:origin: dstl/baleen

private void addAnnotatorDependencies(
  Graph<AnalysisEngine, Integer> graph, AnalysisEngine ae1, AnalysisEngine ae2) {
 // If there's already a dependency, then just return as we don't want multiple edges
 if (graph.findEdge(ae1, ae2) != null) return;
 // If the inputs of ae1 match the outputs of ae2, then ae1 is dependent on ae2
 // We don't need to check both ways as this will be caught by the loop, although
 // we could be more efficient here.
 AnalysisEngineAction a1 = getAction(ae1);
 AnalysisEngineAction a2 = getAction(ae2);
 if (overlaps(a1.getInputs(), a2.getOutputs())) {
  graph.addEdge(++edgeId, ae2, ae1, EdgeType.DIRECTED);
  return;
 }
}

代码示例来源:origin: org.opendaylight.nic/of-renderer

/**
 * Set the Graph's links so that it can be built.
 *
 * @param newlinks
 *            All the Network-Topology Links.
 */
@Override
public synchronized void setLinks(List<Link> newlinks) {
  CurrentLinks.clear();
  CurrentLinks.addAll(newlinks);
  for (final Link link : newlinks) {
   NodeId sourceNodeId = link.getSource().getSourceNode();
   NodeId destinationNodeId = link.getDestination().getDestNode();
    if (networkGraph.findEdge(sourceNodeId, destinationNodeId) == null) {
      if (!networkGraph.containsVertex(sourceNodeId)) {
        networkGraph.addVertex(sourceNodeId);
      }
      if (!networkGraph.containsVertex(destinationNodeId)) {
        networkGraph.addVertex(destinationNodeId);
      }
      networkGraph.addEdge(link, sourceNodeId, destinationNodeId, EdgeType.DIRECTED);
    }
  }
}

相关文章