Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graph-builder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graph-builder - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

markdown/graph-builder.comparator.compare.md

15

dist/collect/Comparator.d.ts

@@ -0,1 +1,4 @@

/**
* @public
*/
export interface Comparator<T> {

@@ -7,2 +10,4 @@ /**

*
* @remarks
*
* In the foregoing description, the notation sgn(expression) designates the

@@ -12,8 +17,8 @@ * mathematical signum function, which is defined to return one of -1, 0, or

*
* The implementor must ensure that sgn(compare(x, y)) == -sgn(compare(y, x))
* for all x and y. (This implies that compare(x, y) must throw an exception if
* and only if compare(y, x) throws an exception.)
* The implementor must ensure that `sgn(compare(x, y)) == -sgn(compare(y, x))`
* for all `x` and `y`. (This implies that `compare(x, y)` must throw an exception if
* and only if `compare(y, x)` throws an exception.)
*
* The implementor must also ensure that the relation is transitive:
* ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.
* `((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0`.
*

@@ -24,3 +29,3 @@ * Finally, the implementor must ensure that compare(x, y)==0 implies that

* It is generally the case, but not strictly required that
* (compare(x, y)==0) == (x.equals(y)).
* `(compare(x, y)==0) == (x.equals(y))`.
*

@@ -27,0 +32,0 @@ * Generally speaking, any comparator that violates this condition should clearly

@@ -11,3 +11,3 @@ import { SuccessorsFunction } from "./SuccessorsFunction";

export interface BaseGraph<N> extends SuccessorsFunction<N>, PredecessorsFunction<N> {
/** Returns all nodes in this graph, in the order specified by {@link nodeOrder}. */
/** Returns all nodes in this graph, in the order specified by {@link BaseGraph.nodeOrder}. */
nodes(): Set<N>;

@@ -24,7 +24,6 @@ /** Returns all edges in this graph. */

* Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting
* to add a self-loop to a graph that does not allow them will throw an {@link
* IllegalArgumentException}.
* to add a self-loop to a graph that does not allow them will throw an error.
*/
allowsSelfLoops(): boolean;
/** Returns the order of iteration for the elements of {@link nodes}. */
/** Returns the order of iteration for the elements of {@link BaseGraph.nodes}. */
nodeOrder(): ElementOrder<N>;

@@ -34,3 +33,3 @@ /**

*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -42,5 +41,5 @@ adjacentNodes(node: N): Set<N>;

*
* <p>In an undirected graph, this is equivalent to {@link adjacentNodes}.
* In an undirected graph, this is equivalent to {@link BaseGraph.adjacentNodes}.
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -52,8 +51,8 @@ predecessors(node: N): Set<N>;

*
* <p>In an undirected graph, this is equivalent to {@link adjacentNodes}.
* In an undirected graph, this is equivalent to {@link BaseGraph.adjacentNodes}.
*
* <p>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing
* This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing
* edges". For that functionality, see {@link Graphs.reachableNodes}.
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -64,3 +63,3 @@ successors(node: N): Set<N>;

*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -72,10 +71,8 @@ incidentEdges(node: N): Set<EndpointPair<N>>;

*
* <p>For directed graphs, this is equal to `inDegree(node) + outDegree(node)`.
* For directed graphs, this is equal to `inDegree(node) + outDegree(node)`.
*
* <p>For undirected graphs, this is equal to `incidentEdges(node).size()` + (number of
* For undirected graphs, this is equal to `incidentEdges(node).size()` + (number of
* self-loops incident to `node`).
*
* <p>If the count is greater than `Integer.MAX_VALUE`, returns `Integer.MAX_VALUE`.
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -85,7 +82,5 @@ degree(node: N): number;

* Returns the count of `node`'s incoming edges (equal to `predecessors(node).size()`)
* in a directed graph. In an undirected graph, returns the {@link degree}.
* in a directed graph. In an undirected graph, returns the {@link BaseGraph.degree}.
*
* <p>If the count is greater than `Integer.MAX_VALUE`, returns `Integer.MAX_VALUE`.
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -95,7 +90,5 @@ inDegree(node: N): number;

* Returns the count of `node`'s outgoing edges (equal to `successors(node).size()`)
* in a directed graph. In an undirected graph, returns the {@link degree}.
* in a directed graph. In an undirected graph, returns the {@link BaseGraph.degree}.
*
* <p>If the count is greater than `Integer.MAX_VALUE`, returns `Integer.MAX_VALUE`.
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws an error if `node` is not an element of this graph.
*/

@@ -107,3 +100,3 @@ outDegree(node: N): number;

*
* <p>In an undirected graph, this is equal to `hasEdgeConnecting(nodeV, nodeU)`.
* In an undirected graph, this is equal to `hasEdgeConnecting(nodeV, nodeU)`.
*/

@@ -116,5 +109,5 @@ hasEdge(nodeU: N, nodeV: N): boolean;

*
* <p>Unlike the other `EndpointPair`-accepting methods, this method does not throw if the
* Unlike the other `EndpointPair`-accepting methods, this method does not throw if the
* endpoints are unordered; it simply returns false. This is for consistency with the behavior of
* {@link Collection.contains} (which does not generally throw if the object cannot be
* Set.has (which does not generally throw if the object cannot be
* present in the collection), and the desire to have this method's behavior be compatible with

@@ -121,0 +114,0 @@ * `edges().contains(endpoints)`.

@@ -23,7 +23,7 @@ import { Comparator } from "../collect/Comparator";

*
* <p>Example usage:
* Example usage:
*
* ```typescript
* MutableGraph<Integer> graph =
* GraphBuilder.directed().nodeOrder(ElementOrder.<Integer>natural()).build();
* const graph: MutableGraph<number> =
* GraphBuilder.directed().nodeOrder(ElementOrder.natural<number>()).build();
* }

@@ -54,3 +54,3 @@ * ```

*
* throws UnsupportedOperationException if comparator is not defined
* Throws an error if comparator is not defined
*/

@@ -57,0 +57,0 @@ getComparator(): Comparator<T>;

@@ -43,7 +43,7 @@ "use strict";

*
* <p>Example usage:
* Example usage:
*
* ```typescript
* MutableGraph<Integer> graph =
* GraphBuilder.directed().nodeOrder(ElementOrder.<Integer>natural()).build();
* const graph: MutableGraph<number> =
* GraphBuilder.directed().nodeOrder(ElementOrder.natural<number>()).build();
* }

@@ -83,3 +83,3 @@ * ```

*
* throws UnsupportedOperationException if comparator is not defined
* Throws an error if comparator is not defined
*/

@@ -102,12 +102,2 @@ getComparator() {

}
// public int hashCode() {
// return Objects.hashCode(type, comparator);
// }
// public String toString() {
// ToStringHelper helper = MoreObjects.toStringHelper(this).add("type", type);
// if (comparator != null) {
// helper.add("comparator", comparator);
// }
// return helper.toString();
// }
/** Returns an empty mutable map whose keys will respect this {@link ElementOrder}. */

@@ -114,0 +104,0 @@ createMap(expectedSize) {

import { Graph } from "./Graph";
/**
* An immutable pair representing the two endpoints of an edge in a graph. The {@link EndpointPair}
* of a directed edge is an ordered pair of nodes ({@link source} and {@link target}). The
* {@link EndpointPair} of an undirected edge is an unordered pair of nodes ({@link nodeU} and
* {@link nodeV}).
* of a directed edge is an ordered pair of nodes ({@link EndpointPair.source} and
* {@link EndpointPair.target}). The {@link EndpointPair} of an undirected edge is an
* unordered pair of nodes ({@link EndpointPair.nodeU} and {@link EndpointPair.nodeV}).
*
* <p>The edge is a self-loop if, and only if, the two endpoints are equal.
* The edge is a self-loop if, and only if, the two endpoints are equal.
*

@@ -24,11 +24,11 @@ * @public

/**
* If this {@link EndpointPair} {@link isOrdered}, returns the node which is the source.
* If this {@link EndpointPair} {@link EndpointPair.isOrdered}, returns the node which is the source.
*
* throws UnsupportedOperationException if this {@link EndpointPair} is not ordered
* Throws an error if this {@link EndpointPair} is not ordered.
*/
abstract source(): N;
/**
* If this {@link EndpointPair} {@link isOrdered}, returns the node which is the target.
* If this {@link EndpointPair} {@link EndpointPair.isOrdered}, returns the node which is the target.
*
* throws UnsupportedOperationException if this {@link EndpointPair} is not ordered
* Throws an error if this {@link EndpointPair} is not ordered.
*/

@@ -39,3 +39,3 @@ abstract target(): N;

*
* throws IllegalArgumentException if this {@link EndpointPair} does not contain `node`
* Throws an error if this {@link EndpointPair} does not contain `node`.
*/

@@ -48,10 +48,11 @@ adjacentNode(node: N): N;

abstract isOrdered(): boolean;
/** Iterates in the order {@link nodeU}, {@link nodeV}. */
/** Iterates in the order {@link EndpointPair.nodeU}, {@link EndpointPair.nodeV}. */
[Symbol.iterator](): IterableIterator<N>;
/**
* Two ordered {@link EndpointPair}s are equal if their {@link source} and {@link target}
* are equal. Two unordered {@link EndpointPair}s are equal if they contain the same nodes. An
* ordered {@link EndpointPair} is never equal to an unordered {@link EndpointPair}.
* Two ordered {@link EndpointPair}s are equal if their {@link EndpointPair.source}
* and {@link EndpointPair.target} are equal. Two unordered {@link EndpointPair}s are
* equal if they contain the same nodes. An ordered {@link EndpointPair} is never
* equal to an unordered {@link EndpointPair}.
*/
abstract equals(obj?: Object): boolean;
}

@@ -22,7 +22,7 @@ "use strict";

* An immutable pair representing the two endpoints of an edge in a graph. The {@link EndpointPair}
* of a directed edge is an ordered pair of nodes ({@link source} and {@link target}). The
* {@link EndpointPair} of an undirected edge is an unordered pair of nodes ({@link nodeU} and
* {@link nodeV}).
* of a directed edge is an ordered pair of nodes ({@link EndpointPair.source} and
* {@link EndpointPair.target}). The {@link EndpointPair} of an undirected edge is an
* unordered pair of nodes ({@link EndpointPair.nodeU} and {@link EndpointPair.nodeV}).
*
* <p>The edge is a self-loop if, and only if, the two endpoints are equal.
* The edge is a self-loop if, and only if, the two endpoints are equal.
*

@@ -52,3 +52,3 @@ * @public

*
* throws IllegalArgumentException if this {@link EndpointPair} does not contain `node`
* Throws an error if this {@link EndpointPair} does not contain `node`.
*/

@@ -66,5 +66,4 @@ adjacentNode(node) {

}
/** Iterates in the order {@link nodeU}, {@link nodeV}. */
/** Iterates in the order {@link EndpointPair.nodeU}, {@link EndpointPair.nodeV}. */
[Symbol.iterator]() {
// @todo: convert to Itera
return [this.nodeU, this.nodeV][Symbol.iterator]();

@@ -97,5 +96,2 @@ }

}
// public hashCode(): number {
// return Objects.hashCode(source(), target());
// }
toString() {

@@ -140,5 +136,2 @@ return "<" + this.source() + " -> " + this.target() + ">";

}
// public int hashCode() {
// return nodeU().hashCode() + nodeV().hashCode();
// }
toString() {

@@ -145,0 +138,0 @@ return "[" + this.nodeU + ", " + this.nodeV + "]";

import { BaseGraph } from "./BaseGraph";
/**
* An interface for <a
* A subinterface of {@link BaseGraph} for <a
* href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data,

@@ -9,5 +9,5 @@ * whose edges are anonymous entities with no identity or information of their own.

*
* <p>A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
* A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
*
* <p>There are three primary interfaces provided to represent graphs. In order of increasing
* There are three primary interfaces provided to represent graphs. In order of increasing
* complexity they are: {@link Graph}, {@link ValueGraph}, and {@link Network}. You should generally

@@ -18,5 +18,5 @@ * prefer the simplest interface that satisfies your use case. See the <a

*
* **Capabilities**
* <b>Capabilities</b>
*
* <p>`Graph` supports the following use cases (<a
* `Graph` supports the following use cases (<a
* href="https://github.com/google/guava/wiki/GraphsExplained#definitions">definitions of

@@ -32,8 +32,8 @@ * terms</a>):

*
* <p>`Graph` explicitly does not support parallel edges, and forbids implementations or
* `Graph` explicitly does not support parallel edges, and forbids implementations or
* extensions with parallel edges. If you need parallel edges, use {@link Network}.
*
* **Building a `Graph`**
* <b>Building a `Graph`</b>
*
* <p>The implementation classes that `common.graph` provides are not public, by design. To
* The implementation classes that are provided are not public, by design. To
* create an instance of one of the built-in implementations of `Graph`, use the {@link

@@ -43,6 +43,6 @@ * GraphBuilder} class:

* ```typescript
* MutableGraph<Integer> graph = GraphBuilder.undirected().build();
* const graph: MutableGraph<number> = GraphBuilder.undirected().build();
* ```
*
* <p>{@link GraphBuilder.build} returns an instance of {@link MutableGraph}, which is a subtype
* {@link GraphBuilder.build} returns an instance of {@link MutableGraph}, which is a subtype
* of `Graph` that provides methods for adding and removing nodes and edges. If you do not

@@ -52,32 +52,12 @@ * need to mutate a graph (e.g. if you write a method than runs a read-only algorithm on the graph),

*
* <p>You can create an immutable copy of an existing `Graph` using {@link
* You can create an immutable copy of an existing `Graph` using {@link
* ImmutableGraph.copyOf}:
*
* ```typescript
* ImmutableGraph<Integer> immutableGraph = ImmutableGraph.copyOf(graph);
* const immutableGraph: ImmutableGraph<number> = ImmutableGraph.copyOf(graph);
* ```
*
* <p>Instances of {@link ImmutableGraph} do not implement {@link MutableGraph} (obviously!) and are
* contractually guaranteed to be unmodifiable and thread-safe.
* Instances of {@link ImmutableGraph} do not implement {@link MutableGraph} (obviously!) and are
* contractually guaranteed to be unmodifiable.
*
* <p>The Guava User Guide has <a
* href="https://github.com/google/guava/wiki/GraphsExplained#building-graph-instances">more
* information on (and examples of) building graphs</a>.
*
* **Additional documentation**
*
* <p>See the Guava User Guide for the `common.graph` package (<a
* href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for
* additional documentation, including:
*
* <ul>
* <li><a
* href="https://github.com/google/guava/wiki/GraphsExplained#equals-hashcode-and-graph-equivalence">
* `equals()`, `hashCode()`, and graph equivalence</a>
* <li><a href="https://github.com/google/guava/wiki/GraphsExplained#synchronization">
* Synchronization policy</a>
* <li><a href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">Notes
* for implementors</a>
* </ul>
*
* @public

@@ -90,18 +70,16 @@ */

*
* <p>Thus, two graphs A and B are equal if <b>all</b> of the following are true:
* Thus, two graphs A and B are equal if <b>all</b> of the following are true:
*
* <ul>
* <li>A and B have equal {@link isDirected}.
* <li>A and B have equal {@link nodes}.
* <li>A and B have equal {@link edges}.
* <li>A and B have equal {@link BaseGraph.isDirected}.
* <li>A and B have equal {@link BaseGraph.nodes}.
* <li>A and B have equal {@link BaseGraph.edges}.
* </ul>
*
* <p>Graph properties besides {@link isDirected} do <b>not</b> affect equality.
* Graph properties besides {@link BaseGraph.isDirected} do <b>not</b> affect equality.
* For example, two graphs may be considered equal even if one allows self-loops and the other
* doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order
* in which they are iterated over, are irrelevant.
*
* <p>A reference implementation of this is provided by {@link AbstractGraph.equals}.
*/
equals(object: object): boolean;
}

@@ -10,7 +10,7 @@ import { AbstractGraphBuilder } from "./AbstractGraphBuilder";

*
* <p>A graph built by this class will have the following properties by default:
* A graph built by this class will have the following properties by default:
*
* <ul>
* <li>does not allow self-loops
* <li>orders {@link Graph.nodes} in the order in which the elements were added
* <li>does not allow self-loops</li>
* <li>orders {@link BaseGraph.nodes} in the order in which the elements were added</li>
* </ul>

@@ -21,3 +21,3 @@ *

* ```typescript
* MutableGraph<String> graph = GraphBuilder.undirected().allowsSelfLoops(true).build();
* const graph: MutableGraph<String> = GraphBuilder.undirected().allowsSelfLoops(true).build();
* graph.putEdge("bread", "bread");

@@ -39,3 +39,3 @@ * graph.putEdge("chocolate", "peanut butter");

* <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},
* such as {@link BaseGraph.isDirected}. Other properties, such as {@link GraphBuilder.expectedNodeCount},
* are not set in the new builder.

@@ -55,3 +55,3 @@ */

expectedNodeCount(expectedNodeCount: number): GraphBuilder<N>;
/** Specifies the order of iteration for the elements of {@link Graph.nodes}. */
/** Specifies the order of iteration for the elements of {@link BaseGraph.nodes}. */
nodeOrder(nodeOrder: ElementOrder<N>): GraphBuilder<N>;

@@ -58,0 +58,0 @@ /** Returns an empty {@link MutableGraph} with the properties of this {@link GraphBuilder}. */

@@ -27,7 +27,7 @@ "use strict";

*
* <p>A graph built by this class will have the following properties by default:
* A graph built by this class will have the following properties by default:
*
* <ul>
* <li>does not allow self-loops
* <li>orders {@link Graph.nodes} in the order in which the elements were added
* <li>does not allow self-loops</li>
* <li>orders {@link BaseGraph.nodes} in the order in which the elements were added</li>
* </ul>

@@ -38,3 +38,3 @@ *

* ```typescript
* MutableGraph<String> graph = GraphBuilder.undirected().allowsSelfLoops(true).build();
* const graph: MutableGraph<String> = GraphBuilder.undirected().allowsSelfLoops(true).build();
* graph.putEdge("bread", "bread");

@@ -60,3 +60,3 @@ * graph.putEdge("chocolate", "peanut butter");

* <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},
* such as {@link BaseGraph.isDirected}. Other properties, such as {@link GraphBuilder.expectedNodeCount},
* are not set in the new builder.

