public Map<V, Integer> inDegree() {
        Map<V, Integer> result = new HashMap<>();
        for (V vertex : neighbors.keySet()) {
            result.put(vertex, 0); // all in-degrees are 0
        }
        for (V from : neighbors.keySet()) {
            for (V to : neighbors.get(from)) {
                result.put(to, result.get(to) + 1); // increment in-degree
            }
        }

        return result;
    }
@Test
    void inDegree() {
        Map<Character, Integer> result = graph.inDegree();
        Map<Character, Integer> expected = new HashMap<>(7);
        expected.put('A', 0);
        expected.put('B', 1);
        expected.put('C', 1);
        expected.put('D', 0);
        expected.put('E', 1);
        expected.put('F', 1);
        expected.put('G', 1);
        assertEquals(expected, result);
    }