Skip to content

Conversation

kiptuidenis
Copy link
Contributor

The current documentation for walker traversal shows the example:

# Now, tell the walker to go to all connected friends
visit [->:FriendsWith:->];

However, this is misleading. The walker does not visit "all connected friends" if the graph contains edges pointing into the current node. For example, starting the walker from Bob or Charlie in a simple FriendsWith network will skip some connections, because [->:FriendsWith:->] only follows outgoing edges.

To correctly traverse all connected friends regardless of edge direction, the example should use:

visit [<-:FriendsWith:->];

This tells the walker to follow both incoming (<-) and outgoing (->) FriendsWith edges, which matches the intended "all connected friends" behavior.

This commit updates the example code in the docs to prevent confusion for new Jac learners. It also aligns the explanation with the actual runtime behavior.

Description

The current documentation for walker traversal shows the example:

    # Now, tell the walker to go to all connected friends
    visit [->:FriendsWith:->];

However, this is misleading. The walker does *not* visit "all connected friends" if 
the graph contains edges pointing into the current node. For example, starting 
the walker from Bob or Charlie in a simple FriendsWith network will skip some 
connections, because [->:FriendsWith:->] only follows *outgoing* edges.

To correctly traverse all connected friends regardless of edge direction, the 
example should use:

    visit [<-:FriendsWith:->];

This tells the walker to follow both incoming (<-) and outgoing (->) 
FriendsWith edges, which matches the intended "all connected friends" behavior.

This commit updates the comment and example code in the docs to prevent 
confusion for new Jac learners. It also aligns the explanation with the actual 
runtime behavior.
@CLAassistant
Copy link

CLAassistant commented Sep 23, 2025

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants