### Question:
Graphs { public static <V, E> E addEdgeWithVertices(Graph<V, E> g, V sourceVertex, V targetVertex) { g.addVertex(sourceVertex); g.addVertex(targetVertex); return g.addEdge(sourceVertex, targetVertex); }  static E addEdge(Graph<V, E> g, V sourceVertex, V targetVertex, double weight); static E addEdgeWithVertices(Graph<V, E> g, V sourceVertex, V targetVertex); static boolean addEdgeWithVertices(Graph<V, E> targetGraph, Graph<V, E> sourceGraph, E edge); static E addEdgeWithVertices(Graph<V, E> g, V sourceVertex, V targetVertex, double weight); static boolean addGraph(Graph<? super V, ? super E> destination, Graph<V, E> source); static void addGraphReversed(Graph<? super V, ? super E> destination, Graph<V, E> source); static boolean addAllEdges(
        Graph<? super V, ? super E> destination, Graph<V, E> source, Collection<? extends E> edges); static boolean addAllVertices(
        Graph<? super V, ? super E> destination, Collection<? extends V> vertices); static List<V> neighborListOf(Graph<V, E> g, V vertex); static List<V> predecessorListOf(Graph<V, E> g, V vertex); static List<V> successorListOf(Graph<V, E> g, V vertex); static Graph<V, E> undirectedGraph(Graph<V, E> g); static boolean testIncidence(Graph<V, E> g, E e, V v); static V getOppositeVertex(Graph<V, E> g, E e, V v); static boolean removeVertexAndPreserveConnectivity(Graph<V, E> graph, V vertex); static boolean removeVerticesAndPreserveConnectivity(Graph<V, E> graph, Predicate<V> predicate); static boolean removeVertexAndPreserveConnectivity(Graph<V, E> graph, Iterable<V> vertices); static void addOutgoingEdges(Graph<V, E> graph, V source, Iterable<V> targets); static void addIncomingEdges(Graph<V, E> graph, V target, Iterable<V> sources); static boolean vertexHasSuccessors(Graph<V, E> graph, V vertex); static boolean vertexHasPredecessors(Graph<V, E> graph, V vertex);  }### Answer:
@Test public void testIsCubic() { assertTrue(GraphTests.isCubic(NamedGraphGenerator.petersenGraph())); Graph<Integer, DefaultEdge> triangle = new SimpleGraph<>(DefaultEdge.class); Graphs.addEdgeWithVertices(triangle, 1, 2); Graphs.addEdgeWithVertices(triangle, 2, 3); Graphs.addEdgeWithVertices(triangle, 3, 1); assertFalse(GraphTests.isCubic(triangle)); }