GFQL Hop

graphistry.compute.hop.hop(self, nodes=None, hops=1, to_fixed_point=False, direction='forward', edge_match=None, source_node_match=None, destination_node_match=None, source_node_query=None, destination_node_query=None, edge_query=None, return_as_wave_front=False, target_wave_front=None, engine=<EngineAbstract.AUTO: 'auto'>)

Given a graph and some source nodes, return subgraph of all paths within k-hops from the sources

This can be faster than the equivalent chain([…]) call that wraps it with additional steps

See chain() examples for examples of many of the parameters

g: Plotter nodes: dataframe with id column matching g._node. None signifies all nodes (default). hops: consider paths of length 1 to ‘hops’ steps, if any (default 1). to_fixed_point: keep hopping until no new nodes are found (ignores hops) direction: ‘forward’, ‘reverse’, ‘undirected’ edge_match: dict of kv-pairs to exact match (see also: filter_edges_by_dict) source_node_match: dict of kv-pairs to match nodes before hopping (including intermediate) destination_node_match: dict of kv-pairs to match nodes after hopping (including intermediate) source_node_query: dataframe query to match nodes before hopping (including intermediate) destination_node_query: dataframe query to match nodes after hopping (including intermediate) edge_query: dataframe query to match edges before hopping (including intermediate) return_as_wave_front: Exclude starting node(s) in return, returning only encountered nodes target_wave_front: Only consider these nodes + self._nodes for reachability engine: ‘auto’, ‘pandas’, ‘cudf’ (GPU)

Parameters
  • self (Plottable) –

  • nodes (Optional[Any]) –

  • hops (Optional[int]) –

  • to_fixed_point (bool) –

  • direction (str) –

  • edge_match (Optional[dict]) –

  • source_node_match (Optional[dict]) –

  • destination_node_match (Optional[dict]) –

  • source_node_query (Optional[str]) –

  • destination_node_query (Optional[str]) –

  • edge_query (Optional[str]) –

  • target_wave_front (Optional[Any]) –

  • engine (Union[EngineAbstract, str]) –

Return type

Plottable

graphistry.compute.hop.query_if_not_none(query, df)
Parameters
  • query (Optional[str]) –

  • df (Any) –

Return type

Any