Skip to content

Feature: Non-bendy graph paths #668

@Dhghomon

Description

@Dhghomon

Is your feature request related to a problem?

The following code to simulate the distances in the Solar System works pretty well, until you get past Saturn and the paths get too long. At that point they bend back on each other so much that it all ends up looking like a big ball of string.

CREATE the:counter SET val = 1;

DEFINE FUNCTION fn::make_path($from: record<body>, $to: record<body>, $steps: int) {
    FOR $step IN 0..=$steps {
        IF $step = 0 {
            UPDATE ONLY the:counter SET val += 1;
            LET $next = type::thing("way", the:counter.val);
            CREATE ONLY $next;
            RELATE $from->to->$next;
        }
        ELSE IF $step = $steps {
            LET $current = type::thing("way", the:counter.val);
            RELATE $current->to->$to;
        } ELSE {
            LET $this_stop = type::thing("way", the:counter.val);
            UPDATE ONLY the:counter SET val += 1;
            LET $next = type::thing("way", the:counter.val);
            CREATE ONLY $next;
            RELATE $this_stop->to->$next;
        }
    }    
};

CREATE body:sun, body:earth, body:venus, body:mercury, body:mars, body:jupiter, body:saturn/*, body:uranus, body:neptune, body:pluto, body:eris*/;

fn::make_path(body:sun, body:mercury, 1);
fn::make_path(body:sun, body:venus, 2);
fn::make_path(body:sun, body:earth, 3);
fn::make_path(body:sun, body:mars, 4);
fn::make_path(body:sun, body:jupiter, 13);
fn::make_path(body:sun, body:saturn, 24);
-- fn::make_path(body:sun, body:uranus, 48);
-- fn::make_path(body:sun, body:neptune, 75);
-- fn::make_path(body:sun, body:pluto, 102);
-- fn::make_path(body:sun, body:eris, 173);

SELECT id, ->to->? FROM body, way;

Describe the solution

A box to click on if you prefer straight paths. When choosing straight paths, they will move outward and thus the display area will be chosen by the longest path. In the case of the Solar System example, Eris would be the longest line, the next closer bodies would be consecutively smaller, and by the time you get to the Inner Solar System you can't see it without zooming in.

Like this

Image

Have you considered contributing this feature yourself?

No response

Contact Details

Slack

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions