Skip to content

unexpected overlapping behavior for from_vertices_and_edges #28

Description

@MathieuDuponchelle

I want to create layouts for vertices with varying dimensions, and I get unexpected results:

use rust_sugiyama::{configure::Config, from_vertices_and_edges};

fn main() {
    let vertices = [(0, (40.0, 8.0)), (1, (7.0, 3.0)), (2, (39.0, 3.0))];

    let edges = [(0, 1), (0, 2)];

    let layouts = from_vertices_and_edges(
        &vertices,
        &edges,
        &Config {
            vertex_spacing: 6.0,
            ..Default::default()
        },
    );

    for (layout, width, height) in layouts {
        println!("Coordinates: {:?}", layout);
        println!("width: {width}, height: {height}");
    }
}

This prints:

Coordinates: [(0, (22.75, 0.0)), (1, (37.5, 11.5)), (2, (0.0, 11.5))]
width: 2, height: 2

Meaning node 2 with width 39 actually overlaps with node 1 by 1.5 units, even though I specified a vertex spacing of 6.

The visual result in my application looks like:

Image

I think this is probably related to this comment : #18 (comment) , @andriyDev any thoughts here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions