Tabnine Logo
ConfigurableMutableValueGraph
Code IndexAdd Tabnine to your IDE (free)

How to use
ConfigurableMutableValueGraph
in
com.google.common.graph

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

origin: google/guava

/**
 * Returns an empty {@link MutableValueGraph} with the properties of this {@link
 * ValueGraphBuilder}.
 */
public <N1 extends N, V1 extends V> MutableValueGraph<N1, V1> build() {
 return new ConfigurableMutableValueGraph<>(this);
}
origin: google/guava

@Override
@CanIgnoreReturnValue
public boolean addNode(N node) {
 checkNotNull(node, "node");
 if (containsNode(node)) {
  return false;
 }
 addNodeInternal(node);
 return true;
}
origin: google/guava

@Override
@CanIgnoreReturnValue
public V putEdgeValue(N nodeU, N nodeV, V value) {
 checkNotNull(nodeU, "nodeU");
 checkNotNull(nodeV, "nodeV");
 checkNotNull(value, "value");
 if (!allowsSelfLoops()) {
  checkArgument(!nodeU.equals(nodeV), SELF_LOOPS_NOT_ALLOWED, nodeU);
 }
 GraphConnections<N, V> connectionsU = nodeConnections.get(nodeU);
 if (connectionsU == null) {
  connectionsU = addNodeInternal(nodeU);
 }
 V previousValue = connectionsU.addSuccessor(nodeV, value);
 GraphConnections<N, V> connectionsV = nodeConnections.get(nodeV);
 if (connectionsV == null) {
  connectionsV = addNodeInternal(nodeV);
 }
 connectionsV.addPredecessor(nodeU, value);
 if (previousValue == null) {
  checkPositive(++edgeCount);
 }
 return previousValue;
}
origin: google/guava

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 GraphConnections<N, V> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 if (allowsSelfLoops()) {
  // Remove self-loop (if any) first, so we don't get CME while removing incident edges.
  if (connections.removeSuccessor(node) != null) {
   connections.removePredecessor(node);
   --edgeCount;
  }
 }
 for (N successor : connections.successors()) {
  nodeConnections.getWithoutCaching(successor).removePredecessor(node);
  --edgeCount;
 }
 if (isDirected()) { // In undirected graphs, the successor and predecessor sets are equal.
  for (N predecessor : connections.predecessors()) {
   checkState(nodeConnections.getWithoutCaching(predecessor).removeSuccessor(node) != null);
   --edgeCount;
  }
 }
 nodeConnections.remove(node);
 checkNonNegative(edgeCount);
 return true;
}
origin: google/guava

/**
 * Adds {@code node} to the graph and returns the associated {@link GraphConnections}.
 *
 * @throws IllegalStateException if {@code node} is already present
 */
@CanIgnoreReturnValue
private GraphConnections<N, V> addNodeInternal(N node) {
 GraphConnections<N, V> connections = newConnections();
 checkState(nodeConnections.put(node, connections) == null);
 return connections;
}
origin: google/guava

 private GraphConnections<N, V> newConnections() {
  return isDirected()
    ? DirectedGraphConnections.<N, V>of()
    : UndirectedGraphConnections.<N, V>of();
 }
}
origin: google/j2objc

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 GraphConnections<N, V> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 if (allowsSelfLoops()) {
  // Remove self-loop (if any) first, so we don't get CME while removing incident edges.
  if (connections.removeSuccessor(node) != null) {
   connections.removePredecessor(node);
   --edgeCount;
  }
 }
 for (N successor : connections.successors()) {
  nodeConnections.getWithoutCaching(successor).removePredecessor(node);
  --edgeCount;
 }
 if (isDirected()) { // In undirected graphs, the successor and predecessor sets are equal.
  for (N predecessor : connections.predecessors()) {
   checkState(nodeConnections.getWithoutCaching(predecessor).removeSuccessor(node) != null);
   --edgeCount;
  }
 }
 nodeConnections.remove(node);
 checkNonNegative(edgeCount);
 return true;
}
origin: google/j2objc

/**
 * Adds {@code node} to the graph and returns the associated {@link GraphConnections}.
 *
 * @throws IllegalStateException if {@code node} is already present
 */
@CanIgnoreReturnValue
private GraphConnections<N, V> addNodeInternal(N node) {
 GraphConnections<N, V> connections = newConnections();
 checkState(nodeConnections.put(node, connections) == null);
 return connections;
}
origin: google/j2objc

 private GraphConnections<N, V> newConnections() {
  return isDirected()
    ? DirectedGraphConnections.<N, V>of()
    : UndirectedGraphConnections.<N, V>of();
 }
}
origin: google/j2objc

@Override
@CanIgnoreReturnValue
public boolean addNode(N node) {
 checkNotNull(node, "node");
 if (containsNode(node)) {
  return false;
 }
 addNodeInternal(node);
 return true;
}
origin: google/j2objc

