/** * Convenience method to create a new, empty {@code DefaultKeyValuePair}. * * @param <KeyType> * The type of the key. * @param <ValueType> * The type of the value. * @return * A new, empty key-value pair. */ public static <KeyType, ValueType> DefaultKeyValuePair<KeyType, ValueType> create() { return new DefaultKeyValuePair<KeyType, ValueType>(); }
/** * Convenience method to create a new, empty {@code DefaultKeyValuePair}. * * @param <KeyType> * The type of the key. * @param <ValueType> * The type of the value. * @return * A new, empty key-value pair. */ public static <KeyType, ValueType> DefaultKeyValuePair<KeyType, ValueType> create() { return new DefaultKeyValuePair<KeyType, ValueType>(); }
/** * Convenience method to create a new, empty {@code DefaultKeyValuePair}. * * @param <KeyType> * The type of the key. * @param <ValueType> * The type of the value. * @return * A new, empty key-value pair. */ public static <KeyType, ValueType> DefaultKeyValuePair<KeyType, ValueType> create() { return new DefaultKeyValuePair<KeyType, ValueType>(); }
/** * * Convenience method to create a new {@code DefaultKeyValuePair} from the * given key and value. * * @param <KeyType> * The type of the key. * @param <ValueType> * The type of the value. * @param key * The key. * @param value * The value. * @return * A new, empty key-value pair. */ public static <KeyType, ValueType> DefaultKeyValuePair<KeyType, ValueType> create( final KeyType key, final ValueType value) { return new DefaultKeyValuePair<KeyType, ValueType>(key, value); }
/** * * Convenience method to create a new {@code DefaultKeyValuePair} from the * given key and value. * * @param <KeyType> * The type of the key. * @param <ValueType> * The type of the value. * @param key * The key. * @param value * The value. * @return * A new, empty key-value pair. */ public static <KeyType, ValueType> DefaultKeyValuePair<KeyType, ValueType> create( final KeyType key, final ValueType value) { return new DefaultKeyValuePair<KeyType, ValueType>(key, value); }
/** * * Convenience method to create a new {@code DefaultKeyValuePair} from the * given key and value. * * @param <KeyType> * The type of the key. * @param <ValueType> * The type of the value. * @param key * The key. * @param value * The value. * @return * A new, empty key-value pair. */ public static <KeyType, ValueType> DefaultKeyValuePair<KeyType, ValueType> create( final KeyType key, final ValueType value) { return new DefaultKeyValuePair<KeyType, ValueType>(key, value); }
/** * Helper that returns the endpoint values for the input edge id. * * Execution: O(1) (one time O(m log m) cost after addEdges is called to get * the edges in the right order) * * @param i The edge id to search for * @return the endpoint values for the input edge id */ @Override public Pair<Integer, Integer> getEdgeEndpointIds(int i) { optimizeEdges(); return new DefaultKeyValuePair<>(edges.get(2 * i + 0), edges.get(2 * i + 1)); }
for (int i = 0; i < n; ++i) degreeList.add(new DefaultKeyValuePair<>(i, degree(i))); Pair<Integer, Integer> otherOrder = new DefaultKeyValuePair<>( edge.getSecond(), edge.getFirst()); if (!edgeMap.containsKey(otherOrder)) allNodeTriangles.get(i).add(new DefaultKeyValuePair<>( neighborj, neighbork)); allNodeTriangles.get(neighborj).add( new DefaultKeyValuePair<>(i, neighbork)); allNodeTriangles.get(neighbork).add( new DefaultKeyValuePair<>(i, neighborj)); Pair<Integer, Integer> edge = new DefaultKeyValuePair<>( i, neighborj); for (int edgeId : edgeMap.get(edge)) edge = new DefaultKeyValuePair<>(i, neighbork); for (int edgeId : edgeMap.get(edge)) edge = new DefaultKeyValuePair<>(neighborj, neighbork); for (int edgeId : edgeMap.get(edge))
/** * Returns the other two endpoint names for all triangles the node * participates in. Note that this implementation does not permit triangles * with only two nodes (where the third edge is a self-loop), nor does it * count repeated triangles for nodes with repeated edges. O(m^(3/2)) for * the first call to any triangle method, O(1) for later calls. * * @param nodeId The node whose triangles are requested * @return The other two endpoint names for all triangles which use this * node */ public Set<Pair<NodeNameType, NodeNameType>> getNodeTriangleEndpoints( int nodeId) { Set<Pair<Integer, Integer>> endpointIds = getNodeTriangleEndpointIds( nodeId); Set<Pair<NodeNameType, NodeNameType>> ret = new HashSet<>( endpointIds.size()); for (Pair<Integer, Integer> endpointId : endpointIds) { ret.add(new DefaultKeyValuePair<>(graph.getNode( endpointId.getFirst()), graph.getNode(endpointId.getSecond()))); } return ret; }
queue.add(new DefaultKeyValuePair<>(current, allDistances[current])); queue.add(new DefaultKeyValuePair<>(neighbor, allDistances[neighbor])); queue.add(new DefaultKeyValuePair<>(neighbor, allDistances[neighbor]));
stack.push(new DefaultKeyValuePair<>(firstIdx, lastIdx)); while (!stack.isEmpty()) stack.push(new DefaultKeyValuePair<>(left, i - 1)); stack.push(new DefaultKeyValuePair<>(i + 1, right));
if (endPts.getFirst() == nodeId) ret.add(new DefaultKeyValuePair<>( getNode(endPts.getSecond()), weights.get(i)));
sorted.add(new DefaultKeyValuePair<>(i, x.get(i)));