Tabnine Logo
ValueGraph.edgeValueOrDefault
Code IndexAdd Tabnine to your IDE (free)

How to use
edgeValueOrDefault
method
in
com.google.common.graph.ValueGraph

Best Java code snippets using com.google.common.graph.ValueGraph.edgeValueOrDefault (Showing top 20 results out of 315)

origin: google/guava

 @Override
 public V apply(N successorNode) {
  return graph.edgeValueOrDefault(node, successorNode, null);
 }
};
origin: google/j2objc

 @Override
 public V apply(N successorNode) {
  return graph.edgeValueOrDefault(node, successorNode, null);
 }
};
origin: wildfly/wildfly

 @Override
 public V apply(N successorNode) {
  return graph.edgeValueOrDefault(node, successorNode, null);
 }
};
origin: google/guava

 @Override
 public V apply(EndpointPair<N> edge) {
  return graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null);
 }
};
origin: google/guava

 @Override
 public @Nullable V edgeValueOrDefault(EndpointPair<N> endpoints, @Nullable V defaultValue) {
  return delegate().edgeValueOrDefault(endpoints, defaultValue);
 }
}
origin: google/guava

@Override
public @Nullable V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) {
 return delegate().edgeValueOrDefault(nodeV, nodeU, defaultValue); // transpose
}
origin: google/guava

@Override
public @Nullable V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) {
 return delegate().edgeValueOrDefault(nodeU, nodeV, defaultValue);
}
origin: google/j2objc

 @Override
 public V apply(EndpointPair<N> edge) {
  return graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null);
 }
};
origin: google/guava

 @Override
 public @Nullable V edgeValueOrDefault(EndpointPair<N> endpoints, @Nullable V defaultValue) {
  return delegate().edgeValueOrDefault(transpose(endpoints), defaultValue);
 }
}
origin: wildfly/wildfly

 @Override
 public V apply(EndpointPair<N> edge) {
  return graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null);
 }
};
origin: google/j2objc

 @Override
 @NullableDecl
 public V edgeValueOrDefault(N nodeU, N nodeV, @NullableDecl V defaultValue) {
  return delegate().edgeValueOrDefault(nodeV, nodeU, defaultValue); // transpose
 }
}
origin: google/j2objc

 @Override
 @NullableDecl
 public V edgeValueOrDefault(N nodeU, N nodeV, @NullableDecl V defaultValue) {
  return delegate().edgeValueOrDefault(nodeU, nodeV, defaultValue);
 }
}
origin: wildfly/wildfly

 @Override
 @NullableDecl
 public V edgeValueOrDefault(N nodeU, N nodeV, @NullableDecl V defaultValue) {
  return delegate().edgeValueOrDefault(nodeU, nodeV, defaultValue);
 }
}
origin: wildfly/wildfly

 @Override
 @NullableDecl
 public V edgeValueOrDefault(N nodeU, N nodeV, @NullableDecl V defaultValue) {
  return delegate().edgeValueOrDefault(nodeV, nodeU, defaultValue); // transpose
 }
}
origin: google/guava

/**
 * Returns the subgraph of {@code graph} induced by {@code nodes}. This subgraph is a new graph
 * that contains all of the nodes in {@code nodes}, and all of the {@link Graph#edges() edges}
 * (and associated edge values) from {@code graph} for which both nodes are contained by {@code
 * nodes}.
 *
 * @throws IllegalArgumentException if any element in {@code nodes} is not a node in the graph
 */
public static <N, V> MutableValueGraph<N, V> inducedSubgraph(
  ValueGraph<N, V> graph, Iterable<? extends N> nodes) {
 MutableValueGraph<N, V> subgraph =
   (nodes instanceof Collection)
     ? ValueGraphBuilder.from(graph).expectedNodeCount(((Collection) nodes).size()).build()
     : ValueGraphBuilder.from(graph).build();
 for (N node : nodes) {
  subgraph.addNode(node);
 }
 for (N node : subgraph.nodes()) {
  for (N successorNode : graph.successors(node)) {
   if (subgraph.nodes().contains(successorNode)) {
    subgraph.putEdgeValue(
      node, successorNode, graph.edgeValueOrDefault(node, successorNode, null));
   }
  }
 }
 return subgraph;
}
origin: google/guava

/** Creates a mutable copy of {@code graph} with the same nodes, edges, and edge values. */
public static <N, V> MutableValueGraph<N, V> copyOf(ValueGraph<N, V> graph) {
 MutableValueGraph<N, V> copy =
   ValueGraphBuilder.from(graph).expectedNodeCount(graph.nodes().size()).build();
 for (N node : graph.nodes()) {
  copy.addNode(node);
 }
 for (EndpointPair<N> edge : graph.edges()) {
  copy.putEdgeValue(
    edge.nodeU(), edge.nodeV(), graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null));
 }
 return copy;
}
origin: wildfly/wildfly

/**
 * Returns the subgraph of {@code graph} induced by {@code nodes}. This subgraph is a new graph
 * that contains all of the nodes in {@code nodes}, and all of the {@link Graph#edges() edges}
 * (and associated edge values) from {@code graph} for which both nodes are contained by {@code
 * nodes}.
 *
 * @throws IllegalArgumentException if any element in {@code nodes} is not a node in the graph
 */
