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

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

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

Network.inEdges介绍

[英]Returns all edges in this network which can be traversed in the direction (if any) of the edge to end at node.

In a directed network, an incoming edge's EndpointPair#target() equals node.

In an undirected network, this is equivalent to #incidentEdges(Object).
[中]

代码示例

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

@Override
public Set<E> outEdges(N node) {
 return delegate().inEdges(node); // transpose
}

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

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

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

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

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

@Override
public Set<E> outEdges(N node) {
 return delegate().inEdges(node); // transpose
}

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

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

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

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

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

@Override
public Set<E> outEdges(N node) {
 return delegate().inEdges(node); // transpose
}

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

private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) {
 if (network.isDirected()) {
  Map<E, N> inEdgeMap = Maps.asMap(network.inEdges(node), sourceNodeFn(network));
  Map<E, N> outEdgeMap = Maps.asMap(network.outEdges(node), targetNodeFn(network));
  int selfLoopCount = network.edgesConnecting(node, node).size();
  return network.allowsParallelEdges()
    ? DirectedMultiNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount)
    : DirectedNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount);
 } else {
  Map<E, N> incidentEdgeMap =
    Maps.asMap(network.incidentEdges(node), adjacentNodeFn(network, node));
  return network.allowsParallelEdges()
    ? UndirectedMultiNetworkConnections.ofImmutable(incidentEdgeMap)
    : UndirectedNetworkConnections.ofImmutable(incidentEdgeMap);
 }
}

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

private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) {
 if (network.isDirected()) {
  Map<E, N> inEdgeMap = Maps.asMap(network.inEdges(node), sourceNodeFn(network));
  Map<E, N> outEdgeMap = Maps.asMap(network.outEdges(node), targetNodeFn(network));
  int selfLoopCount = network.edgesConnecting(node, node).size();
  return network.allowsParallelEdges()
    ? DirectedMultiNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount)
    : DirectedNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount);
 } else {
  Map<E, N> incidentEdgeMap =
    Maps.asMap(network.incidentEdges(node), adjacentNodeFn(network, node));
  return network.allowsParallelEdges()
    ? UndirectedMultiNetworkConnections.ofImmutable(incidentEdgeMap)
    : UndirectedNetworkConnections.ofImmutable(incidentEdgeMap);
 }
}

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

private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) {
 if (network.isDirected()) {
  Map<E, N> inEdgeMap = Maps.asMap(network.inEdges(node), sourceNodeFn(network));
  Map<E, N> outEdgeMap = Maps.asMap(network.outEdges(node), targetNodeFn(network));
  int selfLoopCount = network.edgesConnecting(node, node).size();
  return network.allowsParallelEdges()
    ? DirectedMultiNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount)
    : DirectedNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount);
 } else {
  Map<E, N> incidentEdgeMap =
    Maps.asMap(network.incidentEdges(node), adjacentNodeFn(network, node));
  return network.allowsParallelEdges()
    ? UndirectedMultiNetworkConnections.ofImmutable(incidentEdgeMap)
    : UndirectedNetworkConnections.ofImmutable(incidentEdgeMap);
 }
}

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

assertThat(network.predecessors(nodeV)).contains(nodeU);
assertThat(network.adjacentNodes(nodeV)).contains(nodeU);
assertThat(network.inEdges(nodeV)).contains(edge);
assertThat(network.incidentEdges(nodeV)).contains(edge);
 assertThat(network.incidentEdges(node).size() + selfLoopCount)
   .isEqualTo(network.inDegree(node) + network.outDegree(node));
 assertThat(network.inEdges(node)).hasSize(network.inDegree(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.outEdges(node)).isEqualTo(network.incidentEdges(node));
 assertThat(network.inDegree(node)).isEqualTo(network.degree(node));
 if (network.isDirected() || !isSelfLoop) {
  assertThat(edgesConnecting)
    .isEqualTo(Sets.intersection(network.outEdges(node), network.inEdges(otherNode)));
    .isEqualTo(EndpointPair.of(network, node, otherNode));
  assertThat(network.outEdges(node)).contains(edge);
  assertThat(network.inEdges(otherNode)).contains(edge);
   network.inEdges(node).contains(incidentEdge)
     || network.outEdges(node).contains(incidentEdge));
 assertThat(network.edges()).contains(incidentEdge);
for (E inEdge : sanityCheckSet(network.inEdges(node))) {

代码示例来源:origin: com.io7m.jgrapht/jgrapht-guava

@Override
public Set<E> incomingEdgesOf(V vertex)
{
  return network.inEdges(vertex);
}

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

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

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

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

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

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

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

@Override
public Set<E> outEdges(N node) {
 return delegate().inEdges(node); // transpose
}

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

@Override
public Set<E> outEdges(N node) {
 return delegate().inEdges(node); // transpose
}

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

/**
 * Initialize incoming EIGRP message queues for each adjacency
 *
 * @param eigrpTopology The topology representing EIGRP adjacencies
 */
void initQueues(Network<EigrpInterface, EigrpEdge> eigrpTopology) {
 _incomingRoutes =
   _interfaces.stream()
     .filter(eigrpTopology.nodes()::contains)
     .flatMap(n -> eigrpTopology.inEdges(n).stream())
     .collect(toImmutableSortedMap(Function.identity(), e -> new ConcurrentLinkedQueue<>()));
}

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

private void initIsisQueues(Network<IsisNode, IsisEdge> isisTopology) {
 // Initialize message queues for each IS-IS circuit
 if (_vrf.getIsisProcess() == null) {
  _isisIncomingRoutes = ImmutableSortedMap.of();
 } else {
  _isisIncomingRoutes =
    _vrf.getInterfaceNames().stream()
      .map(ifaceName -> new IsisNode(_c.getHostname(), ifaceName))
      .filter(isisTopology.nodes()::contains)
      .flatMap(n -> isisTopology.inEdges(n).stream())
      .collect(
        toImmutableSortedMap(Function.identity(), e -> new ConcurrentLinkedQueue<>()));
 }
}

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

private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) {
 if (network.isDirected()) {
  Map<E, N> inEdgeMap = Maps.asMap(network.inEdges(node), sourceNodeFn(network));
  Map<E, N> outEdgeMap = Maps.asMap(network.outEdges(node), targetNodeFn(network));
  int selfLoopCount = network.edgesConnecting(node, node).size();
  return network.allowsParallelEdges()
    ? DirectedMultiNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount)
    : DirectedNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount);
 } else {
  Map<E, N> incidentEdgeMap =
    Maps.asMap(network.incidentEdges(node), adjacentNodeFn(network, node));
  return network.allowsParallelEdges()
    ? UndirectedMultiNetworkConnections.ofImmutable(incidentEdgeMap)
    : UndirectedNetworkConnections.ofImmutable(incidentEdgeMap);
 }
}

相关文章