1/*2* Copyright (C) 2016 The Guava Authors3*4* Licensed under the Apache License, Version 2.0 (the "License");5* you may not use this file except in compliance with the License.6* You may obtain a copy of the License at7*8* http://www.apache.org/licenses/LICENSE-2.09*10* Unless required by applicable law or agreed to in writing, software11* distributed under the License is distributed on an "AS IS" BASIS,12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13* See the License for the specific language governing permissions and14* limitations under the License.15*/16 17packagecom.google.common.graph; 18 19/** A utility class to hold various constants used by the Guava Graph library. */20finalclassGraphConstants { 21 22privateGraphConstants() {} 23 24staticfinalintEXPECTED_DEGREE = 2; 25 26staticfinalintDEFAULT_NODE_COUNT = 10; 27staticfinalintDEFAULT_EDGE_COUNT = DEFAULT_NODE_COUNT * EXPECTED_DEGREE; 28 29// Load factor and capacity for "inner" (i.e. per node/edge element) hash sets or maps30staticfinalfloatINNER_LOAD_FACTOR = 1.0f; 31staticfinalintINNER_CAPACITY = 2;// ceiling(EXPECTED_DEGREE / INNER_LOAD_FACTOR)32 33// Error messages34staticfinalString NODE_NOT_IN_GRAPH = "Node %s is not an element of this graph."; 35staticfinalString EDGE_NOT_IN_GRAPH = "Edge %s is not an element of this graph."; 36staticfinalString REUSING_EDGE = 37 "Edge %s already exists between the following nodes: %s, " 38 + "so it cannot be reused to connect the following nodes: %s."; 39staticfinalString MULTIPLE_EDGES_CONNECTING = 40 "Cannot call edgeConnecting() when parallel edges exist between %s and %s. Consider calling " 41 + "edgesConnecting() instead."; 42staticfinalString PARALLEL_EDGES_NOT_ALLOWED = 43 "Nodes %s and %s are already connected by a different edge. To construct a graph " 44 + "that allows parallel edges, call allowsParallelEdges(true) on the Builder."; 45staticfinalString SELF_LOOPS_NOT_ALLOWED = 46 "Cannot add self-loop edge on node %s, as self-loops are not allowed. To construct a graph " 47 + "that allows self-loops, call allowsSelfLoops(true) on the Builder."; 48staticfinalString NOT_AVAILABLE_ON_UNDIRECTED = 49 "Cannot call source()/target() on a EndpointPair from an undirected graph. Consider calling " 50 + "adjacentNode(node) if you already have a node, or nodeU()/nodeV() if you don't."; 51staticfinalString EDGE_ALREADY_EXISTS = "Edge %s already exists in the graph."; 52 53/** Singleton edge value for {@link Graph} implementations backed by {@link ValueGraph}s. */54 enum Presence { 55 EDGE_EXISTS 56 } 57 }