@@ -86,3 +86,3 @@ */

}
/** Specifies the order of iteration for the elements of {@link Graph.nodes}. */
/** Specifies the order of iteration for the elements of {@link BaseGraph.nodes}. */
nodeOrder(nodeOrder) {

@@ -89,0 +89,0 @@ this.nodeOrderValue = nodeOrder;

@@ -13,3 +13,3 @@ import { Graph } from "./Graph";

*
* <p><b>Nodes must be unique</b>, just as `Map` keys must be. They must also be non-null.
* <b>Nodes must be unique</b>, just as `Map` keys must be.
*

@@ -22,10 +22,11 @@ * @returns `true` if the graph was modified as a result of this call

*
* <p>If the graph is directed, the resultant edge will be directed; otherwise, it will be
* If the graph is directed, the resultant edge will be directed; otherwise, it will be
* undirected.
*
* <p>If `nodeU` and `nodeV` are not already present in this graph, this method will
* silently {@link addNode} `nodeU` and `nodeV` to the graph.
* If `nodeU` and `nodeV` are not already present in this graph, this method will
* silently {@link MutableGraph.addNode} `nodeU` and `nodeV` to the graph.
*
* Throws if the introduction of the edge would violate {@link BaseGraph.allowsSelfLoops}.
*
* @returns `true` if the graph was modified as a result of this call
* throws IllegalArgumentException if the introduction of the edge would violate {@link allowsSelfLoops}
*/

@@ -37,13 +38,15 @@ putEdge(nodeU: N, nodeV: N): boolean;

*
* <p>If this graph is directed, `endpoints` must be ordered and the added edge will be
* If this graph is directed, `endpoints` must be ordered and the added edge will be
* directed; if it is undirected, the added edge will be undirected.
*
* <p>If this graph is directed, `endpoints` must be ordered.
* If this graph is directed, `endpoints` must be ordered.
*
* <p>If either or both endpoints are not already present in this graph, this method will silently
* {@link addNode} each missing endpoint to the graph.
* If either or both endpoints are not already present in this graph, this method will silently
* {@link MutableGraph.addNode} each missing endpoint to the graph.
*
* Throws if the introduction of the edge would violate {@link BaseGraph.allowsSelfLoops}.
*
* Throws if the endpoints are unordered and the graph is directed.
*
* @returns `true` if the graph was modified as a result of this call
* throws IllegalArgumentException if the introduction of the edge would violate {@link allowsSelfLoops}
* throws IllegalArgumentException if the endpoints are unordered and the graph is directed
*/

@@ -66,5 +69,6 @@ putEdgeConnectingEndpoints(endpoints: EndpointPair<N>): boolean;

*
* <p>If this graph is directed, `endpoints` must be ordered.
* If this graph is directed, `endpoints` must be ordered.
*
* throws IllegalArgumentException if the endpoints are unordered and the graph is directed
* Throws if the endpoints are unordered and the graph is directed.
*
* @returns `true` if the graph was modified as a result of this call

@@ -71,0 +75,0 @@ */

@@ -13,3 +13,3 @@ import { ValueGraph } from "./ValueGraph";

*
* <p><b>Nodes must be unique</b>, just as `Map` keys must be. They must also be non-null.
* <b>Nodes must be unique</b>, just as `Map` keys must be.
*

@@ -23,14 +23,14 @@ * @returns `true` if the graph was modified as a result of this call

*
* <p>If the graph is directed, the resultant edge will be directed; otherwise, it will be
* If the graph is directed, the resultant edge will be directed; otherwise, it will be
* undirected.
*
* <p>Values do not have to be unique. However, values must be non-null.
* Values do not have to be unique.
*
* <p>If `nodeU` and `nodeV` are not already present in this graph, this method will
* silently {@link addNode} `nodeU` and `nodeV` to the graph.
* If `nodeU` and `nodeV` are not already present in this graph, this method will
* silently {@link MutableValueGraph.addNode} `nodeU` and `nodeV` to the graph.
*
* Throws if the introduction of the edge would violate {@link BaseGraph.allowsSelfLoops}
*
* @returns the value previously associated with the edge connecting `nodeU` to
* `nodeV`, or null if there was no such edge.
* throws IllegalArgumentException if the introduction of the edge would violate {@link
* allowsSelfLoops}
* `nodeV`, or undefined if there was no such edge.
*/

@@ -42,17 +42,19 @@ putEdgeValue(nodeU: N, nodeV: N, value: V): V | undefined;

*
* <p>If the graph is directed, the resultant edge will be directed; otherwise, it will be
* If the graph is directed, the resultant edge will be directed; otherwise, it will be
* undirected.
*
* <p>If this graph is directed, `endpoints` must be ordered.
* If this graph is directed, `endpoints` must be ordered.
*
* <p>Values do not have to be unique. However, values must be non-null.
* Values do not have to be unique.
*
* <p>If either or both endpoints are not already present in this graph, this method will silently
* {@link addNode} each missing endpoint to the graph.
* If either or both endpoints are not already present in this graph, this method will silently
* {@link MutableValueGraph.addNode} each missing endpoint to the graph.
*
* Throws if the introduction of the edge would violate
* {@link BaseGraph.allowsSelfLoops}
*
* Throws if the endpoints are unordered and the graph is directed
*
* @returns the value previously associated with the edge connecting `nodeU` to
* `nodeV`, or null if there was no such edge.
* throws IllegalArgumentException if the introduction of the edge would violate {@link
* allowsSelfLoops}
* throws IllegalArgumentException if the endpoints are unordered and the graph is directed
* `nodeV`, or undefined if there was no such edge.
*/

@@ -70,3 +72,3 @@ putEdgeValueConnectingEndpoints(endpoints: EndpointPair<N>, value: V): V | undefined;

* @returns the value previously associated with the edge connecting `nodeU` to
* `nodeV`, or null if there was no such edge.
* `nodeV`, or undefined if there was no such edge.
*/

@@ -77,5 +79,5 @@ removeEdge(nodeU: N, nodeV: N): V | undefined;

*
* <p>If this graph is directed, `endpoints` must be ordered.
* If this graph is directed, `endpoints` must be ordered.
*
* @returns the value previously associated with the edge connecting `endpoints`, or null if
* @returns the value previously associated with the edge connecting `endpoints`, or undefined if
* there was no such edge.

@@ -82,0 +84,0 @@ */

@@ -7,6 +7,6 @@ /**

*
* <p>This interface is meant to be used as the type of a parameter to graph algorithms (such as
* This interface is meant to be used as the type of a parameter to graph algorithms (such as
* topological sort) that only need a way of accessing the predecessors of a node in a graph.
*
* **Usage**
* <b>Usage</b>
*

@@ -16,3 +16,3 @@ * Given an algorithm, for example:

* ```typescript
* public <N> someGraphAlgorithm(N startNode, PredecessorsFunction<N> predecessorsFunction);
* public someGraphAlgorithm<N>(startNode: N, predecessorsFunction: PredecessorsFunction<N>);
* ```

@@ -22,3 +22,3 @@ *

*
* <p>If you have an instance of one of the primary `common.graph` types ({@link Graph},
* If you have an instance of one of the primary `common.graph` types ({@link Graph},
* {@link ValueGraph}, and {@link Network}):

@@ -33,29 +33,21 @@ *

*
* <p>If you have your own graph implementation based around a custom node type `MyNode`,
* If you have your own graph implementation based around a custom node type `MyNode`,
* which has a method `getParents()` that retrieves its predecessors in a graph:
*
* ```typescript
* someGraphAlgorithm(startNode, MyNode::getParents);
* someGraphAlgorithm(startNode, MyNode.getParents);
* ```
*
* <p>If you have some other mechanism for returning the predecessors of a node, or one that doesn't
* return a `Iterable<? extends N>`, then you can use a lambda to perform a more general
* If you have some other mechanism for returning the predecessors of a node, or one that doesn't
* return a `Iterable<N>`, then you can use a lambda to perform a more general
* transformation:
*
* ```typescript
* someGraphAlgorithm(startNode, node -> ImmutableList.of(node.mother(), node.father()));
* someGraphAlgorithm(startNode, node => [node.mother(), node.father()]);
* ```
*
* <p>Graph algorithms that need additional capabilities (accessing both predecessors and
* Graph algorithms that need additional capabilities (accessing both predecessors and
* successors, iterating over the edges, etc.) should declare their input to be of a type that
* provides those capabilities, such as {@link Graph}, {@link ValueGraph}, or {@link Network}.
*
* **Additional documentation**
*
* <p>See the Guava User Guide for the `common.graph` package (<a
* href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for
* additional documentation, including <a
* href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">notes for
* implementors</a>
*
* @public

@@ -68,18 +60,11 @@ */

*
* <p>Some algorithms that operate on a `PredecessorsFunction` may produce undesired results
* if the returned {@link Iterable} contains duplicate elements. Implementations of such
* Some algorithms that operate on a `PredecessorsFunction` may produce undesired results
* if the returned `Iterable` contains duplicate elements. Implementations of such
* algorithms should document their behavior in the presence of duplicates.
*
* <p>The elements of the returned `Iterable` must each be:
* The elements of the returned `Iterable` must each be unique to the graph.
*
* <ul>
* <li>Non-null
* <li>Usable as `Map` keys (see the Guava User Guide's section on <a
* href="https://github.com/google/guava/wiki/GraphsExplained#graph-elements-nodes-and-edges">
* graph elements</a> for details)
* </ul>
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws if `node` is not an element of this graph.
*/
predecessors(node: N): Iterable<N>;
}

@@ -7,6 +7,6 @@ /**

*
* <p>This interface is meant to be used as the type of a parameter to graph algorithms (such as
* This interface is meant to be used as the type of a parameter to graph algorithms (such as
* breadth first traversal) that only need a way of accessing the successors of a node in a graph.
*
* **Usage**
* <b>Usage</b>
*

@@ -16,3 +16,3 @@ * Given an algorithm, for example:

* ```typescript
* public <N> someGraphAlgorithm(N startNode, SuccessorsFunction<N> successorsFunction);
* public someGraphAlgorithm<N>(startNode: N, successorsFunction: SuccessorsFunction<N>);
* ```

@@ -22,3 +22,3 @@ *

*
* <p>If you have an instance of one of the primary `common.graph` types ({@link Graph},
* If you have an instance of one of the primary `graph` types ({@link Graph},
* {@link ValueGraph}, and {@link Network}):

@@ -33,29 +33,21 @@ *

*
* <p>If you have your own graph implementation based around a custom node type `MyNode`,
* If you have your own graph implementation based around a custom node type `MyNode`,
* which has a method `getChildren()` that retrieves its successors in a graph:
*
* ```typescript
* someGraphAlgorithm(startNode, MyNode::getChildren);
* someGraphAlgorithm(startNode, MyNode.getChildren);
* ```
*
* <p>If you have some other mechanism for returning the successors of a node, or one that doesn't
* return an `Iterable<? extends N>`, then you can use a lambda to perform a more general
* If you have some other mechanism for returning the successors of a node, or one that doesn't
* return an `Iterable<N>`, then you can use a lambda to perform a more general
* transformation:
*
* ```typescript
* someGraphAlgorithm(startNode, node -> ImmutableList.of(node.leftChild(), node.rightChild()));
* someGraphAlgorithm(startNode, node => [node.leftChild(), node.rightChild()]);
* ```
*
* <p>Graph algorithms that need additional capabilities (accessing both predecessors and
* Graph algorithms that need additional capabilities (accessing both predecessors and
* successors, iterating over the edges, etc.) should declare their input to be of a type that
* provides those capabilities, such as {@link Graph}, {@link ValueGraph}, or {@link Network}.
*
* **Additional documentation**
*
* <p>See the Guava User Guide for the `common.graph` package (<a
* href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for
* additional documentation, including <a
* href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">notes for
* implementors</a>
*
* @public

@@ -68,21 +60,14 @@ */

*
* <p>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing
* This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing
* edges". For that functionality, see {@link Graphs.reachableNodes}.
*
* <p>Some algorithms that operate on a `SuccessorsFunction` may produce undesired results
* if the returned {@link Iterable} contains duplicate elements. Implementations of such
* Some algorithms that operate on a `SuccessorsFunction` may produce undesired results
* if the returned `Iterable` contains duplicate elements. Implementations of such
* algorithms should document their behavior in the presence of duplicates.
*
* <p>The elements of the returned `Iterable` must each be:
* The elements of the returned `Iterable` must each be unique to the graph.
*
* <ul>
* <li>Non-null
* <li>Usable as `Map` keys (see the Guava User Guide's section on <a
* href="https://github.com/google/guava/wiki/GraphsExplained#graph-elements-nodes-and-edges">
* graph elements</a> for details)
* </ul>
*
* throws IllegalArgumentException if `node` is not an element of this graph
* Throws if `node` is not an element of this graph.
*/
successors(node: N): Iterable<N>;
}

@@ -5,11 +5,11 @@ import { BaseGraph } from "./BaseGraph";

/**
* An interface for <a
* A subinterface of {@link BaseGraph} for <a
* href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data,
* whose edges have associated non-unique values.
* whose edges have associated non-unique values
*
* @remarks
*
* <p>A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
* A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
*
* <p>There are three primary interfaces provided to represent graphs. In order of increasing
* There are three primary interfaces provided to represent graphs. In order of increasing
* complexity they are: {@link Graph}, {@link ValueGraph}, and {@link Network}. You should generally

@@ -20,5 +20,5 @@ * prefer the simplest interface that satisfies your use case. See the <a

*
* **Capabilities**
* <b>Capabilities</b>
*
* <p>`ValueGraph` supports the following use cases (<a
* `ValueGraph` supports the following use cases (<a
* href="https://github.com/google/guava/wiki/GraphsExplained#definitions">definitions of

@@ -35,3 +35,3 @@ * terms</a>):

*
* <p>`ValueGraph`, as a subtype of `Graph`, explicitly does not support parallel edges,
* `ValueGraph`, as a subtype of `Graph`, explicitly does not support parallel edges,
* and forbids implementations or extensions with parallel edges. If you need parallel edges, use

@@ -42,5 +42,5 @@ * {@link Network}. (You can use a positive `Integer` edge value as a loose representation of

*
* **Building a `ValueGraph`**
* <b>Building a `ValueGraph`</b>
*
* <p>The implementation classes that `common.graph` provides are not public, by design. To
* The implementation classes that are provided are not public, by design. To
* create an instance of one of the built-in implementations of `ValueGraph`, use the {@link

@@ -50,6 +50,6 @@ * ValueGraphBuilder} class:

* ```typescript
* MutableValueGraph<Integer, Double> graph = ValueGraphBuilder.directed().build();
* const graph: MutableValueGraph<number, number> = ValueGraphBuilder.directed().build();
* ```
*
* <p>{@link ValueGraphBuilder.build} returns an instance of {@link MutableValueGraph}, which is a
* {@link ValueGraphBuilder.build} returns an instance of {@link MutableValueGraph}, which is a
* subtype of `ValueGraph` that provides methods for adding and removing nodes and edges. If

@@ -60,32 +60,12 @@ * you do not need to mutate a graph (e.g. if you write a method than runs a read-only algorithm on

*
* <p>You can create an immutable copy of an existing `ValueGraph` using {@link
* You can create an immutable copy of an existing `ValueGraph` using {@link
* ImmutableValueGraph.copyOf}:
*
* ```typescript
* ImmutableValueGraph<Integer, Double> immutableGraph = ImmutableValueGraph.copyOf(graph);
* const immutableGraph: ImmutableValueGraph<number, number> = ImmutableValueGraph.copyOf(graph);
* ```
*
* <p>Instances of {@link ImmutableValueGraph} do not implement {@link MutableValueGraph}
* (obviously!) and are contractually guaranteed to be unmodifiable and thread-safe.
* Instances of {@link ImmutableValueGraph} do not implement {@link MutableValueGraph}
* (obviously!) and are contractually guaranteed to be unmodifiable.
*
* <p>The Guava User Guide has <a
* href="https://github.com/google/guava/wiki/GraphsExplained#building-graph-instances">more
* information on (and examples of) building graphs</a>.
*
* **Additional documentation**
*
* <p>See the Guava User Guide for the `common.graph` package (<a
* href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for
* additional documentation, including:
*
* <ul>
* <li><a
* href="https://github.com/google/guava/wiki/GraphsExplained#equals-hashcode-and-graph-equivalence">
* `equals()`, `hashCode()`, and graph equivalence</a>
* <li><a href="https://github.com/google/guava/wiki/GraphsExplained#synchronization">
* Synchronization policy</a>
* <li><a href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">Notes
* for implementors</a>
* </ul>
*
* @public

@@ -101,7 +81,5 @@ */

