Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix edge directionality in graph layout #2268

Merged
merged 2 commits into from
Feb 23, 2017

Conversation

fbarl
Copy link
Contributor

@fbarl fbarl commented Feb 22, 2017

Fixes #2267.

layout-fixed

The problem was that we were not making a difference between source and target nodes when constructing edges for the layout engine (for the purpose of not rendering the same edge twice).

Note: The bidirectional edges are now represented as two directed edges, both in the layout engine and when rendering. So they are actually rendered as two overlapping edges, although that's currently not visible. I intentionally left it like that so that we could make them non-overlapping if we want or have an easier time drawing the arrows later on.

@fbarl fbarl self-assigned this Feb 22, 2017
@fbarl fbarl requested a review from jpellizzari February 22, 2017 12:43
@rade
Copy link
Member

rade commented Feb 22, 2017

The bidirectional edges are now represented as two directed edges, both in the layout engine and when rendering. So they are actually rendered as two overlapping edges, although that's currently not visible. I intentionally left it like that so that we could make them non-overlapping if we want or have an easier time drawing the arrows later on.

Hmm. Not sure about that. I would expect bidirectional edges to be rendered as one edge with two arrowheads.

If it's relatively easy to have one edge for bidirectional edges, let's do that. If not, then what you have is ok.

@rade
Copy link
Member

rade commented Feb 22, 2017

btw, was this always broken, or is it a regression?

@fbarl fbarl force-pushed the fix-graph-layout-edge-directionality branch from a8b56b3 to f1b80c0 Compare February 22, 2017 15:12
@fbarl
Copy link
Contributor Author

fbarl commented Feb 22, 2017

@rade Alright, I modified the code so that it doesn't render both edges, but I'm still sending them both to the layout engine so that the rank assignment would be more accurate. I cleaned up that code and added some comments and unit tests.

I think I broke edge directions in one of my optimizations stories, so I don't think it was there for too long. However, I think we were always ignoring one direction in case of bidirectional edges, which is something this story also fixes. There is a chance this fix will improve stability and accuracy of some rendered graphs slightly.

@rade
Copy link
Member

rade commented Feb 22, 2017

I think I broke edge directions in one of my optimizations stories,

Did that breakage make it into 1.2? If so, we may want to release a 1.2.1 with a fix. cc @2opremio

import { fromJS } from 'immutable';

describe('LayouterUtils', () => {
const LayouterUtils = require('../layouter-utils');

This comment was marked as abuse.

This comment was marked as abuse.

@fbarl
Copy link
Contributor Author

fbarl commented Feb 22, 2017

@rade Fortunately the breakage didn't make it into any of the releases as it was introduced on master only 2 days ago when merging #2221 (line 19 in nodes-chart-layout.js).

@jpellizzari
Copy link
Contributor

LGTM. Nice to have tests for this!

@fbarl fbarl merged commit 225477f into master Feb 23, 2017
@fbarl fbarl deleted the fix-graph-layout-edge-directionality branch March 24, 2017 14:10
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.

graph not rendered top-down, despite lack of cycles
3 participants