code: public static Set<BioPAXElement> runNeighborhood(
  		Set<BioPAXElement> sourceSet,
  		Model model,
  		int limit,
  		Direction direction,
  		Filter... filters)
  	{
  		Graph graph;
  
  		if (model.getLevel() == BioPAXLevel.L3)
  		{
  			if (direction == Direction.UNDIRECTED)
  			{
  				graph = new GraphL3Undirected(model, filters);
  				direction = Direction.BOTHSTREAM;
  			}
  			else
  			{
  				graph = new GraphL3(model, filters);
  			}
  		}
  		else return Collections.emptySet();
  
  		Set<Node> source = prepareSingleNodeSet(sourceSet, graph);
  
  		if (sourceSet.isEmpty()) return Collections.emptySet();
  
  		NeighborhoodQuery query = new NeighborhoodQuery(source, direction, limit);
  		Set<GraphObject> resultWrappers = query.run();
  		return convertQueryResult(resultWrappers, graph, true);
  	}
docs: Gets neighborhood of the source set.
  
  @param sourceSet seed to the query
  @param model BioPAX model
  @param limit neigborhood distance to get
  @param direction UPSTREAM, DOWNSTREAM or BOTHSTREAM
  @param filters for filtering graph elements
  @return BioPAX elements in the result set