original_docstring: Plot a path with the heighbors of of the nodes along that path.
docstring: Plot a path with the heighbors of of the nodes along that path.
docstring_tokens: Plot a path with the heighbors of of the nodes along that path .
code: def plot_path_with_neighbors(G, n1, n2):
      """Plot a path with the heighbors of of the nodes along that path."""
      path = nx.shortest_path(G, n1, n2)
      nodes = [*path]
      for node in path:
          nodes.extend(list(G.neighbors(node)))
      nodes = list(set(nodes))
  
      g = G.subgraph(nodes)
      nv.arc(
          g, sort_by="order", node_color_by="order", edge_enc_kwargs={"alpha_scale": 0.5}
      )
      for n in path:
          highlights.arc_node(g, n, sort_by="order")
      for n1, n2 in zip(path[:-1], path[1:]):
          highlights.arc_edge(g, n1, n2, sort_by="order")
code_tokens: def plot_path_with_neighbors ( G , n1 , n2 ) : path = nx . shortest_path ( G , n1 , n2 ) nodes = [ * path ] for node in path : nodes . extend ( list ( G . neighbors ( node ) ) ) nodes = list ( set ( nodes ) ) g = G . subgraph ( nodes ) nv . arc ( g , sort_by = "order" , node_color_by = "order" , edge_enc_kwargs = { "alpha_scale" : 0.5 } ) for n in path : highlights . arc_node ( g , n , sort_by = "order" ) for n1 , n2 in zip ( path [ : - 1 ] , path [ 1 : ] ) : highlights . arc_edge ( g , n1 , n2 , sort_by = "order" )
short_docstring: Plot a path with the heighbors of of the nodes along that path.
short_docstring_tokens: Plot a path with the heighbors of of the nodes along that path .
comment: """Plot a path with the heighbors of of the nodes along that path."""