@Override
@CanIgnoreReturnValue
public V putEdgeValue(N nodeU, N nodeV, V value) {
 checkNotNull(nodeU, "nodeU");
 checkNotNull(nodeV, "nodeV");
 checkNotNull(value, "value");
 if (!allowsSelfLoops()) {
  checkArgument(!nodeU.equals(nodeV), SELF_LOOPS_NOT_ALLOWED, nodeU);
 }
 GraphConnections<N, V> connectionsU = nodeConnections.get(nodeU);
 if (connectionsU == null) {
  connectionsU = addNodeInternal(nodeU);
 }
 V previousValue = connectionsU.addSuccessor(nodeV, value);
 GraphConnections<N, V> connectionsV = nodeConnections.get(nodeV);
 if (connectionsV == null) {
  connectionsV = addNodeInternal(nodeV);
 }
 connectionsV.addPredecessor(nodeU, value);
 if (previousValue == null) {
  checkPositive(++edgeCount);
 }
 return previousValue;
}
origin: wildfly/wildfly

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 GraphConnections<N, V> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 if (allowsSelfLoops()) {
  // Remove self-loop (if any) first, so we don't get CME while removing incident edges.
  if (connections.removeSuccessor(node) != null) {
   connections.removePredecessor(node);
   --edgeCount;
  }
 }
 for (N successor : connections.successors()) {
  nodeConnections.getWithoutCaching(successor).removePredecessor(node);
  --edgeCount;
 }
 if (isDirected()) { // In undirected graphs, the successor and predecessor sets are equal.
  for (N predecessor : connections.predecessors()) {
   checkState(nodeConnections.getWithoutCaching(predecessor).removeSuccessor(node) != null);
   --edgeCount;
  }
 }
 nodeConnections.remove(node);
 checkNonNegative(edgeCount);
 return true;
}
origin: google/guava

/** Constructs a {@link MutableGraph} with the properties specified in {@code builder}. */
ConfigurableMutableGraph(AbstractGraphBuilder<? super N> builder) {
 this.backingValueGraph = new ConfigurableMutableValueGraph<>(builder);
}
origin: wildfly/wildfly

/**
 * Adds {@code node} to the graph and returns the associated {@link GraphConnections}.
 *
 * @throws IllegalStateException if {@code node} is already present
 */
@CanIgnoreReturnValue
private GraphConnections<N, V> addNodeInternal(N node) {
 GraphConnections<N, V> connections = newConnections();
 checkState(nodeConnections.put(node, connections) == null);
 return connections;
}
origin: wildfly/wildfly

 private GraphConnections<N, V> newConnections() {
  return isDirected()
    ? DirectedGraphConnections.<N, V>of()
    : UndirectedGraphConnections.<N, V>of();
 }
}
origin: wildfly/wildfly

@Override
@CanIgnoreReturnValue
public boolean addNode(N node) {
 checkNotNull(node, "node");
 if (containsNode(node)) {
  return false;
 }
 addNodeInternal(node);
 return true;
}
origin: wildfly/wildfly

@Override
@CanIgnoreReturnValue
public V putEdgeValue(N nodeU, N nodeV, V value) {
 checkNotNull(nodeU, "nodeU");
 checkNotNull(nodeV, "nodeV");
 checkNotNull(value, "value");
 if (!allowsSelfLoops()) {
  checkArgument(!nodeU.equals(nodeV), SELF_LOOPS_NOT_ALLOWED, nodeU);
 }
 GraphConnections<N, V> connectionsU = nodeConnections.get(nodeU);
 if (connectionsU == null) {
  connectionsU = addNodeInternal(nodeU);
 }
 V previousValue = connectionsU.addSuccessor(nodeV, value);
 GraphConnections<N, V> connectionsV = nodeConnections.get(nodeV);
 if (connectionsV == null) {
  connectionsV = addNodeInternal(nodeV);
 }
 connectionsV.addPredecessor(nodeU, value);
 if (previousValue == null) {
  checkPositive(++edgeCount);
 }
 return previousValue;
}
origin: org.jboss.eap/wildfly-client-all

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 GraphConnections<N, V> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 if (allowsSelfLoops()) {
  // Remove self-loop (if any) first, so we don't get CME while removing incident edges.
  if (connections.removeSuccessor(node) != null) {
   connections.removePredecessor(node);
   --edgeCount;
  }
 }
 for (N successor : connections.successors()) {
  nodeConnections.getWithoutCaching(successor).removePredecessor(node);
  --edgeCount;
 }
 if (isDirected()) { // In undirected graphs, the successor and predecessor sets are equal.
  for (N predecessor : connections.predecessors()) {
   checkState(nodeConnections.getWithoutCaching(predecessor).removeSuccessor(node) != null);
   --edgeCount;
  }
 }
 nodeConnections.remove(node);
 checkNonNegative(edgeCount);
 return true;
}
origin: google/j2objc

/**
 * Returns an empty {@link MutableValueGraph} with the properties of this {@link
 * ValueGraphBuilder}.
 */
public <N1 extends N, V1 extends V> MutableValueGraph<N1, V1> build() {
 return new ConfigurableMutableValueGraph<>(this);
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Adds {@code node} to the graph and returns the associated {@link GraphConnections}.
 *
 * @throws IllegalStateException if {@code node} is already present
 */
@CanIgnoreReturnValue
private GraphConnections<N, V> addNodeInternal(N node) {
 GraphConnections<N, V> connections = newConnections();
 checkState(nodeConnections.put(node, connections) == null);
 return connections;
}
com.google.common.graphConfigurableMutableValueGraph

Javadoc

Configurable implementation of MutableValueGraph that supports both directed and undirected graphs. Instances of this class should be constructed with ValueGraphBuilder.

Time complexities for mutation methods are all O(1) except for removeNode(N node), which is in O(d_node) where d_node is the degree of node.

Most used methods

  • <init>
    Constructs a mutable graph with the properties specified in builder.
  • addNodeInternal
    Adds node to the graph and returns the associated GraphConnections.
  • allowsSelfLoops
  • containsNode
  • isDirected
  • newConnections
  • putEdgeValue
  • removeEdge
  • validateEndpoints

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • getApplicationContext (Context)
  • startActivity (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • 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