* Returns the value of the edge that connects `nodeU` to `nodeV` (in the order, if
* any, specified by `endpoints`), if one is present;
* otherwise, returns `Optional.empty()`.
* any, specified by `endpoints`), if one is present; otherwise, returns undefined.
*
* throws IllegalArgumentException if `nodeU` or `nodeV` is not an element of this
* graph
* Throws if `nodeU` or `nodeV` is not an element of this graph.
*/

@@ -111,8 +89,9 @@ edgeValue(nodeU: N, nodeV: N): V | undefined;

* Returns the value of the edge that connects `endpoints` (in the order, if any, specified
* by `endpoints`), if one is present; otherwise, returns `Optional.empty()`.
* by `endpoints`), if one is present; otherwise, returns undefined.
*
* <p>If this graph is directed, the endpoints must be ordered.
* If this graph is directed, the endpoints must be ordered.
*
* throws IllegalArgumentException if either endpoint is not an element of this graph
* throws IllegalArgumentException if the endpoints are unordered and the graph is directed
* Throws if either endpoint is not an element of this graph.
*
* Throws if the endpoints are unordered and the graph is directed.
*/

@@ -124,6 +103,5 @@ edgeValueConnectingEndpoints(endpoints: EndpointPair<N>): V | undefined;

*
* <p>In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`.
* In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`.
*
* throws IllegalArgumentException if `nodeU` or `nodeV` is not an element of this
* graph
* Throws if `nodeU` or `nodeV` is not an element of this graph.
*/

@@ -135,6 +113,7 @@ edgeValueOrDefault<R>(nodeU: N, nodeV: N, defaultValue: R): V | R;

*
* <p>If this graph is directed, the endpoints must be ordered.
* If this graph is directed, the endpoints must be ordered.
*
* throws IllegalArgumentException if either endpoint is not an element of this graph
* throws IllegalArgumentException if the endpoints are unordered and the graph is directed
* Throws if either endpoint is not an element of this graph.
*
* Throws if the endpoints are unordered and the graph is directed.
*/

@@ -146,19 +125,17 @@ edgeValueConnectingEndpointsOrDefault<R>(endpoints: EndpointPair<N>, defaultValue: R): V | R;

*
* <p>Thus, two value graphs A and B are equal if <b>all</b> of the following are true:
* Thus, two value graphs A and B are equal if <b>all</b> of the following are true:
*
* <ul>
* <li>A and B have equal {@link isDirected}.
* <li>A and B have equal {@link nodes}.
* <li>A and B have equal {@link edges}.
* <li>The {@link edgeValue} of a given edge is the same in both A and B.
* <li>A and B have equal {@link BaseGraph.isDirected}.
* <li>A and B have equal {@link BaseGraph.nodes}.
* <li>A and B have equal {@link BaseGraph.edges}.
* <li>The {@link ValueGraph.edgeValue} of a given edge is the same in both A and B.
* </ul>
*
* <p>Graph properties besides {@link isDirected} do <b>not</b> affect equality.
* Graph properties besides {@link BaseGraph.isDirected} do <b>not</b> affect equality.
* For example, two graphs may be considered equal even if one allows self-loops and the other
* doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order
* in which they are iterated over, are irrelevant.
*
* <p>A reference implementation of this is provided by {@link AbstractValueGraph.equals}.
*/
equals(obj: ValueGraph<N, V>): boolean;
equals(object: ValueGraph<N, V>): boolean;
}

@@ -10,13 +10,11 @@ import { AbstractGraphBuilder } from "./AbstractGraphBuilder";

*
* <p>A graph built by this class will have the following properties by default:
* A graph built by this class will have the following properties by default:
*
* <ul>
* <li>does not allow self-loops
* <li>orders {@link Graph.nodes} in the order in which the elements were added
* </ul>
* - does not allow self-loops
* - orders {@link BaseGraph.nodes} in the order in which the elements were added
*
* <p>Example of use:
* Example of use:
*
* ```typescript
* MutableValueGraph<String, number> graph =
* const graph: MutableValueGraph<String, number> =
* ValueGraphBuilder.undirected().allowsSelfLoops(true).build();

@@ -42,4 +40,4 @@ * graph.putEdgeValue("San Francisco", "San Francisco", 0.0);

* <p>The "queryable" properties are those that are exposed through the {@link ValueGraph}
* interface, such as {@link ValueGraph.isDirected}. Other properties, such as {@link
* expectedNodeCount}, are not set in the new builder.
* interface, such as {@link BaseGraph.isDirected}. Other properties, such as {@link
* ValueGraphBuilder.expectedNodeCount}, are not set in the new builder.
*/

@@ -49,4 +47,3 @@ static from<N, V>(graph: ValueGraph<N, V>): ValueGraphBuilder<N, V>;

* Specifies whether the graph will allow self-loops (edges that connect a node to itself).
* Attempting to add a self-loop to a graph that does not allow them will throw an {@link
* UnsupportedOperationException}.
* Attempting to add a self-loop to a graph that does not allow them will throw an error.
*/

@@ -57,6 +54,6 @@ allowsSelfLoops(allowsSelfLoops: boolean): ValueGraphBuilder<N, V>;

*
* throws an error if `expectedNodeCount` is negative
* Throws an error if `expectedNodeCount` is negative.
*/
expectedNodeCount(expectedNodeCount: number): ValueGraphBuilder<N, V>;
/** Specifies the order of iteration for the elements of {@link Graph.nodes}. */
/** Specifies the order of iteration for the elements of {@link BaseGraph.nodes}. */
nodeOrder(nodeOrder: ElementOrder<N>): ValueGraphBuilder<N, V>;

@@ -63,0 +60,0 @@ /**

@@ -27,13 +27,11 @@ "use strict";

*
* <p>A graph built by this class will have the following properties by default:
* A graph built by this class will have the following properties by default:
*
* <ul>
* <li>does not allow self-loops
* <li>orders {@link Graph.nodes} in the order in which the elements were added
* </ul>
* - does not allow self-loops
* - orders {@link BaseGraph.nodes} in the order in which the elements were added
*
* <p>Example of use:
* Example of use:
*
* ```typescript
* MutableValueGraph<String, number> graph =
* const graph: MutableValueGraph<String, number> =
* ValueGraphBuilder.undirected().allowsSelfLoops(true).build();

@@ -65,4 +63,4 @@ * graph.putEdgeValue("San Francisco", "San Francisco", 0.0);

* <p>The "queryable" properties are those that are exposed through the {@link ValueGraph}
* interface, such as {@link ValueGraph.isDirected}. Other properties, such as {@link
* expectedNodeCount}, are not set in the new builder.
* interface, such as {@link BaseGraph.isDirected}. Other properties, such as {@link
* ValueGraphBuilder.expectedNodeCount}, are not set in the new builder.
*/