public static <N, V> MutableValueGraph<N, V> inducedSubgraph(
  ValueGraph<N, V> graph, Iterable<? extends N> nodes) {
 MutableValueGraph<N, V> subgraph =
   (nodes instanceof Collection)
     ? ValueGraphBuilder.from(graph).expectedNodeCount(((Collection) nodes).size()).build()
     : ValueGraphBuilder.from(graph).build();
 for (N node : nodes) {
  subgraph.addNode(node);
 }
 for (N node : subgraph.nodes()) {
  for (N successorNode : graph.successors(node)) {
   if (subgraph.nodes().contains(successorNode)) {
    subgraph.putEdgeValue(
      node, successorNode, graph.edgeValueOrDefault(node, successorNode, null));
   }
  }
 }
 return subgraph;
}
origin: wildfly/wildfly

/** Creates a mutable copy of {@code graph} with the same nodes, edges, and edge values. */
public static <N, V> MutableValueGraph<N, V> copyOf(ValueGraph<N, V> graph) {
 MutableValueGraph<N, V> copy =
   ValueGraphBuilder.from(graph).expectedNodeCount(graph.nodes().size()).build();
 for (N node : graph.nodes()) {
  copy.addNode(node);
 }
 for (EndpointPair<N> edge : graph.edges()) {
  copy.putEdgeValue(
    edge.nodeU(), edge.nodeV(), graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null));
 }
 return copy;
}
origin: google/j2objc

/** Creates a mutable copy of {@code graph} with the same nodes, edges, and edge values. */
public static <N, V> MutableValueGraph<N, V> copyOf(ValueGraph<N, V> graph) {
 MutableValueGraph<N, V> copy =
   ValueGraphBuilder.from(graph).expectedNodeCount(graph.nodes().size()).build();
 for (N node : graph.nodes()) {
  copy.addNode(node);
 }
 for (EndpointPair<N> edge : graph.edges()) {
  copy.putEdgeValue(
    edge.nodeU(), edge.nodeV(), graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null));
 }
 return copy;
}
origin: google/guava

@Test
public void transpose_directedValueGraph() {
 MutableValueGraph<Integer, String> directedGraph =
   ValueGraphBuilder.directed().allowsSelfLoops(true).build();
 directedGraph.putEdgeValue(N1, N3, E13);
 directedGraph.putEdgeValue(N3, N1, E31);
 directedGraph.putEdgeValue(N1, N2, E12);
 directedGraph.putEdgeValue(N1, N1, E11);
 directedGraph.putEdgeValue(N3, N4, E34);
 MutableValueGraph<Integer, String> expectedTranspose =
   ValueGraphBuilder.directed().allowsSelfLoops(true).build();
 expectedTranspose.putEdgeValue(N3, N1, E13);
 expectedTranspose.putEdgeValue(N1, N3, E31);
 expectedTranspose.putEdgeValue(N2, N1, E12);
 expectedTranspose.putEdgeValue(N1, N1, E11);
 expectedTranspose.putEdgeValue(N4, N3, E34);
 ValueGraph<Integer, String> transpose = transpose(directedGraph);
 assertThat(transpose).isEqualTo(expectedTranspose);
 assertThat(transpose(transpose)).isSameAs(directedGraph);
 AbstractGraphTest.validateGraph(transpose.asGraph());
 assertThat(transpose.edgeValueOrDefault(N1, N2, null)).isNull();
 for (Integer node : directedGraph.nodes()) {
  assertThat(directedGraph.inDegree(node)).isSameAs(transpose.outDegree(node));
  assertThat(directedGraph.outDegree(node)).isSameAs(transpose.inDegree(node));
 }
 directedGraph.putEdgeValue(N2, N1, E21);
 // View should be updated.
 assertThat(transpose.edgeValueOrDefault(N1, N2, null)).isEqualTo(E21);
 AbstractGraphTest.validateGraph(transpose.asGraph());
}
com.google.common.graphValueGraphedgeValueOrDefault

Javadoc

Returns the value of the edge that connects endpoints (in the order, if any, specified by endpoints), if one is present; otherwise, returns defaultValue.

If this graph is directed, the endpoints must be ordered.

Popular methods of ValueGraph

  • nodes
    Returns all nodes in this graph, in the order specified by #nodeOrder().
  • adjacentNodes
    Returns the nodes which have an incident edge in common with node in this graph.
  • edgeValue
    Returns the value of the edge connecting nodeU to nodeV, if one is present; otherwise, returns Optio
  • edges
    Returns all edges in this graph.
  • allowsSelfLoops
    Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting to ad
  • outDegree
    Returns the count of node's outgoing edges (equal to successors(node).size()) in a directed graph. I
  • degree
    Returns the count of node's incident edges, counting self-loops twice (equivalently, the number of t
  • inDegree
    Returns the count of node's incoming edges (equal to predecessors(node).size()) in a directed graph.
  • isDirected
    Returns true if the edges in this graph are directed. Directed edges connect a EndpointPair#source()
  • hasEdgeConnecting
    Returns true if there is an edge directly connecting nodeU to nodeV. This is equivalent to nodes().c
  • nodeOrder
    Returns the order of iteration for the elements of #nodes().
  • predecessors
  • nodeOrder,
  • predecessors,
  • successors,
  • asGraph,
  • equals,
  • incidentEdges

Popular in Java

  • Making http requests using okhttp
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JList (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now