code: def is_intersection(g, n):
      
      return len(set(g.predecessors(n) + g.successors(n))) > 2
docs: Determine if a node is an intersection
  
      graph: 1 -->-- 2 -->-- 3
  
      >>> is_intersection(g, 2)
      False
  
      graph:
       1 -- 2 -- 3
            |
            4
  
      >>> is_intersection(g, 2)
      True
  
      Parameters
      ----------
      g : networkx DiGraph
      n : node id
  
      Returns
      -------
      bool