darabos commited on
Commit
1b0481a
·
1 Parent(s): 4bd97bb

Fix sampling when there is no node with id 0.

Browse files
lynxkite-graph-analytics/src/lynxkite_plugins/graph_analytics/lynxkite_ops.py CHANGED
@@ -253,7 +253,7 @@ def organize_bundle(bundle: Bundle, *, code: ops.LongStr):
253
  def sample_graph(graph: nx.Graph, *, nodes: int = 100):
254
  """Takes a (preferably connected) subgraph."""
255
  sample = set()
256
- to_expand = deque([0])
257
  while to_expand and len(sample) < nodes:
258
  node = to_expand.pop()
259
  for n in graph.neighbors(node):
 
253
  def sample_graph(graph: nx.Graph, *, nodes: int = 100):
254
  """Takes a (preferably connected) subgraph."""
255
  sample = set()
256
+ to_expand = deque([next(graph.nodes.keys().__iter__())])
257
  while to_expand and len(sample) < nodes:
258
  node = to_expand.pop()
259
  for n in graph.neighbors(node):