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

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

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

Graph.getPredecessors介绍

[英]Returns a Collection view of the predecessors of vertex in this graph. A predecessor of vertex is defined as a vertex v which is connected to vertex by an edge e, where e is an outgoing edge of v and an incoming edge of vertex.
[中]返回此图中vertex的前辈的Collection视图。vertex的前身定义为一个顶点v,该顶点通过一条边e连接到vertex,其中ev的输出边和vertex的输入边。

代码示例

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

/**
 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
 */
public synchronized Collection<V> getPredecessors(V vertex) {
  return delegate.getPredecessors(vertex);
}

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

public Collection<V> getPredecessors(V vertex) {
  return graph.getPredecessors(vertex);
}
public V getSource(E directedEdge) {

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

/**
 * Returns the vertices that have an outgoing edge to the given vertex.
 * @param vertex The vertex.
 * @return The collection of vertices.
 */
public Collection getPredecessors(Object vertex)
{
  return delegate.getPredecessors(vertex);
}

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

/**
 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
 */
@Override
public synchronized Collection<V> getPredecessors(V vertex) {
  return delegate.getPredecessors(vertex);
}

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

/**
 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
 */
@Override
public Collection<V> getPredecessors(V vertex) {
  return delegate.getPredecessors(vertex);
}

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

/**
 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
 */
@Override
public Collection<V> getPredecessors(V vertex) {
  return delegate.getPredecessors(vertex);
}

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

/**
 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
 */
public Collection<V> getPredecessors(V vertex) {
  return delegate.getPredecessors(vertex);
}

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

/**
 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
 */
public Collection<V> getPredecessors(V vertex) {
  return delegate.getPredecessors(vertex);
}

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

@Override
public V getParent(V child) {
  if (!delegate.containsVertex(child)) {
    return null;
  }
  Collection<V> parents = delegate.getPredecessors(child);
  if (parents.size() > 0) {
    return parents.iterator().next();
  }
  return null;
}

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

/**
 * get the single parent node of the passed child
 */
public V getParent(V child) {
  if (!delegate.containsVertex(child))
    return null;
  Collection<V> predecessors = delegate.getPredecessors(child);
  if(predecessors.size() == 0) {
    return null;
  }
  return predecessors.iterator().next();
}

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

public V getParent(V child) {
  if (!delegate.containsVertex(child))
    return null;
  Collection<V> parents = delegate.getPredecessors(child);
  if(parents.size() > 0) {
    return parents.iterator().next();
  }
  return null;
}

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

/**
 * get the single parent node of the passed child
 */
@Override
public V getParent(V child) {
  if (!delegate.containsVertex(child)) {
    return null;
  }
  Collection<V> predecessors = delegate.getPredecessors(child);
  if (predecessors.size() == 0) {
    return null;
  }
  return predecessors.iterator().next();
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default

/**
 * Dimension are calculated directed.
 * 
 * @param v
 *            node to start with
 * @return max X for subtree starting at v
 */
private int calculateDimensionX(ONDEXConcept v) {
  int size = 0;
  // stack for performing a breadth first search
  LinkedList<ONDEXConcept> stack = new LinkedList<ONDEXConcept>();
  stack.add(v);
  Set<ONDEXConcept> seen = new HashSet<ONDEXConcept>();
  while (!stack.isEmpty()) {
    ONDEXConcept current = stack.pop();
    if (!seen.contains(current)) {
      // check selection of edge direction
      if (reversed)
        stack.addAll(graph.getPredecessors(current));
      else
        stack.addAll(graph.getSuccessors(current));
      // check dimension for children
      size = distX;
      size = Math.max(0, size - distX);
      basePositions.put(current, size);
      seen.add(current);
    }
  }
  return size;
}

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

/**
 * A recursive method for allocating the level for each vertex. Ensures
 * that all predecessors of v have a level which is at least one greater
 * than the level of v.
 *
 * @param v the vertex whose minimum level is to be calculated
 */
public void propagateMinimumLevel(V v) {
  int level = minLevels.get(v).intValue();
  for(V child : getGraph().getPredecessors(v)) {
    int oldLevel, newLevel;
    Number o = minLevels.get(child);
    if (o != null)
      oldLevel = o.intValue();
    else
      oldLevel = 0;
    newLevel = Math.max(oldLevel, level + 1);
    minLevels.put(child, new Integer(newLevel));
    if (newLevel > graphHeight)
      graphHeight = newLevel;
    propagateMinimumLevel(child);
  }
}

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

/**
 * A recursive method for allocating the level for each vertex. Ensures
 * that all predecessors of v have a level which is at least one greater
 * than the level of v.
 *
 * @param v
 */
public void propagateMinimumLevel(V v) {
  int level = minLevels.get(v).intValue();
  for(V child : getGraph().getPredecessors(v)) {
    int oldLevel, newLevel;
    Number o = minLevels.get(child);
    if (o != null)
      oldLevel = o.intValue();
    else
      oldLevel = 0;
    newLevel = Math.max(oldLevel, level + 1);
    minLevels.put(child, new Integer(newLevel));
    if (newLevel > graphHeight)
      graphHeight = newLevel;
    propagateMinimumLevel(child);
  }
}

代码示例来源:origin: griddynamics/jagger

private void assembleTraceBack(MethodProfile pivot, Graph<MethodProfile, InvocationProfile> neighborhood, List<MethodElement> bag, int maxDepth, int depth) {
  bag.add(assembleMethodElement(pivot, depth));
  if (depth < maxDepth) {
    Collection<MethodProfile> callers = neighborhood.getPredecessors(pivot);
    if (callers != null) {
      List<MethodProfile> callersList = Lists.newArrayList(callers);
      Collections.sort(callersList, new Comparator<MethodProfile>() {
        @Override
        public int compare(MethodProfile p1, MethodProfile p2) {
          return -Double.compare(p1.getInStackRatio(), p2.getInStackRatio());
        }
      });
      for (MethodProfile caller : callersList) {
        assembleTraceBack(caller, neighborhood, bag, maxDepth, depth + 1);
      }
    }
  }
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default

/**
 * Calculate the global size of trees for all nodes.
 * 
 * @param roots
 *            list of roots
 * @return max X for all subtrees
 */
private int calculateDimensionX(Collection<ONDEXConcept> roots) {
  int size = 0;
  for (ONDEXConcept v : roots) {
    // check selection of edge direction
    Collection<ONDEXConcept> children = null;
    if (reversed)
      children = graph.getPredecessors(v);
    else
      children = graph.getSuccessors(v);
    // check dimension for children
    int childrenNum = children.size();
    if (childrenNum != 0) {
      for (ONDEXConcept element : children) {
        // recursion step
        size += calculateDimensionX(element) + distX;
      }
    }
    // base step
    size = Math.max(0, size - distX);
    basePositions.put(v, size);
  }
  return size;
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default

/**
 * Returns the list of siblings, which are leaf nodes of the graph.
 * 
 * @param p
 *            current ONDEXConcept to start with
 * @param v
 *            List<ONDEXConcept> contains siblings of p
 */
private void getAtomics(ONDEXConcept p, List<ONDEXConcept> v) {
  // check selection of edge direction
  Collection<ONDEXConcept> parents = null;
  if (reversed)
    parents = graph.getPredecessors(p);
  else
    parents = graph.getSuccessors(p);
  for (ONDEXConcept c : parents) {
    // check selection of edge direction
    Collection<ONDEXConcept> children = null;
    if (reversed)
      children = graph.getPredecessors(c);
    else
      children = graph.getSuccessors(c);
    if (children.size() == 0) {
      v.add(c);
    } else {
      getAtomics(c, v);
    }
  }
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default

parents = graph.getPredecessors(v);
else
  parents = graph.getSuccessors(v);
    children = graph.getPredecessors(c);
  else
    children = graph.getSuccessors(c);

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default

/**
 * Calculate the overall X dimension for a number of roots.
 * 
 * @param roots
 *            Collection<ONDEXConcept> containing roots
 * @return total X dimension
 */
private int calculateDimensionX(Collection<ONDEXConcept> roots) {
  int size = 0;
  for (ONDEXConcept v : roots) {
    // check selection of edge direction
    Collection<ONDEXConcept> children = null;
    if (reversed)
      children = graph.getPredecessors(v);
    else
      children = graph.getSuccessors(v);
    // check dimension for children
    int childrenNum = children.size();
    if (childrenNum != 0) {
      for (ONDEXConcept element : children) {
        // recursion step
        size += calculateDimensionX(element) + distX;
      }
    }
    // base step
    size = Math.max(0, size - distX);
    basePositions.put(v, size);
  }
  return size;
}

相关文章