本文整理了Java中com.google.common.graph.Graph.nodeOrder()
方法的一些代码示例,展示了Graph.nodeOrder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.nodeOrder()
方法的具体详情如下:
包路径:com.google.common.graph.Graph
类名称:Graph
方法名:nodeOrder
[英]Returns the order of iteration for the elements of #nodes().
[中]返回#nodes()元素的迭代顺序。
代码示例来源:origin: google/guava
static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
// Properties not covered by equals()
assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops());
assertThat(graphA.nodeOrder()).isEqualTo(graphB.nodeOrder());
assertThat(graphA).isEqualTo(graphB);
}
代码示例来源:origin: google/guava
/**
* Returns a {@link GraphBuilder} initialized with all properties queryable from {@code graph}.
*
* <p>The "queryable" properties are those that are exposed through the {@link Graph} interface,
* such as {@link Graph#isDirected()}. Other properties, such as {@link #expectedNodeCount(int)},
* are not set in the new builder.
*/
public static <N> GraphBuilder<N> from(Graph<N> graph) {
return new GraphBuilder<N>(graph.isDirected())
.allowsSelfLoops(graph.allowsSelfLoops())
.nodeOrder(graph.nodeOrder());
}
代码示例来源:origin: google/j2objc
/**
* Returns a {@link GraphBuilder} initialized with all properties queryable from {@code graph}.
*
* <p>The "queryable" properties are those that are exposed through the {@link Graph} interface,
* such as {@link Graph#isDirected()}. Other properties, such as {@link #expectedNodeCount(int)},
* are not set in the new builder.
*/
public static <N> GraphBuilder<N> from(Graph<N> graph) {
return new GraphBuilder<N>(graph.isDirected())
.allowsSelfLoops(graph.allowsSelfLoops())
.nodeOrder(graph.nodeOrder());
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns a {@link GraphBuilder} initialized with all properties queryable from {@code graph}.
*
* <p>The "queryable" properties are those that are exposed through the {@link Graph} interface,
* such as {@link Graph#isDirected()}. Other properties, such as {@link #expectedNodeCount(int)},
* are not set in the new builder.
*/
public static <N> GraphBuilder<N> from(Graph<N> graph) {
return new GraphBuilder<N>(graph.isDirected())
.allowsSelfLoops(graph.allowsSelfLoops())
.nodeOrder(graph.nodeOrder());
}
代码示例来源:origin: google/guava
@After
public void validateGraphState() {
assertStronglyEquivalent(graph, Graphs.copyOf(graph));
assertStronglyEquivalent(graph, ImmutableValueGraph.copyOf(graph));
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
assertThat(graph.adjacentNodes(node)).isEqualTo(asGraph.adjacentNodes(node));
assertThat(graph.predecessors(node)).isEqualTo(asGraph.predecessors(node));
assertThat(graph.successors(node)).isEqualTo(asGraph.successors(node));
assertThat(graph.degree(node)).isEqualTo(asGraph.degree(node));
assertThat(graph.inDegree(node)).isEqualTo(asGraph.inDegree(node));
assertThat(graph.outDegree(node)).isEqualTo(asGraph.outDegree(node));
for (Integer otherNode : graph.nodes()) {
boolean hasEdge = graph.hasEdgeConnecting(node, otherNode);
assertThat(hasEdge).isEqualTo(asGraph.hasEdgeConnecting(node, otherNode));
assertThat(graph.edgeValueOrDefault(node, otherNode, null) != null).isEqualTo(hasEdge);
assertThat(!graph.edgeValueOrDefault(node, otherNode, DEFAULT).equals(DEFAULT))
.isEqualTo(hasEdge);
}
}
}
代码示例来源:origin: google/guava
assertThat(network.nodes()).isEqualTo(asGraph.nodes());
assertThat(network.edges().size()).isAtLeast(asGraph.edges().size());
assertThat(network.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(network.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(network.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
代码示例来源:origin: com.google.guava/guava-tests
static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
// Properties not covered by equals()
assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops());
assertThat(graphA.nodeOrder()).isEqualTo(graphB.nodeOrder());
assertThat(graphA).isEqualTo(graphB);
}
代码示例来源:origin: jrtom/jung
static void assertStronglyEquivalent(Graph<?> treeA, Graph<?> treeB) {
// Properties not covered by equals()
assertThat(treeA.allowsSelfLoops()).isEqualTo(treeB.allowsSelfLoops());
assertThat(treeA.nodeOrder()).isEqualTo(treeB.nodeOrder());
assertThat(treeA).isEqualTo(treeB);
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger
/**
* Returns a {@link GraphBuilder} initialized with all properties queryable from {@code graph}.
*
* <p>The "queryable" properties are those that are exposed through the {@link Graph} interface,
* such as {@link Graph#isDirected()}. Other properties, such as {@link #expectedNodeCount(int)},
* are not set in the new builder.
*/
public static <N> GraphBuilder<N> from(Graph<N> graph) {
return new GraphBuilder<N>(graph.isDirected())
.allowsSelfLoops(graph.allowsSelfLoops())
.nodeOrder(graph.nodeOrder());
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Returns a {@link GraphBuilder} initialized with all properties queryable from {@code graph}.
*
* <p>The "queryable" properties are those that are exposed through the {@link Graph} interface,
* such as {@link Graph#isDirected()}. Other properties, such as {@link #expectedNodeCount(int)},
* are not set in the new builder.
*/
public static <N> GraphBuilder<N> from(Graph<N> graph) {
return new GraphBuilder<N>(graph.isDirected())
.allowsSelfLoops(graph.allowsSelfLoops())
.nodeOrder(graph.nodeOrder());
}
代码示例来源:origin: jrtom/jung
g.isDirected() ? ValueGraphBuilder.directed() : ValueGraphBuilder.undirected();
MutableValueGraph<N, Set<N>> newGraph =
builder.expectedNodeCount(nodes.size()).nodeOrder(g.nodeOrder()).build();
代码示例来源:origin: com.google.guava/guava-tests
@After
public void validateGraphState() {
assertStronglyEquivalent(graph, Graphs.copyOf(graph));
assertStronglyEquivalent(graph, ImmutableValueGraph.copyOf(graph));
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
assertThat(graph.adjacentNodes(node)).isEqualTo(asGraph.adjacentNodes(node));
assertThat(graph.predecessors(node)).isEqualTo(asGraph.predecessors(node));
assertThat(graph.successors(node)).isEqualTo(asGraph.successors(node));
assertThat(graph.degree(node)).isEqualTo(asGraph.degree(node));
assertThat(graph.inDegree(node)).isEqualTo(asGraph.inDegree(node));
assertThat(graph.outDegree(node)).isEqualTo(asGraph.outDegree(node));
for (Integer otherNode : graph.nodes()) {
boolean hasEdge = graph.hasEdgeConnecting(node, otherNode);
assertThat(hasEdge).isEqualTo(asGraph.hasEdgeConnecting(node, otherNode));
assertThat(graph.edgeValueOrDefault(node, otherNode, null) != null).isEqualTo(hasEdge);
assertThat(!graph.edgeValueOrDefault(node, otherNode, DEFAULT).equals(DEFAULT))
.isEqualTo(hasEdge);
}
}
}
代码示例来源:origin: com.google.guava/guava-tests
assertThat(network.nodes()).isEqualTo(asGraph.nodes());
assertThat(network.edges().size()).isAtLeast(asGraph.edges().size());
assertThat(network.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(network.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(network.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
内容来源于网络,如有侵权,请联系作者删除!