Skip to content

bug: Mixing directed and undirected edges in motif throws parse error #750

@snakingfire

Description

@snakingfire

Describe the bug

I'm unsure if this is a bug or intended behavior, but it seems like on 0.10.0 it isn't possible to mix directed and undirected components in motifs?

To Reproduce

Single undirected works as expected and finds the motif undirected

graph.find("(a)-[b]-(c)").show(10, truncate=False)

But adding an additional component fails:

graph.find("(a)-[b]-(c); (c)-[d]->(e)").show(10, truncate=False)

Throws:

Py4JJavaError: An error occurred while calling o295.find.
: org.graphframes.InvalidParseException: Failed to parse bad motif string: '(a)-[b]-(c); (c)-[d]->(e)'.  Returned message: '->' expected but '-' found
	at org.graphframes.pattern.Pattern$.parse(patterns.scala:83)
	at org.graphframes.GraphFrame.findAugmentedPatterns(GraphFrame.scala:520)
	at org.graphframes.GraphFrame.find(GraphFrame.scala:515)

Expected behavior

It should be possible to mix directed and undirected motif components.

System [please complete the following information]:

  • OS: Mac OS 15.5
  • Python Version (if applied): Python 3.11
  • Spark / PySpark version: PySpark 3.5.6
  • GraphFrames version: io.graphframes:graphframes-spark3_2.12:0.10.0

Component

  • Scala Core Internal
  • Scala API
  • Spark Connect Plugin
  • PySpark Classic
  • PySpark Connect

Are you planning on creating a PR?

Willing to help but may need some direction / guidance.

  • I'm willing to make a pull-request

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions