GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve result formatting for variable length pattern and undirected pattern by gounnaa · Pull Request #728 · graphframes/graphframes

Conversation

@gounnaa

@gounnaa gounnaa commented Oct 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR improves the formatting for the variable-length and undirected motif pattern.

  1. Add informative columns: _hop, _pattern, _direction
  2. Fix the first column name change for a variable-length pattern
    The first edge column name for the fixed pattern (u)-[e*1]-(v) and the variable length pattern should be _e1, not e, so that it matches with the other column.
image

Case 1: undirected pattern
g.find("(u)-[]-(v)").where("u.id == 0").show()

Before:
It took me quite some time to understand why it returns two rows, not three rows. The bidirectional edge returns one with the anonymous edge pattern.

+---------+---------+
|        u|        v|  
+---------+---------+
|{0, a, f}|{1, b, m}|
|{0, a, f}|{2, c, m}|
+---------+---------+

After:
It returns three rows with the information, two in edges and one out edge.

+---------+---------+-----------+----------+
|        u|        v|   _pattern|_direction|
+---------+---------+-----------+----------+
|{0, a, f}|{1, b, m}|(u)<-[]-(v)|        in|
|{0, a, f}|{2, c, m}|(u)<-[]-(v)|        in|
|{0, a, f}|{1, b, m}|(u)-[]->(v)|       out|
+---------+---------+-----------+----------+

Case 2: undirected variable-length pattern
g.find("(v)-[e*1..3]-(u)").where("u.id == 2").show()

Before:
Cannot understand why e column is placed at the end of the data frame, and not easy to understand the result.

+---------+---------------+---------+--------------+---------+--------------+---------+---------------+
|        u|            _e1|      _v1|           _e2|      _v2|           _e3|        v|              e|
+---------+---------------+---------+--------------+---------+--------------+---------+---------------+
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 2, friend}|{2, c, m}|           NULL|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 0, follow}|{0, a, f}|           NULL|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|     NULL|          NULL|{1, b, m}|           NULL|
|{2, c, m}|           NULL|     NULL|          NULL|     NULL|          NULL|{3, d, f}| {2, 3, follow}|
|{2, c, m}|           NULL|     NULL|          NULL|     NULL|          NULL|{0, a, f}|{2, 0, unknown}|
|{2, c, m}| {1, 0, follow}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 2, friend}|{1, b, m}|           NULL|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 2, friend}|{2, c, m}|           NULL|
|{2, c, m}| {0, 1, friend}|{1, b, m}|{1, 2, friend}|     NULL|          NULL|{0, a, f}|           NULL|
|{2, c, m}|           NULL|     NULL|          NULL|     NULL|          NULL|{1, b, m}| {1, 2, friend}|
+---------+---------------+---------+--------------+---------+--------------+---------+---------------+

After:
The informative columns such as _hop, _pattern, _direction is added to help understand the results. It also ordered by _hop, _direction.

+---------+---------------+---------+--------------+---------+--------------+---------+----+--------------+----------+
|        u|            _e1|      _v1|           _e2|      _v2|           _e3|        v|_hop|      _pattern|_direction|
+---------+---------------+---------+--------------+---------+--------------+---------+----+--------------+----------+
|{2, c, m}| {1, 2, friend}|     NULL|          NULL|     NULL|          NULL|{1, b, m}|   1|(u)<-[e*1]-(v)|        in|
|{2, c, m}| {2, 3, follow}|     NULL|          NULL|     NULL|          NULL|{3, d, f}|   1|(u)-[e*1]->(v)|       out|
|{2, c, m}|{2, 0, unknown}|     NULL|          NULL|     NULL|          NULL|{0, a, f}|   1|(u)-[e*1]->(v)|       out|
|{2, c, m}| {0, 1, friend}|{1, b, m}|{1, 2, friend}|     NULL|          NULL|{0, a, f}|   2|(u)<-[e*2]-(v)|        in|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|     NULL|          NULL|{1, b, m}|   2|(u)-[e*2]->(v)|       out|
|{2, c, m}| {1, 0, follow}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 2, friend}|{1, b, m}|   3|(u)<-[e*3]-(v)|        in|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 2, friend}|{2, c, m}|   3|(u)<-[e*3]-(v)|        in|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 2, friend}|{2, c, m}|   3|(u)-[e*3]->(v)|       out|
|{2, c, m}|{2, 0, unknown}|{0, a, f}|{0, 1, friend}|{1, b, m}|{1, 0, follow}|{0, a, f}|   3|(u)-[e*3]->(v)|       out|
+---------+---------------+---------+--------------+---------+--------------+---------+----+--------------+----------+

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

SemyonSinchenko reacted with heart emoji
All reactions
  • ❤️ 1 reaction
gounnaa added 2 commits October 9, 2025 19:16
@gounnaa
add informative columns
a320046
@gounnaa
change first edge name for varlength pattern
e2a9ad7
@gounnaa gounnaa changed the title Improve result formatting for variable length pattern and undirected pattern [WIP] Improve result formatting for variable length pattern and undirected pattern Oct 9, 2025
gounnaa added 3 commits October 9, 2025 19:57
@gounnaa
udpate test case
423dd57
@gounnaa
sbt scalafmtAll
912ad8d
@gounnaa
order undirected pattern
266964f
@gounnaa gounnaa changed the title [WIP] Improve result formatting for variable length pattern and undirected pattern Improve result formatting for variable length pattern and undirected pattern Oct 9, 2025
@gounnaa
gounnaa marked this pull request as ready for review October 9, 2025 12:20
@gounnaa

gounnaa commented Oct 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Now, it make sense to me. Please merge this improvement before releasing the new version.
@SemyonSinchenko and @rjurney, I am waiting for your review. :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

SemyonSinchenko
SemyonSinchenko approved these changes Oct 9, 2025
View reviewed changes

@SemyonSinchenko SemyonSinchenko left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @goungoun

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gounnaa reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@SemyonSinchenko SemyonSinchenko mentioned this pull request Oct 9, 2025
feat: prepare the release 0.10.0 #725
Merged
@gounnaa
bug fix - bidirectional named edge pattern
4f98f23
@gounnaa

gounnaa commented Oct 11, 2025

Copy link
Copy Markdown
Contributor Author

While checking the examples in the manual, I found a bug and fixed. The named edge pattern (u)<-[e]->(v) should be transformed to (u)-[e1]->(v);(v)-[e2]->(u). (u)-[e]->(v);(v)-[e]->(u) is wrong.

SemyonSinchenko reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gounnaa
doc
95e091b
@gounnaa

gounnaa commented Oct 11, 2025

Copy link
Copy Markdown
Contributor Author

@SemyonSinchenko, I pushed the document changes, 04-motif-finding.md.

SemyonSinchenko reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gounnaa
docs - add undirectional pattern and fix patterns
df0d8d7
@gounnaa
gounnaa requested a review from SemyonSinchenko October 12, 2025 04:10
SemyonSinchenko
SemyonSinchenko approved these changes Oct 12, 2025
View reviewed changes

@SemyonSinchenko SemyonSinchenko left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks @goungoun

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SemyonSinchenko
SemyonSinchenko merged commit f5de10f into graphframes:main Oct 12, 2025
@gounnaa

gounnaa commented Oct 12, 2025

Copy link
Copy Markdown
Contributor Author

Thank you, @SemyonSinchenko.

SemyonSinchenko reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@SemyonSinchenko SemyonSinchenko SemyonSinchenko approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gounnaa @SemyonSinchenko
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.