code: def test_degree_p4(self):
      G = nx.path_graph(4)
      answer = {1: 2.0, 2: 1.5}
      nd = nx.average_degree_connectivity(G)
      assert nd == answer
  
      D = G.to_directed()
      answer = {2: 2.0, 4: 1.5}
      nd = nx.average_degree_connectivity(D)
      assert nd == answer
  
      answer = {1: 2.0, 2: 1.5}
      D = G.to_directed()
      nd = nx.average_degree_connectivity(D, source="in", target="in")
      assert nd == answer
  
      D = G.to_directed()
      nd = nx.average_degree_connectivity(D, source="in", target="in")
      assert nd == answer
  
file_path: networkx/networkx/algorithms/assortativity/tests/test_connectivity.py
imports: from itertools import permutations
  import pytest
  import networkx
label_desc: Use image node_id 1 for calling the TestNeighborConnectivity obj's underlying member method code with example usage: obj.test_degree_p4() without return types