pygraphistry icon indicating copy to clipboard operation
pygraphistry copied to clipboard

Feature Request: Support marking mode in addition to filtering mode for ASTRef chain operations

Open lmeyerov opened this issue 3 months ago • 0 comments

Feature Request: Marking mode for chain operations

Background

While fixing PR #751, discovered ASTRef was marking instead of filtering. Fixed to filter (correct for data flow), but marking has value.

Proposed Contexts for Marking Mode

1. Chain Operations with Matchers

# Mark matching nodes in chain
Chain([n({'type': 'person'}).mark()])  # Returns all nodes with 'is_person' column

2. Within Let() Bindings

# Order-sensitive marking in DAG context
let({
    'marked_people': n({'type': 'person'}).mark(),  # Marks but doesn't filter
    'marked_companies': n({'type': 'company'}).mark(),  # Can see previous marks
    'high_value': n({'value': {'': 1000}}).mark()  # Accumulates marks
})
# Result: Full graph with multiple boolean columns

3. Match Context (Future)

# Pattern matching with marking
match(pattern).mark()  # Marks matched subgraphs

Key Design Questions

  • Chain context: Should .mark() be on matchers (n/e) or Chain?
  • Let context: How to handle order-sensitive accumulation?
  • API: .mark() method vs mode parameter?
  • Column naming: Auto-generate or user-specified?

Implementation Notes

  • Marking logic exists (removed in cdaccd96)
  • Need conditional marking vs filtering
  • Consider performance implications

Related: PR #751, Issue #755

lmeyerov avatar Sep 28 '25 15:09 lmeyerov