com.google.common.graph.Network.predecessors()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(183)

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

Network.predecessors介绍

暂无

代码示例

代码示例来源:origin: google/guava

@Override
public Set<N> predecessors(N node) {
 return network.predecessors(node);
}

代码示例来源:origin: google/guava

@Override
public Set<N> successors(N node) {
 return delegate().predecessors(node); // transpose
}

代码示例来源:origin: google/guava

@Override
public Set<N> predecessors(N node) {
 return delegate().predecessors(node);
}

代码示例来源:origin: google/j2objc

@Override
public Set<N> successors(N node) {
 return delegate().predecessors(node); // transpose
}

代码示例来源:origin: google/j2objc

@Override
public Set<N> predecessors(N node) {
 return delegate().predecessors(node);
}

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

@Override
public Set<N> predecessors(N node) {
 return delegate().predecessors(node);
}

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

@Override
public Set<N> successors(N node) {
 return delegate().predecessors(node); // transpose
}

代码示例来源:origin: google/guava

assertThat(network.outEdges(nodeU)).contains(edge);
assertThat(network.incidentEdges(nodeU)).contains(edge);
assertThat(network.predecessors(nodeV)).contains(nodeU);
assertThat(network.adjacentNodes(nodeV)).contains(nodeU);
assertThat(network.inEdges(nodeV)).contains(edge);
assertThat(network.predecessors(node)).isEqualTo(asGraph.predecessors(node));
assertThat(network.successors(node)).isEqualTo(asGraph.successors(node));
 assertThat(network.outEdges(node)).hasSize(network.outDegree(node));
} else {
 assertThat(network.predecessors(node)).isEqualTo(network.adjacentNodes(node));
 assertThat(network.successors(node)).isEqualTo(network.adjacentNodes(node));
 assertThat(network.inEdges(node)).isEqualTo(network.incidentEdges(node));
 assertThat(network.predecessors(otherNode).contains(node)).isEqualTo(connected);
 for (E edge : edgesConnecting) {
  assertThat(network.incidentNodes(edge))
   network.predecessors(node).contains(adjacentNode)
     || network.successors(node).contains(adjacentNode));
 assertTrue(
for (N predecessor : sanityCheckSet(network.predecessors(node))) {
 assertThat(network.successors(predecessor)).contains(node);
 assertThat(network.edgesConnecting(predecessor, node)).isNotEmpty();
 assertThat(network.predecessors(successor)).contains(node);
 assertThat(network.edgesConnecting(node, successor)).isNotEmpty();

代码示例来源:origin: com.google.guava/guava-tests

@Override
public Set<N> predecessors(N node) {
 return network.predecessors(node);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public Set<N> successors(N node) {
 return delegate().predecessors(node); // transpose
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@Override
public Set<N> successors(N node) {
 return delegate().predecessors(node); // transpose
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public Set<N> predecessors(N node) {
 return delegate().predecessors(node);
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@Override
public Set<N> predecessors(N node) {
 return delegate().predecessors(node);
}

代码示例来源:origin: jrtom/jung

/**
 * A graph is "forest-shaped" if it is directed, acyclic, and each node has at most one
 * predecessor.
 */
public static <N> boolean isForestShaped(Network<N, ?> graph) {
 checkNotNull(graph, "graph");
 return graph.isDirected()
   && !Graphs.hasCycle(graph)
   && graph.nodes().stream().allMatch(node -> graph.predecessors(node).size() <= 1);
}

代码示例来源:origin: jrtom/jung

for (N u : graph.predecessors(v)) {
 for (E e : graph.edgesConnecting(u, v)) {
  double weight = getEdgeWeight(u, e).doubleValue();

代码示例来源:origin: jrtom/jung

/** Updates the value for this node. Called by <code>step()</code>. */
@Override
public double update(N v) {
 collectDisappearingPotential(v);
 double v_input = 0;
 for (N u : graph.predecessors(v)) {
  for (E e : graph.edgesConnecting(u, v)) {
   v_input += (getCurrentValue(u) * getEdgeWeight(u, e).doubleValue());
  }
 }
 // modify total_input according to alpha
 double new_value = alpha > 0 ? v_input * (1 - alpha) + getNodePrior(v) * alpha : v_input;
 setOutputValue(v, new_value);
 return Math.abs(getCurrentValue(v) - new_value);
}

代码示例来源:origin: jrtom/jung

/** Updates the value for this node. Called by <code>step()</code>. */
 @Override
 public double update(N v) {
  if (!cumulative) {
   return super.update(v);
  }

  collectDisappearingPotential(v);

  double v_input = 0;
  for (N u : graph.predecessors(v)) {
   for (E e : graph.edgesConnecting(u, v)) {
    v_input += (getCurrentValue(u) * getEdgeWeight(u, e).doubleValue());
   }
  }

  // modify total_input according to alpha
  double new_value = alpha > 0 ? v_input * (1 - alpha) + getNodePrior(v) * alpha : v_input;
  setOutputValue(v, new_value + getCurrentValue(v));

  // FIXME: DO WE NEED TO CHANGE HOW DISAPPEARING IS COUNTED?  NORMALIZE?

  return Math.abs(getCurrentValue(v) - new_value);
 }
}

代码示例来源:origin: jrtom/jung

/** Updates the value for this node. */
@Override
protected double update(N v) {
 collectDisappearingPotential(v);
 double v_auth = 0;
 for (N u : graph.predecessors(v)) {
  for (E e : graph.edgesConnecting(u, v)) {
   v_auth += (getCurrentValue(u).hub * getEdgeWeight(u, e).doubleValue());
  }
 }
 double v_hub = 0;
 for (N w : graph.successors(v)) {
  for (E e : graph.edgesConnecting(v, w)) {
   v_hub += (getCurrentValue(w).authority * getEdgeWeight(w, e).doubleValue());
  }
 }
 // modify total_input according to alpha
 if (alpha > 0) {
  v_auth = v_auth * (1 - alpha) + getNodePrior(v).authority * alpha;
  v_hub = v_hub * (1 - alpha) + getNodePrior(v).hub * alpha;
 }
 setOutputValue(v, new HITS.Scores(v_hub, v_auth));
 return Math.max(
   Math.abs(getCurrentValue(v).hub - v_hub), Math.abs(getCurrentValue(v).authority - v_auth));
}

代码示例来源:origin: com.google.guava/guava-tests

assertThat(network.outEdges(nodeU)).contains(edge);
assertThat(network.incidentEdges(nodeU)).contains(edge);
assertThat(network.predecessors(nodeV)).contains(nodeU);
assertThat(network.adjacentNodes(nodeV)).contains(nodeU);
assertThat(network.inEdges(nodeV)).contains(edge);
assertThat(network.predecessors(node)).isEqualTo(asGraph.predecessors(node));
assertThat(network.successors(node)).isEqualTo(asGraph.successors(node));
 assertThat(network.outEdges(node)).hasSize(network.outDegree(node));
} else {
 assertThat(network.predecessors(node)).isEqualTo(network.adjacentNodes(node));
 assertThat(network.successors(node)).isEqualTo(network.adjacentNodes(node));
 assertThat(network.inEdges(node)).isEqualTo(network.incidentEdges(node));
 assertThat(network.predecessors(otherNode).contains(node)).isEqualTo(connected);
 for (E edge : edgesConnecting) {
  assertThat(network.incidentNodes(edge))
   network.predecessors(node).contains(adjacentNode)
     || network.successors(node).contains(adjacentNode));
 assertTrue(
for (N predecessor : sanityCheckSet(network.predecessors(node))) {
 assertThat(network.successors(predecessor)).contains(node);
 assertThat(network.edgesConnecting(predecessor, node)).isNotEmpty();
 assertThat(network.predecessors(successor)).contains(node);
 assertThat(network.edgesConnecting(node, successor)).isNotEmpty();

相关文章