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

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

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

origin: google/guava

/** Returns an empty {@link MutableNetwork} with the properties of this {@link NetworkBuilder}. */
public <N1 extends N, E1 extends E> MutableNetwork<N1, E1> build() {
 return new ConfigurableMutableNetwork<>(this);
}
origin: google/guava

checkNotNull(edge, "edge");
if (containsEdge(edge)) {
 EndpointPair<N> existingIncidentNodes = incidentNodes(edge);
 EndpointPair<N> newIncidentNodes = EndpointPair.of(this, nodeU, nodeV);
 checkArgument(
if (!allowsParallelEdges()) {
 checkArgument(
   !(connectionsU != null && connectionsU.successors().contains(nodeV)),
if (!allowsSelfLoops()) {
 checkArgument(!isSelfLoop, SELF_LOOPS_NOT_ALLOWED, nodeU);
 connectionsU = addNodeInternal(nodeU);
 connectionsV = addNodeInternal(nodeV);
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

 private NetworkConnections<N, E> newConnections() {
  return isDirected()
    ? allowsParallelEdges()
      ? DirectedMultiNetworkConnections.<N, E>of()
      : DirectedNetworkConnections.<N, E>of()
    : allowsParallelEdges()
      ? UndirectedMultiNetworkConnections.<N, E>of()
      : UndirectedNetworkConnections.<N, E>of();
 }
}
origin: google/guava

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

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 NetworkConnections<N, E> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 // Since views are returned, we need to copy the edges that will be removed.
 // Thus we avoid modifying the underlying view while iterating over it.
 for (E edge : ImmutableList.copyOf(connections.incidentEdges())) {
  removeEdge(edge);
 }
 nodeConnections.remove(node);
 return true;
}
origin: google/guava

@Override
@CanIgnoreReturnValue
public boolean removeEdge(E edge) {
 checkNotNull(edge, "edge");
 N nodeU = edgeToReferenceNode.get(edge);
 if (nodeU == null) {
  return false;
 }
 NetworkConnections<N, E> connectionsU = nodeConnections.get(nodeU);
 N nodeV = connectionsU.adjacentNode(edge);
 NetworkConnections<N, E> connectionsV = nodeConnections.get(nodeV);
 connectionsU.removeOutEdge(edge);
 connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
 edgeToReferenceNode.remove(edge);
 return true;
}
origin: google/j2objc

 private NetworkConnections<N, E> newConnections() {
  return isDirected()
    ? allowsParallelEdges()
      ? DirectedMultiNetworkConnections.<N, E>of()
      : DirectedNetworkConnections.<N, E>of()
    : allowsParallelEdges()
      ? UndirectedMultiNetworkConnections.<N, E>of()
      : UndirectedNetworkConnections.<N, E>of();
 }
}
origin: google/j2objc

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

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 NetworkConnections<N, E> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 // Since views are returned, we need to copy the edges that will be removed.
 // Thus we avoid modifying the underlying view while iterating over it.
 for (E edge : ImmutableList.copyOf(connections.incidentEdges())) {
  removeEdge(edge);
 }
 nodeConnections.remove(node);
 return true;
}
origin: google/j2objc

@Override
@CanIgnoreReturnValue
public boolean removeEdge(E edge) {
 checkNotNull(edge, "edge");
 N nodeU = edgeToReferenceNode.get(edge);
 if (nodeU == null) {
  return false;
 }
 NetworkConnections<N, E> connectionsU = nodeConnections.get(nodeU);
 N nodeV = connectionsU.adjacentNode(edge);
 NetworkConnections<N, E> connectionsV = nodeConnections.get(nodeV);
 connectionsU.removeOutEdge(edge);
 connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
 edgeToReferenceNode.remove(edge);
 return true;
}
origin: google/j2objc

checkNotNull(edge, "edge");
if (containsEdge(edge)) {
 EndpointPair<N> existingIncidentNodes = incidentNodes(edge);
 EndpointPair<N> newIncidentNodes = EndpointPair.of(this, nodeU, nodeV);
 checkArgument(
if (!allowsParallelEdges()) {
 checkArgument(
   !(connectionsU != null && connectionsU.successors().contains(nodeV)),
if (!allowsSelfLoops()) {
 checkArgument(!isSelfLoop, SELF_LOOPS_NOT_ALLOWED, nodeU);
 connectionsU = addNodeInternal(nodeU);
 connectionsV = addNodeInternal(nodeV);
origin: google/j2objc

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

 private NetworkConnections<N, E> newConnections() {
  return isDirected()
    ? allowsParallelEdges()
      ? DirectedMultiNetworkConnections.<N, E>of()
      : DirectedNetworkConnections.<N, E>of()
    : allowsParallelEdges()
      ? UndirectedMultiNetworkConnections.<N, E>of()
      : UndirectedNetworkConnections.<N, E>of();
 }
}
origin: wildfly/wildfly

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

@Override
@CanIgnoreReturnValue
public boolean removeNode(N node) {
 checkNotNull(node, "node");
 NetworkConnections<N, E> connections = nodeConnections.get(node);
 if (connections == null) {
  return false;
 }
 // Since views are returned, we need to copy the edges that will be removed.
 // Thus we avoid modifying the underlying view while iterating over it.
 for (E edge : ImmutableList.copyOf(connections.incidentEdges())) {
  removeEdge(edge);
 }
 nodeConnections.remove(node);
 return true;
}
origin: wildfly/wildfly

@Override
@CanIgnoreReturnValue
public boolean removeEdge(E edge) {
 checkNotNull(edge, "edge");
 N nodeU = edgeToReferenceNode.get(edge);
 if (nodeU == null) {
  return false;
 }
 NetworkConnections<N, E> connectionsU = nodeConnections.get(nodeU);
 N nodeV = connectionsU.adjacentNode(edge);
 NetworkConnections<N, E> connectionsV = nodeConnections.get(nodeV);
 connectionsU.removeOutEdge(edge);
 connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
 edgeToReferenceNode.remove(edge);
 return true;
}
origin: google/j2objc

/** Returns an empty {@link MutableNetwork} with the properties of this {@link NetworkBuilder}. */
public <N1 extends N, E1 extends E> MutableNetwork<N1, E1> build() {
 return new ConfigurableMutableNetwork<>(this);
}
origin: wildfly/wildfly

checkNotNull(edge, "edge");
if (containsEdge(edge)) {
 EndpointPair<N> existingIncidentNodes = incidentNodes(edge);
 EndpointPair<N> newIncidentNodes = EndpointPair.of(this, nodeU, nodeV);
 checkArgument(
if (!allowsParallelEdges()) {
 checkArgument(
   !(connectionsU != null && connectionsU.successors().contains(nodeV)),
if (!allowsSelfLoops()) {
 checkArgument(!isSelfLoop, SELF_LOOPS_NOT_ALLOWED, nodeU);
 connectionsU = addNodeInternal(nodeU);
 connectionsV = addNodeInternal(nodeV);
origin: wildfly/wildfly

@Override
@CanIgnoreReturnValue
public boolean addNode(N node) {
 checkNotNull(node, "node");
 if (containsNode(node)) {
  return false;
 }
 addNodeInternal(node);
 return true;
}
com.google.common.graphConfigurableMutableNetwork

Javadoc

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

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 NetworkConnections.
  • allowsParallelEdges
  • allowsSelfLoops
  • containsEdge
  • containsNode
  • incidentNodes
  • isDirected
  • newConnections
  • removeEdge
  • addEdge
  • validateEndpoints
  • addEdge,
  • validateEndpoints

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • putExtra (Intent)
  • startActivity (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Collectors (java.util.stream)
  • Top plugins for WebStorm
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