panthernet / GraphX

GraphX for .NET
Apache License 2.0
316 stars 104 forks source link

Parallel edge modifications for connection points #77

Closed perturbare closed 7 years ago

perturbare commented 7 years ago

These changes are to modify the parallel edge logic so that it takes connection points into account. If an edge uses a connection point at only one end and parallel line grouping is in effect, the edge will be rendered parallel, but aligned to the connection point. Previously, the end that did not use a connection point would be directed to its unmodified position in the parallel edge grouping, which could result in odd behavior like edges crossing others in the group.

As part of these changes, GraphArea.UpdateParallelEdgesData() was changed substantially. These code changes will alter the sequence of edges and does not attempt to preserve the exact ordering from the old code. In the old code, the groups were built simply as the edges were encountered and did not appear to have a defined order, so I think this should be fine, but it could change the appearance of existing graphs. The new code also excludes edges that have both ends tied to connection points because those will not be spaced within the group anyway. There is a small performance penalty for very small numbers of edges, but at 50-100 edges a 3-5x speed improvement in GraphArea.UpdateParallelEdgesData() can be observed.