@@ -76,4 +74,3 @@ static from(graph) {

* Specifies whether the graph will allow self-loops (edges that connect a node to itself).
* Attempting to add a self-loop to a graph that does not allow them will throw an {@link
* UnsupportedOperationException}.
* Attempting to add a self-loop to a graph that does not allow them will throw an error.
*/

@@ -87,3 +84,3 @@ allowsSelfLoops(allowsSelfLoops) {

*
* throws an error if `expectedNodeCount` is negative
* Throws an error if `expectedNodeCount` is negative.
*/

@@ -94,3 +91,3 @@ expectedNodeCount(expectedNodeCount) {

}
/** Specifies the order of iteration for the elements of {@link Graph.nodes}. */
/** Specifies the order of iteration for the elements of {@link BaseGraph.nodes}. */
nodeOrder(nodeOrder) {

@@ -97,0 +94,0 @@ this.nodeOrderValue = nodeOrder;

@@ -13,1 +13,2 @@ export { GraphBuilder } from './graph/GraphBuilder';

export { ElementOrder } from './graph/ElementOrder';
export { Comparator } from './collect/Comparator';
// @public
interface BaseGraph<N> extends SuccessorsFunction<N>, PredecessorsFunction<N> {
adjacentNodes(node: N): Set<N>;
// WARNING: Unable to find referenced export "graph-builder#IllegalArgumentException"
allowsSelfLoops(): boolean;

@@ -9,25 +8,22 @@ degree(node: N): number;

hasEdge(nodeU: N, nodeV: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#Collection"
hasEdgeConnectingEndpoints(endpoints: EndpointPair<N>): boolean;
incidentEdges(node: N): Set<EndpointPair<N>>;
// WARNING: Unable to find referenced export "graph-builder#degree"
inDegree(node: N): number;
isDirected(): boolean;
// WARNING: Unable to find referenced export "graph-builder#nodes"
nodeOrder(): ElementOrder<N>;
// WARNING: Unable to find referenced export "graph-builder#nodeOrder"
nodes(): Set<N>;
// WARNING: Unable to find referenced export "graph-builder#degree"
outDegree(node: N): number;
// WARNING: Unable to find referenced export "graph-builder#adjacentNodes"
predecessors(node: N): Set<N>;
// WARNING: Unable to find referenced export "graph-builder#Graphs"
// WARNING: Unable to find referenced export "graph-builder#adjacentNodes"
successors(node: N): Set<N>;
}
// @public (undocumented)
interface Comparator<T> {
compare(a: T, b: T): number;
}
// @public
class ElementOrder<T> {
// WARNING: The type "Type" needs to be exported by the package (e.g. added to index.ts)
// WARNING: The type "Comparator" needs to be exported by the package (e.g. added to index.ts)
constructor(type: Type, comparator?: Comparator<T> | undefined);

@@ -37,4 +33,2 @@ createMap<K extends T, V>(expectedSize: number): Map<K, V>;

equals(obj?: object): boolean;
// WARNING: Unable to find referenced export "graph-builder#Comparator"
// WARNING: The type "Comparator" needs to be exported by the package (e.g. added to index.ts)
getComparator(): Comparator<T>;

@@ -44,3 +38,2 @@ static insertion<S>(): ElementOrder<S>;

static natural<S extends Comparable<S>>(): ElementOrder<S>;
// WARNING: The type "Comparator" needs to be exported by the package (e.g. added to index.ts)
static sorted<S>(comparator: Comparator<S>): ElementOrder<S>;

@@ -53,10 +46,4 @@ // WARNING: The type "Type" needs to be exported by the package (e.g. added to index.ts)

// WARNING: Unable to find referenced export "graph-builder#nodeV"
// WARNING: Unable to find referenced export "graph-builder#nodeU"
// WARNING: Unable to find referenced export "graph-builder#target"
// WARNING: Unable to find referenced export "graph-builder#source"
// @public
class EndpointPair<N> implements Iterable<N> {
// WARNING: Unable to find referenced export "graph-builder#nodeV"
// WARNING: Unable to find referenced export "graph-builder#nodeU"
// WARNING: The name "__@iterator" contains unsupported characters; API names should use only letters, numbers, and underscores

@@ -66,4 +53,2 @@ [Symbol.iterator](): IterableIterator<N>;

adjacentNode(node: N): N;
// WARNING: Unable to find referenced export "graph-builder#target"
// WARNING: Unable to find referenced export "graph-builder#source"
abstract equals(obj?: Object): boolean;

@@ -77,5 +62,3 @@ abstract isOrdered(): boolean;

static ordered<N>(source: N, target: N): EndpointPair<N>;
// WARNING: Unable to find referenced export "graph-builder#isOrdered"
abstract source(): N;
// WARNING: Unable to find referenced export "graph-builder#isOrdered"
abstract target(): N;

@@ -92,11 +75,5 @@ static unordered<N>(nodeU: N, nodeV: N): EndpointPair<N>;

interface Graph<N> extends BaseGraph<N> {
// WARNING: Unable to find referenced export "graph-builder#AbstractGraph"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
// WARNING: Unable to find referenced export "graph-builder#edges"
// WARNING: Unable to find referenced export "graph-builder#nodes"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
equals(object: object): boolean;
}
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
// @public

@@ -108,6 +85,3 @@ class GraphBuilder<N> extends AbstractGraphBuilder<N> {

expectedNodeCount(expectedNodeCount: number): GraphBuilder<N>;
// WARNING: Unable to find referenced export "graph-builder#expectedNodeCount"
// WARNING: Unable to find referenced member "graph-builder#Graph.isDirected"
static from<T>(graph: Graph<T>): GraphBuilder<T>;
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
nodeOrder(nodeOrder: ElementOrder<N>): GraphBuilder<N>;

@@ -135,7 +109,3 @@ static undirected<T>(): GraphBuilder<T>;

addNode(node: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdge(nodeU: N, nodeV: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdgeConnectingEndpoints(endpoints: EndpointPair<N>): boolean;

@@ -150,7 +120,3 @@ removeEdge(nodeU: N, nodeV: N): boolean;

addNode(node: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdgeValue(nodeU: N, nodeV: N, value: V): V | undefined;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdgeValueConnectingEndpoints(endpoints: EndpointPair<N>, value: V): V | undefined;

@@ -166,3 +132,2 @@ removeEdge(nodeU: N, nodeV: N): V | undefined;

interface PredecessorsFunction<N> {
// WARNING: Unable to find referenced export "graph-builder#Iterable"
predecessors(node: N): Iterable<N>;

@@ -175,3 +140,2 @@ }

interface SuccessorsFunction<N> {
// WARNING: Unable to find referenced export "graph-builder#Iterable"
// WARNING: Unable to find referenced export "graph-builder#Graphs"

@@ -193,15 +157,7 @@ successors(node: N): Iterable<N>;

edgeValueOrDefault<R>(nodeU: N, nodeV: N, defaultValue: R): V | R;
// WARNING: Unable to find referenced export "graph-builder#AbstractValueGraph"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
// WARNING: Unable to find referenced export "graph-builder#edgeValue"
// WARNING: Unable to find referenced export "graph-builder#edges"
// WARNING: Unable to find referenced export "graph-builder#nodes"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
equals(obj: ValueGraph<N, V>): boolean;
equals(object: ValueGraph<N, V>): boolean;
}
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
// @public
class ValueGraphBuilder<N, V> extends AbstractGraphBuilder<N> {
// WARNING: Unable to find referenced export "graph-builder#UnsupportedOperationException"
allowsSelfLoops(allowsSelfLoops: boolean): ValueGraphBuilder<N, V>;

@@ -211,6 +167,3 @@ build(): MutableValueGraph<N, V>;

expectedNodeCount(expectedNodeCount: number): ValueGraphBuilder<N, V>;
// WARNING: Unable to find referenced export "graph-builder#expectedNodeCount"
// WARNING: Unable to find referenced member "graph-builder#ValueGraph.isDirected"
static from<N, V>(graph: ValueGraph<N, V>): ValueGraphBuilder<N, V>;
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
nodeOrder(nodeOrder: ElementOrder<N>): ValueGraphBuilder<N, V>;

@@ -217,0 +170,0 @@ static undirected<N, V>(): ValueGraphBuilder<N, V>;

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [adjacentNodes](./graph-builder.basegraph.adjacentnodes.md)

throws IllegalArgumentException if `node` is not an element of this graph
Throws an error if `node` is not an element of this graph.

@@ -10,0 +10,0 @@ **Signature:**

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)

Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an IllegalArgumentException<!-- -->.
Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an error.

@@ -8,0 +8,0 @@ **Signature:**

@@ -7,10 +7,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [degree](./graph-builder.basegraph.degree.md)

<p>For directed graphs, this is equal to `inDegree(node) + outDegree(node)`<!-- -->.
For directed graphs, this is equal to `inDegree(node) + outDegree(node)`<!-- -->.
<p>For undirected graphs, this is equal to `incidentEdges(node).size()` + (number of self-loops incident to `node`<!-- -->).
For undirected graphs, this is equal to `incidentEdges(node).size()` + (number of self-loops incident to `node`<!-- -->).
<p>If the count is greater than `Integer.MAX_VALUE`<!-- -->, returns `Integer.MAX_VALUE`<!-- -->.
Throws an error if `node` is not an element of this graph.
throws IllegalArgumentException if `node` is not an element of this graph
**Signature:**

@@ -17,0 +15,0 @@ ```javascript

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [hasEdge](./graph-builder.basegraph.hasedge.md)

<p>In an undirected graph, this is equal to `hasEdgeConnecting(nodeV, nodeU)`<!-- -->.
In an undirected graph, this is equal to `hasEdgeConnecting(nodeV, nodeU)`<!-- -->.

@@ -10,0 +10,0 @@ **Signature:**

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [hasEdgeConnectingEndpoints](./graph-builder.basegraph.hasedgeconnectingendpoints.md)

<p>Unlike the other `EndpointPair`<!-- -->-accepting methods, this method does not throw if the endpoints are unordered; it simply returns false. This is for consistency with the behavior of Collection.contains (which does not generally throw if the object cannot be present in the collection), and the desire to have this method's behavior be compatible with `edges().contains(endpoints)`<!-- -->.
Unlike the other `EndpointPair`<!-- -->-accepting methods, this method does not throw if the endpoints are unordered; it simply returns false. This is for consistency with the behavior of Set.has (which does not generally throw if the object cannot be present in the collection), and the desire to have this method's behavior be compatible with `edges().contains(endpoints)`<!-- -->.

@@ -10,0 +10,0 @@ **Signature:**

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [incidentEdges](./graph-builder.basegraph.incidentedges.md)

throws IllegalArgumentException if `node` is not an element of this graph
Throws an error if `node` is not an element of this graph.

@@ -10,0 +10,0 @@ **Signature:**

@@ -5,8 +5,6 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [inDegree](./graph-builder.basegraph.indegree.md)

Returns the count of `node`<!-- -->'s incoming edges (equal to `predecessors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the degree<!-- -->.
Returns the count of `node`<!-- -->'s incoming edges (equal to `predecessors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the [BaseGraph.degree](./graph-builder.basegraph.degree.md)<!-- -->.
<p>If the count is greater than `Integer.MAX_VALUE`<!-- -->, returns `Integer.MAX_VALUE`<!-- -->.
Throws an error if `node` is not an element of this graph.
throws IllegalArgumentException if `node` is not an element of this graph
**Signature:**

@@ -13,0 +11,0 @@ ```javascript

@@ -11,16 +11,16 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md)

| --- | --- | --- |
| [`adjacentNodes(node)`](./graph-builder.basegraph.adjacentnodes.md) | `Set<N>` | Returns the nodes which have an incident edge in common with `node` in this graph.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`allowsSelfLoops()`](./graph-builder.basegraph.allowsselfloops.md) | `boolean` | Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an IllegalArgumentException<!-- -->. |
| [`degree(node)`](./graph-builder.basegraph.degree.md) | `number` | Returns the count of `node`<!-- -->'s incident edges, counting self-loops twice (equivalently, the number of times an edge touches `node`<!-- -->).<p/><p>For directed graphs, this is equal to `inDegree(node) + outDegree(node)`<!-- -->.<p/><p>For undirected graphs, this is equal to `incidentEdges(node).size()` + (number of self-loops incident to `node`<!-- -->).<p/><p>If the count is greater than `Integer.MAX_VALUE`<!-- -->, returns `Integer.MAX_VALUE`<!-- -->.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`adjacentNodes(node)`](./graph-builder.basegraph.adjacentnodes.md) | `Set<N>` | Returns the nodes which have an incident edge in common with `node` in this graph.<p/>Throws an error if `node` is not an element of this graph. |
| [`allowsSelfLoops()`](./graph-builder.basegraph.allowsselfloops.md) | `boolean` | Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an error. |
| [`degree(node)`](./graph-builder.basegraph.degree.md) | `number` | Returns the count of `node`<!-- -->'s incident edges, counting self-loops twice (equivalently, the number of times an edge touches `node`<!-- -->).<p/>For directed graphs, this is equal to `inDegree(node) + outDegree(node)`<!-- -->.<p/>For undirected graphs, this is equal to `incidentEdges(node).size()` + (number of self-loops incident to `node`<!-- -->).<p/>Throws an error if `node` is not an element of this graph. |
| [`edges()`](./graph-builder.basegraph.edges.md) | `Set<EndpointPair<N>>` | Returns all edges in this graph. |
| [`hasEdge(nodeU, nodeV)`](./graph-builder.basegraph.hasedge.md) | `boolean` | Returns true if there is an edge that directly connects `nodeU` to `nodeV`<!-- -->. This is equivalent to `nodes().contains(nodeU) && successors(nodeU).contains(nodeV)`<!-- -->.<p/><p>In an undirected graph, this is equal to `hasEdgeConnecting(nodeV, nodeU)`<!-- -->. |
| [`hasEdgeConnectingEndpoints(endpoints)`](./graph-builder.basegraph.hasedgeconnectingendpoints.md) | `boolean` | Returns true if there is an edge that directly connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->). This is equivalent to `edges().contains(endpoints)`<!-- -->.<p/><p>Unlike the other `EndpointPair`<!-- -->-accepting methods, this method does not throw if the endpoints are unordered; it simply returns false. This is for consistency with the behavior of Collection.contains (which does not generally throw if the object cannot be present in the collection), and the desire to have this method's behavior be compatible with `edges().contains(endpoints)`<!-- -->. |
| [`incidentEdges(node)`](./graph-builder.basegraph.incidentedges.md) | `Set<EndpointPair<N>>` | Returns the edges in this graph whose endpoints include `node`<!-- -->.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`inDegree(node)`](./graph-builder.basegraph.indegree.md) | `number` | Returns the count of `node`<!-- -->'s incoming edges (equal to `predecessors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the degree<!-- -->.<p/><p>If the count is greater than `Integer.MAX_VALUE`<!-- -->, returns `Integer.MAX_VALUE`<!-- -->.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`hasEdge(nodeU, nodeV)`](./graph-builder.basegraph.hasedge.md) | `boolean` | Returns true if there is an edge that directly connects `nodeU` to `nodeV`<!-- -->. This is equivalent to `nodes().contains(nodeU) && successors(nodeU).contains(nodeV)`<!-- -->.<p/>In an undirected graph, this is equal to `hasEdgeConnecting(nodeV, nodeU)`<!-- -->. |
| [`hasEdgeConnectingEndpoints(endpoints)`](./graph-builder.basegraph.hasedgeconnectingendpoints.md) | `boolean` | Returns true if there is an edge that directly connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->). This is equivalent to `edges().contains(endpoints)`<!-- -->.<p/>Unlike the other `EndpointPair`<!-- -->-accepting methods, this method does not throw if the endpoints are unordered; it simply returns false. This is for consistency with the behavior of Set.has (which does not generally throw if the object cannot be present in the collection), and the desire to have this method's behavior be compatible with `edges().contains(endpoints)`<!-- -->. |
| [`incidentEdges(node)`](./graph-builder.basegraph.incidentedges.md) | `Set<EndpointPair<N>>` | Returns the edges in this graph whose endpoints include `node`<!-- -->.<p/>Throws an error if `node` is not an element of this graph. |
| [`inDegree(node)`](./graph-builder.basegraph.indegree.md) | `number` | Returns the count of `node`<!-- -->'s incoming edges (equal to `predecessors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the [BaseGraph.degree](./graph-builder.basegraph.degree.md)<!-- -->.<p/>Throws an error if `node` is not an element of this graph. |
| [`isDirected()`](./graph-builder.basegraph.isdirected.md) | `boolean` | Returns true if the edges in this graph are directed. Directed edges connect a [EndpointPair.source](./graph-builder.endpointpair.source.md) to a [EndpointPair.target](./graph-builder.endpointpair.target.md)<!-- -->, while undirected edges connect a pair of nodes to each other. |
| [`nodeOrder()`](./graph-builder.basegraph.nodeorder.md) | `ElementOrder<N>` | Returns the order of iteration for the elements of nodes<!-- -->. |
| [`nodes()`](./graph-builder.basegraph.nodes.md) | `Set<N>` | Returns all nodes in this graph, in the order specified by nodeOrder<!-- -->. |
| [`outDegree(node)`](./graph-builder.basegraph.outdegree.md) | `number` | Returns the count of `node`<!-- -->'s outgoing edges (equal to `successors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the degree<!-- -->.<p/><p>If the count is greater than `Integer.MAX_VALUE`<!-- -->, returns `Integer.MAX_VALUE`<!-- -->.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`predecessors(node)`](./graph-builder.basegraph.predecessors.md) | `Set<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s incoming edges <i>against</i> the direction (if any) of the edge.<p/><p>In an undirected graph, this is equivalent to adjacentNodes<!-- -->.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`successors(node)`](./graph-builder.basegraph.successors.md) | `Set<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s outgoing edges in the direction (if any) of the edge.<p/><p>In an undirected graph, this is equivalent to adjacentNodes<!-- -->.<p/><p>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.<p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`nodeOrder()`](./graph-builder.basegraph.nodeorder.md) | `ElementOrder<N>` | Returns the order of iteration for the elements of [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. |
| [`nodes()`](./graph-builder.basegraph.nodes.md) | `Set<N>` | Returns all nodes in this graph, in the order specified by [BaseGraph.nodeOrder](./graph-builder.basegraph.nodeorder.md)<!-- -->. |
| [`outDegree(node)`](./graph-builder.basegraph.outdegree.md) | `number` | Returns the count of `node`<!-- -->'s outgoing edges (equal to `successors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the [BaseGraph.degree](./graph-builder.basegraph.degree.md)<!-- -->.<p/>Throws an error if `node` is not an element of this graph. |
| [`predecessors(node)`](./graph-builder.basegraph.predecessors.md) | `Set<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s incoming edges <i>against</i> the direction (if any) of the edge.<p/>In an undirected graph, this is equivalent to [BaseGraph.adjacentNodes](./graph-builder.basegraph.adjacentnodes.md)<!-- -->.<p/>Throws an error if `node` is not an element of this graph. |
| [`successors(node)`](./graph-builder.basegraph.successors.md) | `Set<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s outgoing edges in the direction (if any) of the edge.<p/>In an undirected graph, this is equivalent to [BaseGraph.adjacentNodes](./graph-builder.basegraph.adjacentnodes.md)<!-- -->.<p/>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.<p/>Throws an error if `node` is not an element of this graph. |

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [nodeOrder](./graph-builder.basegraph.nodeorder.md)

Returns the order of iteration for the elements of nodes<!-- -->.
Returns the order of iteration for the elements of [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->.

@@ -8,0 +8,0 @@ **Signature:**

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [nodes](./graph-builder.basegraph.nodes.md)

Returns all nodes in this graph, in the order specified by nodeOrder<!-- -->.
Returns all nodes in this graph, in the order specified by [BaseGraph.nodeOrder](./graph-builder.basegraph.nodeorder.md)<!-- -->.

@@ -8,0 +8,0 @@ **Signature:**

@@ -5,8 +5,6 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [outDegree](./graph-builder.basegraph.outdegree.md)

Returns the count of `node`<!-- -->'s outgoing edges (equal to `successors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the degree<!-- -->.
Returns the count of `node`<!-- -->'s outgoing edges (equal to `successors(node).size()`<!-- -->) in a directed graph. In an undirected graph, returns the [BaseGraph.degree](./graph-builder.basegraph.degree.md)<!-- -->.
<p>If the count is greater than `Integer.MAX_VALUE`<!-- -->, returns `Integer.MAX_VALUE`<!-- -->.
Throws an error if `node` is not an element of this graph.
throws IllegalArgumentException if `node` is not an element of this graph
**Signature:**

@@ -13,0 +11,0 @@ ```javascript

@@ -7,5 +7,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [predecessors](./graph-builder.basegraph.predecessors.md)

<p>In an undirected graph, this is equivalent to adjacentNodes<!-- -->.
In an undirected graph, this is equivalent to [BaseGraph.adjacentNodes](./graph-builder.basegraph.adjacentnodes.md)<!-- -->.
throws IllegalArgumentException if `node` is not an element of this graph
Throws an error if `node` is not an element of this graph.

@@ -12,0 +12,0 @@ **Signature:**

@@ -7,7 +7,7 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [BaseGraph](./graph-builder.basegraph.md) &gt; [successors](./graph-builder.basegraph.successors.md)

<p>In an undirected graph, this is equivalent to adjacentNodes<!-- -->.
In an undirected graph, this is equivalent to [BaseGraph.adjacentNodes](./graph-builder.basegraph.adjacentnodes.md)<!-- -->.
<p>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.
This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.
throws IllegalArgumentException if `node` is not an element of this graph
Throws an error if `node` is not an element of this graph.

@@ -14,0 +14,0 @@ **Signature:**

@@ -5,5 +5,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ElementOrder](./graph-builder.elementorder.md) &gt; [getComparator](./graph-builder.elementorder.getcomparator.md)

Returns the Comparator used.
Returns the [Comparator](./graph-builder.comparator.md) used.
throws UnsupportedOperationException if comparator is not defined
Throws an error if comparator is not defined

@@ -10,0 +10,0 @@ **Signature:**

@@ -20,3 +20,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ElementOrder](./graph-builder.elementorder.md)

| [`equals(obj)`](./graph-builder.elementorder.equals.md) | | `boolean` | |
| [`getComparator()`](./graph-builder.elementorder.getcomparator.md) | | `Comparator<T>` | Returns the Comparator used.<p/>throws UnsupportedOperationException if comparator is not defined |
| [`getComparator()`](./graph-builder.elementorder.getcomparator.md) | | `Comparator<T>` | Returns the [Comparator](./graph-builder.comparator.md) used.<p/>Throws an error if comparator is not defined |
| [`insertion()`](./graph-builder.elementorder.insertion.md) | | `ElementOrder<S>` | Returns an instance which specifies that insertion ordering is guaranteed. |

@@ -29,8 +29,8 @@ | [`natural()`](./graph-builder.elementorder.natural.md) | | `ElementOrder<S>` | Returns an instance which specifies that the natural ordering of the elements is guaranteed. |

<p>Example usage:
Example usage:
```javascript
MutableGraph<Integer> graph =
GraphBuilder.directed().nodeOrder(ElementOrder.<Integer>natural()).build();
const graph: MutableGraph<number> =
GraphBuilder.directed().nodeOrder(ElementOrder.natural<number>()).build();
}
```

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [EndpointPair](./graph-builder.endpointpair.md) &gt; [adjacentNode](./graph-builder.endpointpair.adjacentnode.md)

throws IllegalArgumentException if this [EndpointPair](./graph-builder.endpointpair.md) does not contain `node`
Throws an error if this [EndpointPair](./graph-builder.endpointpair.md) does not contain `node`<!-- -->.

@@ -10,0 +10,0 @@ **Signature:**

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [EndpointPair](./graph-builder.endpointpair.md) &gt; [equals](./graph-builder.endpointpair.equals.md)

Two ordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if their source and target are equal. Two unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if they contain the same nodes. An ordered [EndpointPair](./graph-builder.endpointpair.md) is never equal to an unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->.
Two ordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if their [EndpointPair.source](./graph-builder.endpointpair.source.md) and [EndpointPair.target](./graph-builder.endpointpair.target.md) are equal. Two unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if they contain the same nodes. An ordered [EndpointPair](./graph-builder.endpointpair.md) is never equal to an unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->.

@@ -8,0 +8,0 @@ **Signature:**

@@ -5,5 +5,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [EndpointPair](./graph-builder.endpointpair.md)

An immutable pair representing the two endpoints of an edge in a graph. The [EndpointPair](./graph-builder.endpointpair.md) of a directed edge is an ordered pair of nodes (<!-- -->source and target<!-- -->). The [EndpointPair](./graph-builder.endpointpair.md) of an undirected edge is an unordered pair of nodes (<!-- -->nodeU and nodeV<!-- -->).
An immutable pair representing the two endpoints of an edge in a graph. The [EndpointPair](./graph-builder.endpointpair.md) of a directed edge is an ordered pair of nodes ([EndpointPair.source](./graph-builder.endpointpair.source.md) and [EndpointPair.target](./graph-builder.endpointpair.target.md)<!-- -->). The [EndpointPair](./graph-builder.endpointpair.md) of an undirected edge is an unordered pair of nodes ([EndpointPair.nodeU](./graph-builder.endpointpair.nodeu.md) and [EndpointPair.nodeV](./graph-builder.endpointpair.nodev.md)<!-- -->).
<p>The edge is a self-loop if, and only if, the two endpoints are equal.
The edge is a self-loop if, and only if, the two endpoints are equal.

@@ -22,10 +22,10 @@ ## Properties

| [`constructor(nodeU, nodeV)`](./graph-builder.endpointpair.constructor.md) | | | Constructs a new instance of the [EndpointPair](./graph-builder.endpointpair.md) class |
| [`adjacentNode(node)`](./graph-builder.endpointpair.adjacentnode.md) | | `N` | Returns the node that is adjacent to `node` along the origin edge.<p/>throws IllegalArgumentException if this [EndpointPair](./graph-builder.endpointpair.md) does not contain `node` |
| [`equals(obj)`](./graph-builder.endpointpair.equals.md) | | `boolean` | Two ordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if their source and target are equal. Two unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if they contain the same nodes. An ordered [EndpointPair](./graph-builder.endpointpair.md) is never equal to an unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->. |
| [`adjacentNode(node)`](./graph-builder.endpointpair.adjacentnode.md) | | `N` | Returns the node that is adjacent to `node` along the origin edge.<p/>Throws an error if this [EndpointPair](./graph-builder.endpointpair.md) does not contain `node`<!-- -->. |
| [`equals(obj)`](./graph-builder.endpointpair.equals.md) | | `boolean` | Two ordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if their [EndpointPair.source](./graph-builder.endpointpair.source.md) and [EndpointPair.target](./graph-builder.endpointpair.target.md) are equal. Two unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->s are equal if they contain the same nodes. An ordered [EndpointPair](./graph-builder.endpointpair.md) is never equal to an unordered [EndpointPair](./graph-builder.endpointpair.md)<!-- -->. |
| [`isOrdered()`](./graph-builder.endpointpair.isordered.md) | | `boolean` | Returns `true` if this [EndpointPair](./graph-builder.endpointpair.md) is an ordered pair (i.e. represents the endpoints of a directed edge). |
| [`of(graph, nodeU, nodeV)`](./graph-builder.endpointpair.of.md) | | `EndpointPair<N>` | Returns an [EndpointPair](./graph-builder.endpointpair.md) representing the endpoints of an edge in `graph`<!-- -->. |
| [`ordered(source, target)`](./graph-builder.endpointpair.ordered.md) | | `EndpointPair<N>` | Returns an [EndpointPair](./graph-builder.endpointpair.md) representing the endpoints of a directed edge. |
| [`source()`](./graph-builder.endpointpair.source.md) | | `N` | If this [EndpointPair](./graph-builder.endpointpair.md) isOrdered<!-- -->, returns the node which is the source.<p/>throws UnsupportedOperationException if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered |
| [`target()`](./graph-builder.endpointpair.target.md) | | `N` | If this [EndpointPair](./graph-builder.endpointpair.md) isOrdered<!-- -->, returns the node which is the target.<p/>throws UnsupportedOperationException if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered |
| [`source()`](./graph-builder.endpointpair.source.md) | | `N` | If this [EndpointPair](./graph-builder.endpointpair.md) [EndpointPair.isOrdered](./graph-builder.endpointpair.isordered.md)<!-- -->, returns the node which is the source.<p/>Throws an error if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered. |
| [`target()`](./graph-builder.endpointpair.target.md) | | `N` | If this [EndpointPair](./graph-builder.endpointpair.md) [EndpointPair.isOrdered](./graph-builder.endpointpair.isordered.md)<!-- -->, returns the node which is the target.<p/>Throws an error if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered. |
| [`unordered(nodeU, nodeV)`](./graph-builder.endpointpair.unordered.md) | | `EndpointPair<N>` | Returns an [EndpointPair](./graph-builder.endpointpair.md) representing the endpoints of an undirected edge. |

@@ -5,5 +5,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [EndpointPair](./graph-builder.endpointpair.md) &gt; [source](./graph-builder.endpointpair.source.md)

If this [EndpointPair](./graph-builder.endpointpair.md) isOrdered<!-- -->, returns the node which is the source.
If this [EndpointPair](./graph-builder.endpointpair.md) [EndpointPair.isOrdered](./graph-builder.endpointpair.isordered.md)<!-- -->, returns the node which is the source.
throws UnsupportedOperationException if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered
Throws an error if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered.

@@ -10,0 +10,0 @@ **Signature:**

@@ -5,5 +5,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [EndpointPair](./graph-builder.endpointpair.md) &gt; [target](./graph-builder.endpointpair.target.md)

If this [EndpointPair](./graph-builder.endpointpair.md) isOrdered<!-- -->, returns the node which is the target.
If this [EndpointPair](./graph-builder.endpointpair.md) [EndpointPair.isOrdered](./graph-builder.endpointpair.isordered.md)<!-- -->, returns the node which is the target.
throws UnsupportedOperationException if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered
Throws an error if this [EndpointPair](./graph-builder.endpointpair.md) is not ordered.

@@ -10,0 +10,0 @@ **Signature:**

@@ -7,10 +7,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [Graph](./graph-builder.graph.md) &gt; [equals](./graph-builder.graph.equals.md)

<p>Thus, two graphs A and B are equal if <b>all</b> of the following are true:
Thus, two graphs A and B are equal if <b>all</b> of the following are true:
<ul> <li>A and B have equal isDirected<!-- -->. <li>A and B have equal nodes<!-- -->. <li>A and B have equal edges<!-- -->. </ul>
<ul> <li>A and B have equal [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. <li>A and B have equal [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. <li>A and B have equal [BaseGraph.edges](./graph-builder.basegraph.edges.md)<!-- -->. </ul>
<p>Graph properties besides isDirected do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.
Graph properties besides [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md) do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.
<p>A reference implementation of this is provided by AbstractGraph.equals<!-- -->.
**Signature:**

@@ -17,0 +15,0 @@ ```javascript

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [Graph](./graph-builder.graph.md)

An interface for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges are anonymous entities with no identity or information of their own.
A subinterface of [BaseGraph](./graph-builder.basegraph.md) for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges are anonymous entities with no identity or information of their own.

@@ -12,40 +12,32 @@ ## Methods

| --- | --- | --- |
| [`equals(object)`](./graph-builder.graph.equals.md) | `boolean` | Returns `true` iff `object` is a [Graph](./graph-builder.graph.md) that has the same elements and the same structural relationships as those in this graph.<p/><p>Thus, two graphs A and B are equal if <b>all</b> of the following are true:<p/><ul> <li>A and B have equal isDirected<!-- -->. <li>A and B have equal nodes<!-- -->. <li>A and B have equal edges<!-- -->. </ul><p/><p>Graph properties besides isDirected do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.<p/><p>A reference implementation of this is provided by AbstractGraph.equals<!-- -->. |
| [`equals(object)`](./graph-builder.graph.equals.md) | `boolean` | Returns `true` iff `object` is a [Graph](./graph-builder.graph.md) that has the same elements and the same structural relationships as those in this graph.<p/>Thus, two graphs A and B are equal if <b>all</b> of the following are true:<p/><ul> <li>A and B have equal [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. <li>A and B have equal [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. <li>A and B have equal [BaseGraph.edges](./graph-builder.basegraph.edges.md)<!-- -->. </ul><p/>Graph properties besides [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md) do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant. |
## Remarks
<p>A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
<p>There are three primary interfaces provided to represent graphs. In order of increasing complexity they are: [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->. You should generally prefer the simplest interface that satisfies your use case. See the <a href="https://github.com/google/guava/wiki/GraphsExplained#choosing-the-right-graph-type"> "Choosing the right graph type"</a> section of the Guava User Guide for more details.
There are three primary interfaces provided to represent graphs. In order of increasing complexity they are: [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->. You should generally prefer the simplest interface that satisfies your use case. See the <a href="https://github.com/google/guava/wiki/GraphsExplained#choosing-the-right-graph-type"> "Choosing the right graph type"</a> section of the Guava User Guide for more details.
\*\*Capabilities\*\*
<b>Capabilities</b>
<p>`Graph` supports the following use cases (<a href="https://github.com/google/guava/wiki/GraphsExplained#definitions">definitions of terms</a>):
`Graph` supports the following use cases (<a href="https://github.com/google/guava/wiki/GraphsExplained#definitions">definitions of terms</a>):
<ul> <li>directed graphs <li>undirected graphs <li>graphs that do/don't allow self-loops <li>graphs whose nodes/edges are insertion-ordered, sorted, or unordered </ul>
<p>`Graph` explicitly does not support parallel edges, and forbids implementations or extensions with parallel edges. If you need parallel edges, use Network<!-- -->.
`Graph` explicitly does not support parallel edges, and forbids implementations or extensions with parallel edges. If you need parallel edges, use Network<!-- -->.
\*\*Building a `Graph`<!-- -->\*\*
<b>Building a `Graph`</b>
<p>The implementation classes that `common.graph` provides are not public, by design. To create an instance of one of the built-in implementations of `Graph`<!-- -->, use the [GraphBuilder](./graph-builder.graphbuilder.md) class:
The implementation classes that are provided are not public, by design. To create an instance of one of the built-in implementations of `Graph`<!-- -->, use the [GraphBuilder](./graph-builder.graphbuilder.md) class:
```javascript
MutableGraph<Integer> graph = GraphBuilder.undirected().build();
const graph: MutableGraph<number> = GraphBuilder.undirected().build();
```
<p>[GraphBuilder.build](./graph-builder.graphbuilder.build.md) returns an instance of [MutableGraph](./graph-builder.mutablegraph.md)<!-- -->, which is a subtype of `Graph` that provides methods for adding and removing nodes and edges. If you do not need to mutate a graph (e.g. if you write a method than runs a read-only algorithm on the graph), you should use the non-mutating [Graph](./graph-builder.graph.md) interface, or an ImmutableGraph<!-- -->.
[GraphBuilder.build](./graph-builder.graphbuilder.build.md) returns an instance of [MutableGraph](./graph-builder.mutablegraph.md)<!-- -->, which is a subtype of `Graph` that provides methods for adding and removing nodes and edges. If you do not need to mutate a graph (e.g. if you write a method than runs a read-only algorithm on the graph), you should use the non-mutating [Graph](./graph-builder.graph.md) interface, or an ImmutableGraph<!-- -->.
<p>You can create an immutable copy of an existing `Graph` using ImmutableGraph.copyOf<!-- -->:
You can create an immutable copy of an existing `Graph` using ImmutableGraph.copyOf<!-- -->:
```javascript
ImmutableGraph<Integer> immutableGraph = ImmutableGraph.copyOf(graph);
const immutableGraph: ImmutableGraph<number> = ImmutableGraph.copyOf(graph);
```
<p>Instances of ImmutableGraph do not implement [MutableGraph](./graph-builder.mutablegraph.md) (obviously!) and are contractually guaranteed to be unmodifiable and thread-safe.
<p>The Guava User Guide has <a href="https://github.com/google/guava/wiki/GraphsExplained#building-graph-instances">more information on (and examples of) building graphs</a>.
\*\*Additional documentation\*\*
<p>See the Guava User Guide for the `common.graph` package (<a href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for additional documentation, including:
<ul> <li><a href="https://github.com/google/guava/wiki/GraphsExplained#equals-hashcode-and-graph-equivalence"> `equals()`<!-- -->, `hashCode()`<!-- -->, and graph equivalence</a> <li><a href="https://github.com/google/guava/wiki/GraphsExplained#synchronization"> Synchronization policy</a> <li><a href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">Notes for implementors</a> </ul>
Instances of ImmutableGraph do not implement [MutableGraph](./graph-builder.mutablegraph.md) (obviously!) and are contractually guaranteed to be unmodifiable.

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [GraphBuilder](./graph-builder.graphbuilder.md) &gt; [from](./graph-builder.graphbuilder.from.md)

<p>The "queryable" properties are those that are exposed through the [Graph](./graph-builder.graph.md) interface, such as Graph.isDirected<!-- -->. Other properties, such as expectedNodeCount<!-- -->, are not set in the new builder.
<p>The "queryable" properties are those that are exposed through the [Graph](./graph-builder.graph.md) interface, such as [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. Other properties, such as [GraphBuilder.expectedNodeCount](./graph-builder.graphbuilder.expectednodecount.md)<!-- -->, are not set in the new builder.

@@ -10,0 +10,0 @@ **Signature:**

@@ -15,4 +15,4 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [GraphBuilder](./graph-builder.graphbuilder.md)

| [`expectedNodeCount(expectedNodeCount)`](./graph-builder.graphbuilder.expectednodecount.md) | | `GraphBuilder<N>` | Specifies the expected number of nodes in the graph.<p/>throws an error if `expectedNodeCount` is negative |
| [`from(graph)`](./graph-builder.graphbuilder.from.md) | | `GraphBuilder<T>` | Returns a [GraphBuilder](./graph-builder.graphbuilder.md) initialized with all properties queryable from `graph`<!-- -->.<p/><p>The "queryable" properties are those that are exposed through the [Graph](./graph-builder.graph.md) interface, such as Graph.isDirected<!-- -->. Other properties, such as expectedNodeCount<!-- -->, are not set in the new builder. |
| [`nodeOrder(nodeOrder)`](./graph-builder.graphbuilder.nodeorder.md) | | `GraphBuilder<N>` | Specifies the order of iteration for the elements of Graph.nodes<!-- -->. |
| [`from(graph)`](./graph-builder.graphbuilder.from.md) | | `GraphBuilder<T>` | Returns a [GraphBuilder](./graph-builder.graphbuilder.md) initialized with all properties queryable from `graph`<!-- -->.<p/><p>The "queryable" properties are those that are exposed through the [Graph](./graph-builder.graph.md) interface, such as [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. Other properties, such as [GraphBuilder.expectedNodeCount](./graph-builder.graphbuilder.expectednodecount.md)<!-- -->, are not set in the new builder. |
| [`nodeOrder(nodeOrder)`](./graph-builder.graphbuilder.nodeorder.md) | | `GraphBuilder<N>` | Specifies the order of iteration for the elements of [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. |
| [`undirected()`](./graph-builder.graphbuilder.undirected.md) | | `GraphBuilder<T>` | Returns a [GraphBuilder](./graph-builder.graphbuilder.md) for building undirected graphs. |

@@ -22,9 +22,9 @@

<p>A graph built by this class will have the following properties by default:
A graph built by this class will have the following properties by default:
<ul> <li>does not allow self-loops <li>orders Graph.nodes in the order in which the elements were added </ul>
<ul> <li>does not allow self-loops</li> <li>orders [BaseGraph.nodes](./graph-builder.basegraph.nodes.md) in the order in which the elements were added</li> </ul>
Example of use:
```javascript
MutableGraph<String> graph = GraphBuilder.undirected().allowsSelfLoops(true).build();
const graph: MutableGraph<String> = GraphBuilder.undirected().allowsSelfLoops(true).build();
graph.putEdge("bread", "bread");

@@ -31,0 +31,0 @@ graph.putEdge("chocolate", "peanut butter");

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [GraphBuilder](./graph-builder.graphbuilder.md) &gt; [nodeOrder](./graph-builder.graphbuilder.nodeorder.md)

Specifies the order of iteration for the elements of Graph.nodes<!-- -->.
Specifies the order of iteration for the elements of [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->.

@@ -8,0 +8,0 @@ **Signature:**

@@ -10,3 +10,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md)

| [`ElementOrder`](./graph-builder.elementorder.md) | Used to represent the order of elements in a data structure that supports different options for iteration order guarantees. |
| [`EndpointPair`](./graph-builder.endpointpair.md) | An immutable pair representing the two endpoints of an edge in a graph. The [EndpointPair](./graph-builder.endpointpair.md) of a directed edge is an ordered pair of nodes (<!-- -->source and target<!-- -->). The [EndpointPair](./graph-builder.endpointpair.md) of an undirected edge is an unordered pair of nodes (<!-- -->nodeU and nodeV<!-- -->).<p/><p>The edge is a self-loop if, and only if, the two endpoints are equal. |
| [`EndpointPair`](./graph-builder.endpointpair.md) | An immutable pair representing the two endpoints of an edge in a graph. The [EndpointPair](./graph-builder.endpointpair.md) of a directed edge is an ordered pair of nodes ([EndpointPair.source](./graph-builder.endpointpair.source.md) and [EndpointPair.target](./graph-builder.endpointpair.target.md)<!-- -->). The [EndpointPair](./graph-builder.endpointpair.md) of an undirected edge is an unordered pair of nodes ([EndpointPair.nodeU](./graph-builder.endpointpair.nodeu.md) and [EndpointPair.nodeV](./graph-builder.endpointpair.nodev.md)<!-- -->).<p/>The edge is a self-loop if, and only if, the two endpoints are equal. |
| [`GraphBuilder`](./graph-builder.graphbuilder.md) | A builder for constructing instances of [MutableGraph](./graph-builder.mutablegraph.md) with user-defined properties. |

@@ -20,3 +20,4 @@ | [`ValueGraphBuilder`](./graph-builder.valuegraphbuilder.md) | A builder for constructing instances of [MutableValueGraph](./graph-builder.mutablevaluegraph.md) with user-defined properties. |

| [`BaseGraph`](./graph-builder.basegraph.md) | A non-public interface for the methods shared between [Graph](./graph-builder.graph.md) and [ValueGraph](./graph-builder.valuegraph.md)<!-- -->. |
| [`Graph`](./graph-builder.graph.md) | An interface for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges are anonymous entities with no identity or information of their own. |
| [`Comparator`](./graph-builder.comparator.md) | |
| [`Graph`](./graph-builder.graph.md) | A subinterface of [BaseGraph](./graph-builder.basegraph.md) for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges are anonymous entities with no identity or information of their own. |
| [`GraphConnections`](./graph-builder.graphconnections.md) | An interface for representing and manipulating an origin node's adjacent nodes and edge values in a [Graph](./graph-builder.graph.md)<!-- -->. |

@@ -27,3 +28,3 @@ | [`MutableGraph`](./graph-builder.mutablegraph.md) | A subinterface of [Graph](./graph-builder.graph.md) which adds mutation methods. When mutation is not required, users should prefer the [Graph](./graph-builder.graph.md) interface. |

| [`SuccessorsFunction`](./graph-builder.successorsfunction.md) | A functional interface for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data. |
| [`ValueGraph`](./graph-builder.valuegraph.md) | An interface for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges have associated non-unique values. |
| [`ValueGraph`](./graph-builder.valuegraph.md) | A subinterface of [BaseGraph](./graph-builder.basegraph.md) for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges have associated non-unique values |

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableGraph](./graph-builder.mutablegraph.md) &gt; [addNode](./graph-builder.mutablegraph.addnode.md)

<p><b>Nodes must be unique</b>, just as `Map` keys must be. They must also be non-null.
<b>Nodes must be unique</b>, just as `Map` keys must be.

@@ -10,0 +10,0 @@ **Signature:**

@@ -11,8 +11,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableGraph](./graph-builder.mutablegraph.md)

| --- | --- | --- |
| [`addNode(node)`](./graph-builder.mutablegraph.addnode.md) | `boolean` | Adds `node` if it is not already present.<p/><p><b>Nodes must be unique</b>, just as `Map` keys must be. They must also be non-null. |
| [`putEdge(nodeU, nodeV)`](./graph-builder.mutablegraph.putedge.md) | `boolean` | Adds an edge connecting `nodeU` to `nodeV` if one is not already present.<p/><p>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.<p/><p>If `nodeU` and `nodeV` are not already present in this graph, this method will silently addNode `nodeU` and `nodeV` to the graph. |
| [`putEdgeConnectingEndpoints(endpoints)`](./graph-builder.mutablegraph.putedgeconnectingendpoints.md) | `boolean` | Adds an edge connecting `endpoints` (in the order, if any, specified by `endpoints` if one is not already present.<p/><p>If this graph is directed, `endpoints` must be ordered and the added edge will be directed; if it is undirected, the added edge will be undirected.<p/><p>If this graph is directed, `endpoints` must be ordered.<p/><p>If either or both endpoints are not already present in this graph, this method will silently addNode each missing endpoint to the graph. |
| [`addNode(node)`](./graph-builder.mutablegraph.addnode.md) | `boolean` | Adds `node` if it is not already present.<p/><b>Nodes must be unique</b>, just as `Map` keys must be. |
| [`putEdge(nodeU, nodeV)`](./graph-builder.mutablegraph.putedge.md) | `boolean` | Adds an edge connecting `nodeU` to `nodeV` if one is not already present.<p/>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.<p/>If `nodeU` and `nodeV` are not already present in this graph, this method will silently [MutableGraph.addNode](./graph-builder.mutablegraph.addnode.md) `nodeU` and `nodeV` to the graph.<p/>Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)<!-- -->. |
| [`putEdgeConnectingEndpoints(endpoints)`](./graph-builder.mutablegraph.putedgeconnectingendpoints.md) | `boolean` | Adds an edge connecting `endpoints` (in the order, if any, specified by `endpoints` if one is not already present.<p/>If this graph is directed, `endpoints` must be ordered and the added edge will be directed; if it is undirected, the added edge will be undirected.<p/>If this graph is directed, `endpoints` must be ordered.<p/>If either or both endpoints are not already present in this graph, this method will silently [MutableGraph.addNode](./graph-builder.mutablegraph.addnode.md) each missing endpoint to the graph.<p/>Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)<!-- -->.<p/>Throws if the endpoints are unordered and the graph is directed. |
| [`removeEdge(nodeU, nodeV)`](./graph-builder.mutablegraph.removeedge.md) | `boolean` | Removes the edge connecting `nodeU` to `nodeV`<!-- -->, if it is present. |
| [`removeEdgeConnectingEndpoints(endpoints)`](./graph-builder.mutablegraph.removeedgeconnectingendpoints.md) | `boolean` | Removes the edge connecting `endpoints`<!-- -->, if it is present.<p/><p>If this graph is directed, `endpoints` must be ordered.<p/>throws IllegalArgumentException if the endpoints are unordered and the graph is directed |
| [`removeEdgeConnectingEndpoints(endpoints)`](./graph-builder.mutablegraph.removeedgeconnectingendpoints.md) | `boolean` | Removes the edge connecting `endpoints`<!-- -->, if it is present.<p/>If this graph is directed, `endpoints` must be ordered.<p/>Throws if the endpoints are unordered and the graph is directed. |
| [`removeNode(node)`](./graph-builder.mutablegraph.removenode.md) | `boolean` | Removes `node` if it is present; all edges incident to `node` will also be removed. |

@@ -7,6 +7,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableGraph](./graph-builder.mutablegraph.md) &gt; [putEdge](./graph-builder.mutablegraph.putedge.md)

<p>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
<p>If `nodeU` and `nodeV` are not already present in this graph, this method will silently addNode `nodeU` and `nodeV` to the graph.
If `nodeU` and `nodeV` are not already present in this graph, this method will silently [MutableGraph.addNode](./graph-builder.mutablegraph.addnode.md) `nodeU` and `nodeV` to the graph.
Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)<!-- -->.
**Signature:**

@@ -18,3 +20,3 @@ ```javascript

`true` if the graph was modified as a result of this call throws IllegalArgumentException if the introduction of the edge would violate allowsSelfLoops
`true` if the graph was modified as a result of this call

@@ -21,0 +23,0 @@ ## Parameters

@@ -7,8 +7,12 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableGraph](./graph-builder.mutablegraph.md) &gt; [putEdgeConnectingEndpoints](./graph-builder.mutablegraph.putedgeconnectingendpoints.md)

<p>If this graph is directed, `endpoints` must be ordered and the added edge will be directed; if it is undirected, the added edge will be undirected.
If this graph is directed, `endpoints` must be ordered and the added edge will be directed; if it is undirected, the added edge will be undirected.
<p>If this graph is directed, `endpoints` must be ordered.
If this graph is directed, `endpoints` must be ordered.
<p>If either or both endpoints are not already present in this graph, this method will silently addNode each missing endpoint to the graph.
If either or both endpoints are not already present in this graph, this method will silently [MutableGraph.addNode](./graph-builder.mutablegraph.addnode.md) each missing endpoint to the graph.
Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)<!-- -->.
Throws if the endpoints are unordered and the graph is directed.
**Signature:**

@@ -20,3 +24,3 @@ ```javascript

`true` if the graph was modified as a result of this call throws IllegalArgumentException if the introduction of the edge would violate allowsSelfLoops throws IllegalArgumentException if the endpoints are unordered and the graph is directed
`true` if the graph was modified as a result of this call

@@ -23,0 +27,0 @@ ## Parameters

@@ -7,5 +7,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableGraph](./graph-builder.mutablegraph.md) &gt; [removeEdgeConnectingEndpoints](./graph-builder.mutablegraph.removeedgeconnectingendpoints.md)

<p>If this graph is directed, `endpoints` must be ordered.
If this graph is directed, `endpoints` must be ordered.
throws IllegalArgumentException if the endpoints are unordered and the graph is directed
Throws if the endpoints are unordered and the graph is directed.

@@ -12,0 +12,0 @@ **Signature:**

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableValueGraph](./graph-builder.mutablevaluegraph.md) &gt; [addNode](./graph-builder.mutablevaluegraph.addnode.md)

<p><b>Nodes must be unique</b>, just as `Map` keys must be. They must also be non-null.
<b>Nodes must be unique</b>, just as `Map` keys must be.

@@ -10,0 +10,0 @@ **Signature:**

@@ -11,8 +11,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableValueGraph](./graph-builder.mutablevaluegraph.md)

| --- | --- | --- |
| [`addNode(node)`](./graph-builder.mutablevaluegraph.addnode.md) | `boolean` | Adds `node` if it is not already present.<p/><p><b>Nodes must be unique</b>, just as `Map` keys must be. They must also be non-null. |
| [`putEdgeValue(nodeU, nodeV, value)`](./graph-builder.mutablevaluegraph.putedgevalue.md) | `V | undefined` | Adds an edge connecting `nodeU` to `nodeV` if one is not already present, and sets a value for that edge to `value` (overwriting the existing value, if any).<p/><p>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.<p/><p>Values do not have to be unique. However, values must be non-null.<p/><p>If `nodeU` and `nodeV` are not already present in this graph, this method will silently addNode `nodeU` and `nodeV` to the graph. |
| [`putEdgeValueConnectingEndpoints(endpoints, value)`](./graph-builder.mutablevaluegraph.putedgevalueconnectingendpoints.md) | `V | undefined` | Adds an edge connecting `endpoints` if one is not already present, and sets a value for that edge to `value` (overwriting the existing value, if any).<p/><p>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.<p/><p>If this graph is directed, `endpoints` must be ordered.<p/><p>Values do not have to be unique. However, values must be non-null.<p/><p>If either or both endpoints are not already present in this graph, this method will silently addNode each missing endpoint to the graph. |
| [`addNode(node)`](./graph-builder.mutablevaluegraph.addnode.md) | `boolean` | Adds `node` if it is not already present.<p/><b>Nodes must be unique</b>, just as `Map` keys must be. |
| [`putEdgeValue(nodeU, nodeV, value)`](./graph-builder.mutablevaluegraph.putedgevalue.md) | `V | undefined` | Adds an edge connecting `nodeU` to `nodeV` if one is not already present, and sets a value for that edge to `value` (overwriting the existing value, if any).<p/>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.<p/>Values do not have to be unique.<p/>If `nodeU` and `nodeV` are not already present in this graph, this method will silently [MutableValueGraph.addNode](./graph-builder.mutablevaluegraph.addnode.md) `nodeU` and `nodeV` to the graph.<p/>Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md) |
| [`putEdgeValueConnectingEndpoints(endpoints, value)`](./graph-builder.mutablevaluegraph.putedgevalueconnectingendpoints.md) | `V | undefined` | Adds an edge connecting `endpoints` if one is not already present, and sets a value for that edge to `value` (overwriting the existing value, if any).<p/>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.<p/>If this graph is directed, `endpoints` must be ordered.<p/>Values do not have to be unique.<p/>If either or both endpoints are not already present in this graph, this method will silently [MutableValueGraph.addNode](./graph-builder.mutablevaluegraph.addnode.md) each missing endpoint to the graph.<p/>Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)<p/>Throws if the endpoints are unordered and the graph is directed |
| [`removeEdge(nodeU, nodeV)`](./graph-builder.mutablevaluegraph.removeedge.md) | `V | undefined` | Removes the edge connecting `nodeU` to `nodeV`<!-- -->, if it is present. |
| [`removeEdgeConnectingEndpoints(endpoints)`](./graph-builder.mutablevaluegraph.removeedgeconnectingendpoints.md) | `V | undefined` | Removes the edge connecting `endpoints`<!-- -->, if it is present.<p/><p>If this graph is directed, `endpoints` must be ordered. |
| [`removeEdgeConnectingEndpoints(endpoints)`](./graph-builder.mutablevaluegraph.removeedgeconnectingendpoints.md) | `V | undefined` | Removes the edge connecting `endpoints`<!-- -->, if it is present.<p/>If this graph is directed, `endpoints` must be ordered. |
| [`removeNode(node)`](./graph-builder.mutablevaluegraph.removenode.md) | `boolean` | Removes `node` if it is present; all edges incident to `node` will also be removed. |

@@ -7,8 +7,10 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableValueGraph](./graph-builder.mutablevaluegraph.md) &gt; [putEdgeValue](./graph-builder.mutablevaluegraph.putedgevalue.md)

<p>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
<p>Values do not have to be unique. However, values must be non-null.
Values do not have to be unique.
<p>If `nodeU` and `nodeV` are not already present in this graph, this method will silently addNode `nodeU` and `nodeV` to the graph.
If `nodeU` and `nodeV` are not already present in this graph, this method will silently [MutableValueGraph.addNode](./graph-builder.mutablevaluegraph.addnode.md) `nodeU` and `nodeV` to the graph.
Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)
**Signature:**

@@ -20,3 +22,3 @@ ```javascript

the value previously associated with the edge connecting `nodeU` to `nodeV`<!-- -->, or null if there was no such edge. throws IllegalArgumentException if the introduction of the edge would violate allowsSelfLoops
the value previously associated with the edge connecting `nodeU` to `nodeV`<!-- -->, or undefined if there was no such edge.

@@ -23,0 +25,0 @@ ## Parameters

@@ -7,10 +7,14 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableValueGraph](./graph-builder.mutablevaluegraph.md) &gt; [putEdgeValueConnectingEndpoints](./graph-builder.mutablevaluegraph.putedgevalueconnectingendpoints.md)

<p>If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
<p>If this graph is directed, `endpoints` must be ordered.
If this graph is directed, `endpoints` must be ordered.
<p>Values do not have to be unique. However, values must be non-null.
Values do not have to be unique.
<p>If either or both endpoints are not already present in this graph, this method will silently addNode each missing endpoint to the graph.
If either or both endpoints are not already present in this graph, this method will silently [MutableValueGraph.addNode](./graph-builder.mutablevaluegraph.addnode.md) each missing endpoint to the graph.
Throws if the introduction of the edge would violate [BaseGraph.allowsSelfLoops](./graph-builder.basegraph.allowsselfloops.md)
Throws if the endpoints are unordered and the graph is directed
**Signature:**

@@ -22,3 +26,3 @@ ```javascript

the value previously associated with the edge connecting `nodeU` to `nodeV`<!-- -->, or null if there was no such edge. throws IllegalArgumentException if the introduction of the edge would violate allowsSelfLoops throws IllegalArgumentException if the endpoints are unordered and the graph is directed
the value previously associated with the edge connecting `nodeU` to `nodeV`<!-- -->, or undefined if there was no such edge.

@@ -25,0 +29,0 @@ ## Parameters

@@ -13,3 +13,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableValueGraph](./graph-builder.mutablevaluegraph.md) &gt; [removeEdge](./graph-builder.mutablevaluegraph.removeedge.md)

the value previously associated with the edge connecting `nodeU` to `nodeV`<!-- -->, or null if there was no such edge.
the value previously associated with the edge connecting `nodeU` to `nodeV`<!-- -->, or undefined if there was no such edge.

@@ -16,0 +16,0 @@ ## Parameters

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [MutableValueGraph](./graph-builder.mutablevaluegraph.md) &gt; [removeEdgeConnectingEndpoints](./graph-builder.mutablevaluegraph.removeedgeconnectingendpoints.md)

<p>If this graph is directed, `endpoints` must be ordered.
If this graph is directed, `endpoints` must be ordered.

@@ -16,3 +16,3 @@ **Signature:**

the value previously associated with the edge connecting `endpoints`<!-- -->, or null if there was no such edge.
the value previously associated with the edge connecting `endpoints`<!-- -->, or undefined if there was no such edge.

@@ -19,0 +19,0 @@ ## Parameters

@@ -11,13 +11,13 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [PredecessorsFunction](./graph-builder.predecessorsfunction.md)

| --- | --- | --- |
| [`predecessors(node)`](./graph-builder.predecessorsfunction.predecessors.md) | `Iterable<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s incoming edges <i>against</i> the direction (if any) of the edge.<p/><p>Some algorithms that operate on a `PredecessorsFunction` may produce undesired results if the returned Iterable contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.<p/><p>The elements of the returned `Iterable` must each be:<p/><ul> <li>Non-null <li>Usable as `Map` keys (see the Guava User Guide's section on <a href="https://github.com/google/guava/wiki/GraphsExplained#graph-elements-nodes-and-edges"> graph elements</a> for details) </ul><p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`predecessors(node)`](./graph-builder.predecessorsfunction.predecessors.md) | `Iterable<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s incoming edges <i>against</i> the direction (if any) of the edge.<p/>Some algorithms that operate on a `PredecessorsFunction` may produce undesired results if the returned `Iterable` contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.<p/>The elements of the returned `Iterable` must each be unique to the graph.<p/>Throws if `node` is not an element of this graph. |
## Remarks
<p>This interface is meant to be used as the type of a parameter to graph algorithms (such as topological sort) that only need a way of accessing the predecessors of a node in a graph.
This interface is meant to be used as the type of a parameter to graph algorithms (such as topological sort) that only need a way of accessing the predecessors of a node in a graph.
\*\*Usage\*\*
<b>Usage</b>
Given an algorithm, for example:
```javascript
public <N> someGraphAlgorithm(N startNode, PredecessorsFunction<N> predecessorsFunction);
public someGraphAlgorithm<N>(startNode: N, predecessorsFunction: PredecessorsFunction<N>);

@@ -27,3 +27,3 @@ ```

<p>If you have an instance of one of the primary `common.graph` types ([Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->):
If you have an instance of one of the primary `common.graph` types ([Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->):
```javascript

@@ -35,16 +35,12 @@ someGraphAlgorithm(startNode, graph);

<p>If you have your own graph implementation based around a custom node type `MyNode`<!-- -->, which has a method `getParents()` that retrieves its predecessors in a graph:
If you have your own graph implementation based around a custom node type `MyNode`<!-- -->, which has a method `getParents()` that retrieves its predecessors in a graph:
```javascript
someGraphAlgorithm(startNode, MyNode::getParents);
someGraphAlgorithm(startNode, MyNode.getParents);
```
<p>If you have some other mechanism for returning the predecessors of a node, or one that doesn't return a `Iterable<? extends N>`<!-- -->, then you can use a lambda to perform a more general transformation:
If you have some other mechanism for returning the predecessors of a node, or one that doesn't return a `Iterable<N>`<!-- -->, then you can use a lambda to perform a more general transformation:
```javascript
someGraphAlgorithm(startNode, node -> ImmutableList.of(node.mother(), node.father()));
someGraphAlgorithm(startNode, node => [node.mother(), node.father()]);
```
<p>Graph algorithms that need additional capabilities (accessing both predecessors and successors, iterating over the edges, etc.) should declare their input to be of a type that provides those capabilities, such as [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, or Network<!-- -->.
\*\*Additional documentation\*\*
<p>See the Guava User Guide for the `common.graph` package (<a href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for additional documentation, including <a href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">notes for implementors</a>
Graph algorithms that need additional capabilities (accessing both predecessors and successors, iterating over the edges, etc.) should declare their input to be of a type that provides those capabilities, such as [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, or Network<!-- -->.

@@ -7,10 +7,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [PredecessorsFunction](./graph-builder.predecessorsfunction.md) &gt; [predecessors](./graph-builder.predecessorsfunction.predecessors.md)

<p>Some algorithms that operate on a `PredecessorsFunction` may produce undesired results if the returned Iterable contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.
Some algorithms that operate on a `PredecessorsFunction` may produce undesired results if the returned `Iterable` contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.
<p>The elements of the returned `Iterable` must each be:
The elements of the returned `Iterable` must each be unique to the graph.
<ul> <li>Non-null <li>Usable as `Map` keys (see the Guava User Guide's section on <a href="https://github.com/google/guava/wiki/GraphsExplained#graph-elements-nodes-and-edges"> graph elements</a> for details) </ul>
Throws if `node` is not an element of this graph.
throws IllegalArgumentException if `node` is not an element of this graph
**Signature:**

@@ -17,0 +15,0 @@ ```javascript

@@ -11,13 +11,13 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [SuccessorsFunction](./graph-builder.successorsfunction.md)

| --- | --- | --- |
| [`successors(node)`](./graph-builder.successorsfunction.successors.md) | `Iterable<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s outgoing edges in the direction (if any) of the edge.<p/><p>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.<p/><p>Some algorithms that operate on a `SuccessorsFunction` may produce undesired results if the returned Iterable contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.<p/><p>The elements of the returned `Iterable` must each be:<p/><ul> <li>Non-null <li>Usable as `Map` keys (see the Guava User Guide's section on <a href="https://github.com/google/guava/wiki/GraphsExplained#graph-elements-nodes-and-edges"> graph elements</a> for details) </ul><p/>throws IllegalArgumentException if `node` is not an element of this graph |
| [`successors(node)`](./graph-builder.successorsfunction.successors.md) | `Iterable<N>` | Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s outgoing edges in the direction (if any) of the edge.<p/>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.<p/>Some algorithms that operate on a `SuccessorsFunction` may produce undesired results if the returned `Iterable` contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.<p/>The elements of the returned `Iterable` must each be unique to the graph.<p/>Throws if `node` is not an element of this graph. |
## Remarks
<p>This interface is meant to be used as the type of a parameter to graph algorithms (such as breadth first traversal) that only need a way of accessing the successors of a node in a graph.
This interface is meant to be used as the type of a parameter to graph algorithms (such as breadth first traversal) that only need a way of accessing the successors of a node in a graph.
\*\*Usage\*\*
<b>Usage</b>
Given an algorithm, for example:
```javascript
public <N> someGraphAlgorithm(N startNode, SuccessorsFunction<N> successorsFunction);
public someGraphAlgorithm<N>(startNode: N, successorsFunction: SuccessorsFunction<N>);

@@ -27,3 +27,3 @@ ```

<p>If you have an instance of one of the primary `common.graph` types ([Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->):
If you have an instance of one of the primary `graph` types ([Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->):
```javascript

@@ -35,16 +35,12 @@ someGraphAlgorithm(startNode, graph);

<p>If you have your own graph implementation based around a custom node type `MyNode`<!-- -->, which has a method `getChildren()` that retrieves its successors in a graph:
If you have your own graph implementation based around a custom node type `MyNode`<!-- -->, which has a method `getChildren()` that retrieves its successors in a graph:
```javascript
someGraphAlgorithm(startNode, MyNode::getChildren);
someGraphAlgorithm(startNode, MyNode.getChildren);
```
<p>If you have some other mechanism for returning the successors of a node, or one that doesn't return an `Iterable<? extends N>`<!-- -->, then you can use a lambda to perform a more general transformation:
If you have some other mechanism for returning the successors of a node, or one that doesn't return an `Iterable<N>`<!-- -->, then you can use a lambda to perform a more general transformation:
```javascript
someGraphAlgorithm(startNode, node -> ImmutableList.of(node.leftChild(), node.rightChild()));
someGraphAlgorithm(startNode, node => [node.leftChild(), node.rightChild()]);
```
<p>Graph algorithms that need additional capabilities (accessing both predecessors and successors, iterating over the edges, etc.) should declare their input to be of a type that provides those capabilities, such as [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, or Network<!-- -->.
\*\*Additional documentation\*\*
<p>See the Guava User Guide for the `common.graph` package (<a href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for additional documentation, including <a href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">notes for implementors</a>
Graph algorithms that need additional capabilities (accessing both predecessors and successors, iterating over the edges, etc.) should declare their input to be of a type that provides those capabilities, such as [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, or Network<!-- -->.

@@ -7,12 +7,10 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [SuccessorsFunction](./graph-builder.successorsfunction.md) &gt; [successors](./graph-builder.successorsfunction.successors.md)

<p>This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.
This is <i>not</i> the same as "all nodes reachable from `node` by following outgoing edges". For that functionality, see Graphs.reachableNodes<!-- -->.
<p>Some algorithms that operate on a `SuccessorsFunction` may produce undesired results if the returned Iterable contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.
Some algorithms that operate on a `SuccessorsFunction` may produce undesired results if the returned `Iterable` contains duplicate elements. Implementations of such algorithms should document their behavior in the presence of duplicates.
<p>The elements of the returned `Iterable` must each be:
The elements of the returned `Iterable` must each be unique to the graph.
<ul> <li>Non-null <li>Usable as `Map` keys (see the Guava User Guide's section on <a href="https://github.com/google/guava/wiki/GraphsExplained#graph-elements-nodes-and-edges"> graph elements</a> for details) </ul>
Throws if `node` is not an element of this graph.
throws IllegalArgumentException if `node` is not an element of this graph
**Signature:**

@@ -19,0 +17,0 @@ ```javascript

@@ -5,5 +5,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraph](./graph-builder.valuegraph.md) &gt; [edgeValue](./graph-builder.valuegraph.edgevalue.md)

Returns the value of the edge that connects `nodeU` to `nodeV` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns `Optional.empty()`<!-- -->.
Returns the value of the edge that connects `nodeU` to `nodeV` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns undefined.
throws IllegalArgumentException if `nodeU` or `nodeV` is not an element of this graph
Throws if `nodeU` or `nodeV` is not an element of this graph.

@@ -10,0 +10,0 @@ **Signature:**

@@ -5,8 +5,10 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraph](./graph-builder.valuegraph.md) &gt; [edgeValueConnectingEndpoints](./graph-builder.valuegraph.edgevalueconnectingendpoints.md)

Returns the value of the edge that connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns `Optional.empty()`<!-- -->.
Returns the value of the edge that connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns undefined.
<p>If this graph is directed, the endpoints must be ordered.
If this graph is directed, the endpoints must be ordered.
throws IllegalArgumentException if either endpoint is not an element of this graph throws IllegalArgumentException if the endpoints are unordered and the graph is directed
Throws if either endpoint is not an element of this graph.
Throws if the endpoints are unordered and the graph is directed.
**Signature:**

@@ -13,0 +15,0 @@ ```javascript

@@ -7,6 +7,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraph](./graph-builder.valuegraph.md) &gt; [edgeValueConnectingEndpointsOrDefault](./graph-builder.valuegraph.edgevalueconnectingendpointsordefault.md)

<p>If this graph is directed, the endpoints must be ordered.
If this graph is directed, the endpoints must be ordered.
throws IllegalArgumentException if either endpoint is not an element of this graph throws IllegalArgumentException if the endpoints are unordered and the graph is directed
Throws if either endpoint is not an element of this graph.
Throws if the endpoints are unordered and the graph is directed.
**Signature:**

@@ -13,0 +15,0 @@ ```javascript

@@ -7,5 +7,5 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraph](./graph-builder.valuegraph.md) &gt; [edgeValueOrDefault](./graph-builder.valuegraph.edgevalueordefault.md)

<p>In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`<!-- -->.
In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`<!-- -->.
throws IllegalArgumentException if `nodeU` or `nodeV` is not an element of this graph
Throws if `nodeU` or `nodeV` is not an element of this graph.

@@ -12,0 +12,0 @@ **Signature:**

@@ -7,13 +7,11 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraph](./graph-builder.valuegraph.md) &gt; [equals](./graph-builder.valuegraph.equals.md)

<p>Thus, two value graphs A and B are equal if <b>all</b> of the following are true:
Thus, two value graphs A and B are equal if <b>all</b> of the following are true:
<ul> <li>A and B have equal isDirected<!-- -->. <li>A and B have equal nodes<!-- -->. <li>A and B have equal edges<!-- -->. <li>The edgeValue of a given edge is the same in both A and B. </ul>
<ul> <li>A and B have equal [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. <li>A and B have equal [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. <li>A and B have equal [BaseGraph.edges](./graph-builder.basegraph.edges.md)<!-- -->. <li>The [ValueGraph.edgeValue](./graph-builder.valuegraph.edgevalue.md) of a given edge is the same in both A and B. </ul>
<p>Graph properties besides isDirected do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.
Graph properties besides [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md) do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.
<p>A reference implementation of this is provided by AbstractValueGraph.equals<!-- -->.
**Signature:**
```javascript
equals(obj: ValueGraph<N, V>): boolean;
equals(object: ValueGraph<N, V>): boolean;
```

@@ -26,3 +24,3 @@ **Returns:** `boolean`

| --- | --- | --- |
| `obj` | `ValueGraph<N, V>` | |
| `object` | `ValueGraph<N, V>` | |

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraph](./graph-builder.valuegraph.md)

An interface for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges have associated non-unique values.
A subinterface of [BaseGraph](./graph-builder.basegraph.md) for <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">graph</a>-structured data, whose edges have associated non-unique values

@@ -13,44 +13,36 @@ ## Methods

| [`asGraph()`](./graph-builder.valuegraph.asgraph.md) | `Graph<N>` | Returns a live view of this graph as a [Graph](./graph-builder.graph.md)<!-- -->. The resulting [Graph](./graph-builder.graph.md) will have an edge connecting node A to node B if this [ValueGraph](./graph-builder.valuegraph.md) has an edge connecting A to B. |
| [`edgeValue(nodeU, nodeV)`](./graph-builder.valuegraph.edgevalue.md) | `V | undefined` | Returns the value of the edge that connects `nodeU` to `nodeV` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns `Optional.empty()`<!-- -->.<p/>throws IllegalArgumentException if `nodeU` or `nodeV` is not an element of this graph |
| [`edgeValueConnectingEndpoints(endpoints)`](./graph-builder.valuegraph.edgevalueconnectingendpoints.md) | `V | undefined` | Returns the value of the edge that connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns `Optional.empty()`<!-- -->.<p/><p>If this graph is directed, the endpoints must be ordered.<p/>throws IllegalArgumentException if either endpoint is not an element of this graph throws IllegalArgumentException if the endpoints are unordered and the graph is directed |
| [`edgeValueConnectingEndpointsOrDefault(endpoints, defaultValue)`](./graph-builder.valuegraph.edgevalueconnectingendpointsordefault.md) | `V | R` | Returns the value of the edge that connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns `defaultValue`<!-- -->.<p/><p>If this graph is directed, the endpoints must be ordered.<p/>throws IllegalArgumentException if either endpoint is not an element of this graph throws IllegalArgumentException if the endpoints are unordered and the graph is directed |
| [`edgeValueOrDefault(nodeU, nodeV, defaultValue)`](./graph-builder.valuegraph.edgevalueordefault.md) | `V | R` | Returns the value of the edge that connects `nodeU` to `nodeV`<!-- -->, if one is present; otherwise, returns `defaultValue`<!-- -->.<p/><p>In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`<!-- -->.<p/>throws IllegalArgumentException if `nodeU` or `nodeV` is not an element of this graph |
| [`equals(obj)`](./graph-builder.valuegraph.equals.md) | `boolean` | Returns `true` iff `object` is a [ValueGraph](./graph-builder.valuegraph.md) that has the same elements and the same structural relationships as those in this graph.<p/><p>Thus, two value graphs A and B are equal if <b>all</b> of the following are true:<p/><ul> <li>A and B have equal isDirected<!-- -->. <li>A and B have equal nodes<!-- -->. <li>A and B have equal edges<!-- -->. <li>The edgeValue of a given edge is the same in both A and B. </ul><p/><p>Graph properties besides isDirected do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.<p/><p>A reference implementation of this is provided by AbstractValueGraph.equals<!-- -->. |
| [`edgeValue(nodeU, nodeV)`](./graph-builder.valuegraph.edgevalue.md) | `V | undefined` | Returns the value of the edge that connects `nodeU` to `nodeV` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns undefined.<p/>Throws if `nodeU` or `nodeV` is not an element of this graph. |
| [`edgeValueConnectingEndpoints(endpoints)`](./graph-builder.valuegraph.edgevalueconnectingendpoints.md) | `V | undefined` | Returns the value of the edge that connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns undefined.<p/>If this graph is directed, the endpoints must be ordered.<p/>Throws if either endpoint is not an element of this graph.<p/>Throws if the endpoints are unordered and the graph is directed. |
| [`edgeValueConnectingEndpointsOrDefault(endpoints, defaultValue)`](./graph-builder.valuegraph.edgevalueconnectingendpointsordefault.md) | `V | R` | Returns the value of the edge that connects `endpoints` (in the order, if any, specified by `endpoints`<!-- -->), if one is present; otherwise, returns `defaultValue`<!-- -->.<p/>If this graph is directed, the endpoints must be ordered.<p/>Throws if either endpoint is not an element of this graph.<p/>Throws if the endpoints are unordered and the graph is directed. |
| [`edgeValueOrDefault(nodeU, nodeV, defaultValue)`](./graph-builder.valuegraph.edgevalueordefault.md) | `V | R` | Returns the value of the edge that connects `nodeU` to `nodeV`<!-- -->, if one is present; otherwise, returns `defaultValue`<!-- -->.<p/>In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`<!-- -->.<p/>Throws if `nodeU` or `nodeV` is not an element of this graph. |
| [`equals(object)`](./graph-builder.valuegraph.equals.md) | `boolean` | Returns `true` iff `object` is a [ValueGraph](./graph-builder.valuegraph.md) that has the same elements and the same structural relationships as those in this graph.<p/>Thus, two value graphs A and B are equal if <b>all</b> of the following are true:<p/><ul> <li>A and B have equal [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. <li>A and B have equal [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. <li>A and B have equal [BaseGraph.edges](./graph-builder.basegraph.edges.md)<!-- -->. <li>The [ValueGraph.edgeValue](./graph-builder.valuegraph.edgevalue.md) of a given edge is the same in both A and B. </ul><p/>Graph properties besides [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md) do <b>not</b> affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant. |
## Remarks
<p>A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
A graph is composed of a set of nodes and a set of edges connecting pairs of nodes.
<p>There are three primary interfaces provided to represent graphs. In order of increasing complexity they are: [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->. You should generally prefer the simplest interface that satisfies your use case. See the <a href="https://github.com/google/guava/wiki/GraphsExplained#choosing-the-right-graph-type"> "Choosing the right graph type"</a> section of the Guava User Guide for more details.
There are three primary interfaces provided to represent graphs. In order of increasing complexity they are: [Graph](./graph-builder.graph.md)<!-- -->, [ValueGraph](./graph-builder.valuegraph.md)<!-- -->, and Network<!-- -->. You should generally prefer the simplest interface that satisfies your use case. See the <a href="https://github.com/google/guava/wiki/GraphsExplained#choosing-the-right-graph-type"> "Choosing the right graph type"</a> section of the Guava User Guide for more details.
\*\*Capabilities\*\*
<b>Capabilities</b>
<p>`ValueGraph` supports the following use cases (<a href="https://github.com/google/guava/wiki/GraphsExplained#definitions">definitions of terms</a>):
`ValueGraph` supports the following use cases (<a href="https://github.com/google/guava/wiki/GraphsExplained#definitions">definitions of terms</a>):
<ul> <li>directed graphs <li>undirected graphs <li>graphs that do/don't allow self-loops <li>graphs whose nodes/edges are insertion-ordered, sorted, or unordered <li>graphs whose edges have associated values </ul>
<p>`ValueGraph`<!-- -->, as a subtype of `Graph`<!-- -->, explicitly does not support parallel edges, and forbids implementations or extensions with parallel edges. If you need parallel edges, use Network<!-- -->. (You can use a positive `Integer` edge value as a loose representation of edge multiplicity, but the `*degree()` and mutation methods will not reflect your interpretation of the edge value as its multiplicity.)
`ValueGraph`<!-- -->, as a subtype of `Graph`<!-- -->, explicitly does not support parallel edges, and forbids implementations or extensions with parallel edges. If you need parallel edges, use Network<!-- -->. (You can use a positive `Integer` edge value as a loose representation of edge multiplicity, but the `*degree()` and mutation methods will not reflect your interpretation of the edge value as its multiplicity.)
\*\*Building a `ValueGraph`<!-- -->\*\*
<b>Building a `ValueGraph`</b>
<p>The implementation classes that `common.graph` provides are not public, by design. To create an instance of one of the built-in implementations of `ValueGraph`<!-- -->, use the [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) class:
The implementation classes that are provided are not public, by design. To create an instance of one of the built-in implementations of `ValueGraph`<!-- -->, use the [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) class:
```javascript
MutableValueGraph<Integer, Double> graph = ValueGraphBuilder.directed().build();
const graph: MutableValueGraph<number, number> = ValueGraphBuilder.directed().build();
```
<p>[ValueGraphBuilder.build](./graph-builder.valuegraphbuilder.build.md) returns an instance of [MutableValueGraph](./graph-builder.mutablevaluegraph.md)<!-- -->, which is a subtype of `ValueGraph` that provides methods for adding and removing nodes and edges. If you do not need to mutate a graph (e.g. if you write a method than runs a read-only algorithm on the graph), you should use the non-mutating [ValueGraph](./graph-builder.valuegraph.md) interface, or an ImmutableValueGraph<!-- -->.
[ValueGraphBuilder.build](./graph-builder.valuegraphbuilder.build.md) returns an instance of [MutableValueGraph](./graph-builder.mutablevaluegraph.md)<!-- -->, which is a subtype of `ValueGraph` that provides methods for adding and removing nodes and edges. If you do not need to mutate a graph (e.g. if you write a method than runs a read-only algorithm on the graph), you should use the non-mutating [ValueGraph](./graph-builder.valuegraph.md) interface, or an ImmutableValueGraph<!-- -->.
<p>You can create an immutable copy of an existing `ValueGraph` using ImmutableValueGraph.copyOf<!-- -->:
You can create an immutable copy of an existing `ValueGraph` using ImmutableValueGraph.copyOf<!-- -->:
```javascript
ImmutableValueGraph<Integer, Double> immutableGraph = ImmutableValueGraph.copyOf(graph);
const immutableGraph: ImmutableValueGraph<number, number> = ImmutableValueGraph.copyOf(graph);
```
<p>Instances of ImmutableValueGraph do not implement [MutableValueGraph](./graph-builder.mutablevaluegraph.md) (obviously!) and are contractually guaranteed to be unmodifiable and thread-safe.
<p>The Guava User Guide has <a href="https://github.com/google/guava/wiki/GraphsExplained#building-graph-instances">more information on (and examples of) building graphs</a>.
\*\*Additional documentation\*\*
<p>See the Guava User Guide for the `common.graph` package (<a href="https://github.com/google/guava/wiki/GraphsExplained">"Graphs Explained"</a>) for additional documentation, including:
<ul> <li><a href="https://github.com/google/guava/wiki/GraphsExplained#equals-hashcode-and-graph-equivalence"> `equals()`<!-- -->, `hashCode()`<!-- -->, and graph equivalence</a> <li><a href="https://github.com/google/guava/wiki/GraphsExplained#synchronization"> Synchronization policy</a> <li><a href="https://github.com/google/guava/wiki/GraphsExplained#notes-for-implementors">Notes for implementors</a> </ul>
Instances of ImmutableValueGraph do not implement [MutableValueGraph](./graph-builder.mutablevaluegraph.md) (obviously!) and are contractually guaranteed to be unmodifiable.

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) &gt; [allowsSelfLoops](./graph-builder.valuegraphbuilder.allowsselfloops.md)

Specifies whether the graph will allow self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an UnsupportedOperationException<!-- -->.
Specifies whether the graph will allow self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an error.

@@ -8,0 +8,0 @@ **Signature:**

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) &gt; [expectedNodeCount](./graph-builder.valuegraphbuilder.expectednodecount.md)

throws an error if `expectedNodeCount` is negative
Throws an error if `expectedNodeCount` is negative.

@@ -10,0 +10,0 @@ **Signature:**

@@ -7,3 +7,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) &gt; [from](./graph-builder.valuegraphbuilder.from.md)

<p>The "queryable" properties are those that are exposed through the [ValueGraph](./graph-builder.valuegraph.md) interface, such as ValueGraph.isDirected<!-- -->. Other properties, such as expectedNodeCount<!-- -->, are not set in the new builder.
<p>The "queryable" properties are those that are exposed through the [ValueGraph](./graph-builder.valuegraph.md) interface, such as [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. Other properties, such as [ValueGraphBuilder.expectedNodeCount](./graph-builder.valuegraphbuilder.expectednodecount.md)<!-- -->, are not set in the new builder.

@@ -10,0 +10,0 @@ **Signature:**

@@ -11,8 +11,8 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md)

| --- | --- | --- | --- |
| [`allowsSelfLoops(allowsSelfLoops)`](./graph-builder.valuegraphbuilder.allowsselfloops.md) | | `ValueGraphBuilder<N, V>` | Specifies whether the graph will allow self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an UnsupportedOperationException<!-- -->. |
| [`allowsSelfLoops(allowsSelfLoops)`](./graph-builder.valuegraphbuilder.allowsselfloops.md) | | `ValueGraphBuilder<N, V>` | Specifies whether the graph will allow self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an error. |
| [`build()`](./graph-builder.valuegraphbuilder.build.md) | | `MutableValueGraph<N, V>` | Returns an empty [MutableValueGraph](./graph-builder.mutablevaluegraph.md) with the properties of this [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md)<!-- -->. |
| [`directed()`](./graph-builder.valuegraphbuilder.directed.md) | | `ValueGraphBuilder<N, V>` | Returns a [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) for building directed graphs. |
| [`expectedNodeCount(expectedNodeCount)`](./graph-builder.valuegraphbuilder.expectednodecount.md) | | `ValueGraphBuilder<N, V>` | Specifies the expected number of nodes in the graph.<p/>throws an error if `expectedNodeCount` is negative |
| [`from(graph)`](./graph-builder.valuegraphbuilder.from.md) | | `ValueGraphBuilder<N, V>` | Returns a [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) initialized with all properties queryable from `graph`<!-- -->.<p/><p>The "queryable" properties are those that are exposed through the [ValueGraph](./graph-builder.valuegraph.md) interface, such as ValueGraph.isDirected<!-- -->. Other properties, such as expectedNodeCount<!-- -->, are not set in the new builder. |
| [`nodeOrder(nodeOrder)`](./graph-builder.valuegraphbuilder.nodeorder.md) | | `ValueGraphBuilder<N, V>` | Specifies the order of iteration for the elements of Graph.nodes<!-- -->. |
| [`expectedNodeCount(expectedNodeCount)`](./graph-builder.valuegraphbuilder.expectednodecount.md) | | `ValueGraphBuilder<N, V>` | Specifies the expected number of nodes in the graph.<p/>Throws an error if `expectedNodeCount` is negative. |
| [`from(graph)`](./graph-builder.valuegraphbuilder.from.md) | | `ValueGraphBuilder<N, V>` | Returns a [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) initialized with all properties queryable from `graph`<!-- -->.<p/><p>The "queryable" properties are those that are exposed through the [ValueGraph](./graph-builder.valuegraph.md) interface, such as [BaseGraph.isDirected](./graph-builder.basegraph.isdirected.md)<!-- -->. Other properties, such as [ValueGraphBuilder.expectedNodeCount](./graph-builder.valuegraphbuilder.expectednodecount.md)<!-- -->, are not set in the new builder. |
| [`nodeOrder(nodeOrder)`](./graph-builder.valuegraphbuilder.nodeorder.md) | | `ValueGraphBuilder<N, V>` | Specifies the order of iteration for the elements of [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->. |
| [`undirected()`](./graph-builder.valuegraphbuilder.undirected.md) | | `ValueGraphBuilder<N, V>` | Returns a [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) for building undirected graphs. |

@@ -22,9 +22,9 @@

<p>A graph built by this class will have the following properties by default:
A graph built by this class will have the following properties by default:
<ul> <li>does not allow self-loops <li>orders Graph.nodes in the order in which the elements were added </ul>
- does not allow self-loops - orders [BaseGraph.nodes](./graph-builder.basegraph.nodes.md) in the order in which the elements were added
<p>Example of use:
Example of use:
```javascript
MutableValueGraph<String, number> graph =
const graph: MutableValueGraph<String, number> =
ValueGraphBuilder.undirected().allowsSelfLoops(true).build();

@@ -31,0 +31,0 @@ graph.putEdgeValue("San Francisco", "San Francisco", 0.0);

@@ -5,3 +5,3 @@ [Home](./index) &gt; [graph-builder](./graph-builder.md) &gt; [ValueGraphBuilder](./graph-builder.valuegraphbuilder.md) &gt; [nodeOrder](./graph-builder.valuegraphbuilder.nodeorder.md)

Specifies the order of iteration for the elements of Graph.nodes<!-- -->.
Specifies the order of iteration for the elements of [BaseGraph.nodes](./graph-builder.basegraph.nodes.md)<!-- -->.

@@ -8,0 +8,0 @@ **Signature:**

{
"name": "graph-builder",
"version": "0.1.1",
"version": "0.1.2",
"description": "A graph builder library for modeling abstract graph structures.",

@@ -19,2 +19,3 @@ "homepage": "https://github.com/sorohan/graph-builder",

"scripts": {
"build": "tsc",
"test": "tape -r ts-node/register **/*.spec.ts",

@@ -21,0 +22,0 @@ "cover": "nyc --reporter text --reporter html --report-dir coverage npm run test",

@@ -5,5 +5,13 @@ # Graph Builder

This is a typescript port of the [guava graph library](https://github.com/google/guava/wiki/GraphsExplained).
This is a (incomplete) typescript port of the [guava graph library](https://github.com/google/guava/wiki/GraphsExplained).
See the [API
documentation](https://github.com/sorohan/graph-builder/blob/master/markdown/graph-builder.graph.md) for usage.
documentation](https://github.com/sorohan/graph-builder/blob/master/markdown/graph-builder.md) for usage.
The main entry points are the
[`GraphBuilder`](https://github.com/sorohan/graph-builder/blob/master/markdown/graph-builder.graphbuilder.md)
for building a
[`MutableGraph`](https://github.com/sorohan/graph-builder/blob/master/markdown/graph-builder.mutablegraph.md) and
[`ValueGraphBuilder`](https://github.com/sorohan/graph-builder/blob/master/markdown/graph-builder.valuegraphbuilder.md)
for building a
[`MutableValueGraph`](https://github.com/sorohan/graph-builder/blob/master/markdown/graph-builder.mutablevaluegraph.md).
// @public
interface BaseGraph<N> extends SuccessorsFunction<N>, PredecessorsFunction<N> {
adjacentNodes(node: N): Set<N>;
// WARNING: Unable to find referenced export "graph-builder#IllegalArgumentException"
allowsSelfLoops(): boolean;

@@ -9,25 +8,22 @@ degree(node: N): number;

hasEdge(nodeU: N, nodeV: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#Collection"
hasEdgeConnectingEndpoints(endpoints: EndpointPair<N>): boolean;
incidentEdges(node: N): Set<EndpointPair<N>>;
// WARNING: Unable to find referenced export "graph-builder#degree"
inDegree(node: N): number;
isDirected(): boolean;
// WARNING: Unable to find referenced export "graph-builder#nodes"
nodeOrder(): ElementOrder<N>;
// WARNING: Unable to find referenced export "graph-builder#nodeOrder"
nodes(): Set<N>;
// WARNING: Unable to find referenced export "graph-builder#degree"
outDegree(node: N): number;
// WARNING: Unable to find referenced export "graph-builder#adjacentNodes"
predecessors(node: N): Set<N>;
// WARNING: Unable to find referenced export "graph-builder#Graphs"
// WARNING: Unable to find referenced export "graph-builder#adjacentNodes"
successors(node: N): Set<N>;
}
// @public (undocumented)
interface Comparator<T> {
compare(a: T, b: T): number;
}
// @public
class ElementOrder<T> {
// WARNING: The type "Type" needs to be exported by the package (e.g. added to index.ts)
// WARNING: The type "Comparator" needs to be exported by the package (e.g. added to index.ts)
constructor(type: Type, comparator?: Comparator<T> | undefined);

@@ -37,4 +33,2 @@ createMap<K extends T, V>(expectedSize: number): Map<K, V>;

equals(obj?: object): boolean;
// WARNING: Unable to find referenced export "graph-builder#Comparator"
// WARNING: The type "Comparator" needs to be exported by the package (e.g. added to index.ts)
getComparator(): Comparator<T>;

@@ -44,3 +38,2 @@ static insertion<S>(): ElementOrder<S>;

static natural<S extends Comparable<S>>(): ElementOrder<S>;
// WARNING: The type "Comparator" needs to be exported by the package (e.g. added to index.ts)
static sorted<S>(comparator: Comparator<S>): ElementOrder<S>;

@@ -53,10 +46,4 @@ // WARNING: The type "Type" needs to be exported by the package (e.g. added to index.ts)

// WARNING: Unable to find referenced export "graph-builder#nodeV"
// WARNING: Unable to find referenced export "graph-builder#nodeU"
// WARNING: Unable to find referenced export "graph-builder#target"
// WARNING: Unable to find referenced export "graph-builder#source"
// @public
class EndpointPair<N> implements Iterable<N> {
// WARNING: Unable to find referenced export "graph-builder#nodeV"
// WARNING: Unable to find referenced export "graph-builder#nodeU"
// WARNING: The name "__@iterator" contains unsupported characters; API names should use only letters, numbers, and underscores

@@ -66,4 +53,2 @@ [Symbol.iterator](): IterableIterator<N>;

adjacentNode(node: N): N;
// WARNING: Unable to find referenced export "graph-builder#target"
// WARNING: Unable to find referenced export "graph-builder#source"
abstract equals(obj?: Object): boolean;

@@ -77,5 +62,3 @@ abstract isOrdered(): boolean;

static ordered<N>(source: N, target: N): EndpointPair<N>;
// WARNING: Unable to find referenced export "graph-builder#isOrdered"
abstract source(): N;
// WARNING: Unable to find referenced export "graph-builder#isOrdered"
abstract target(): N;

@@ -92,11 +75,5 @@ static unordered<N>(nodeU: N, nodeV: N): EndpointPair<N>;

interface Graph<N> extends BaseGraph<N> {
// WARNING: Unable to find referenced export "graph-builder#AbstractGraph"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
// WARNING: Unable to find referenced export "graph-builder#edges"
// WARNING: Unable to find referenced export "graph-builder#nodes"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
equals(object: object): boolean;
}
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
// @public

@@ -108,6 +85,3 @@ class GraphBuilder<N> extends AbstractGraphBuilder<N> {

expectedNodeCount(expectedNodeCount: number): GraphBuilder<N>;
// WARNING: Unable to find referenced export "graph-builder#expectedNodeCount"
// WARNING: Unable to find referenced member "graph-builder#Graph.isDirected"
static from<T>(graph: Graph<T>): GraphBuilder<T>;
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
nodeOrder(nodeOrder: ElementOrder<N>): GraphBuilder<N>;

@@ -135,7 +109,3 @@ static undirected<T>(): GraphBuilder<T>;

addNode(node: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdge(nodeU: N, nodeV: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdgeConnectingEndpoints(endpoints: EndpointPair<N>): boolean;

@@ -150,7 +120,3 @@ removeEdge(nodeU: N, nodeV: N): boolean;

addNode(node: N): boolean;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdgeValue(nodeU: N, nodeV: N, value: V): V | undefined;
// WARNING: Unable to find referenced export "graph-builder#allowsSelfLoops"
// WARNING: Unable to find referenced export "graph-builder#addNode"
putEdgeValueConnectingEndpoints(endpoints: EndpointPair<N>, value: V): V | undefined;

@@ -166,3 +132,2 @@ removeEdge(nodeU: N, nodeV: N): V | undefined;

interface PredecessorsFunction<N> {
// WARNING: Unable to find referenced export "graph-builder#Iterable"
predecessors(node: N): Iterable<N>;

@@ -175,3 +140,2 @@ }

interface SuccessorsFunction<N> {
// WARNING: Unable to find referenced export "graph-builder#Iterable"
// WARNING: Unable to find referenced export "graph-builder#Graphs"

@@ -193,15 +157,7 @@ successors(node: N): Iterable<N>;

edgeValueOrDefault<R>(nodeU: N, nodeV: N, defaultValue: R): V | R;
// WARNING: Unable to find referenced export "graph-builder#AbstractValueGraph"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
// WARNING: Unable to find referenced export "graph-builder#edgeValue"
// WARNING: Unable to find referenced export "graph-builder#edges"
// WARNING: Unable to find referenced export "graph-builder#nodes"
// WARNING: Unable to find referenced export "graph-builder#isDirected"
equals(obj: ValueGraph<N, V>): boolean;
equals(object: ValueGraph<N, V>): boolean;
}
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
// @public
class ValueGraphBuilder<N, V> extends AbstractGraphBuilder<N> {
// WARNING: Unable to find referenced export "graph-builder#UnsupportedOperationException"
allowsSelfLoops(allowsSelfLoops: boolean): ValueGraphBuilder<N, V>;

@@ -211,6 +167,3 @@ build(): MutableValueGraph<N, V>;

expectedNodeCount(expectedNodeCount: number): ValueGraphBuilder<N, V>;
// WARNING: Unable to find referenced export "graph-builder#expectedNodeCount"
// WARNING: Unable to find referenced member "graph-builder#ValueGraph.isDirected"
static from<N, V>(graph: ValueGraph<N, V>): ValueGraphBuilder<N, V>;
// WARNING: Unable to find referenced member "graph-builder#Graph.nodes"
nodeOrder(nodeOrder: ElementOrder<N>): ValueGraphBuilder<N, V>;

@@ -217,0 +170,0 @@ static undirected<N, V>(): ValueGraphBuilder<N, V>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc