An element of a visual depiction of a graph.
Start and finish points of the edge should not intersect the vertex boxes.
A horizontal or vertical segment of an edge.
A horizontal or vertical segment of an edge. Includes all points in the segment, so overlaps with other segments on the bend points.
Information about a horizontal edge segment (segment2) and the previous and next vertical segments (segment2 and segment3 respectively).
Information about a horizontal edge segment (segment2) and the previous and next vertical segments (segment2 and segment3 respectively).
│ 1 │ 2 ╰────────────╮ │ 3 v
Keep track of vertex regions, and horizontal and vertical edge segments as we move them around, so we can detect collisions.
Array of characters used to render the final diagram
Mutable 2D representation of whether or not positions are occupied.
-- each element is a row of text to be rendered inside the vertex.
Raise edges if there are no conflicting diagram elements.
Raise edges if there are no conflicting diagram elements. For example:
╭───────╮ ╭───────╮ │ A │ │ A │ ╰─┬─┬─┬─╯ ╰─┬─┬─┬─╯ │ │ │ │ │ │ │ │ ╰────╮ ╭──╯ ╰╮╰────╮ │ ╰╮ │ => │ │ │ ╭──╯ │ │ │ │ │ │ │ │ │ │ │ v v v v v v ╭───╮ ╭───╮ ╭───╮ ╭───╮ ╭───╮ ╭───╮ │ B │ │ C │ │ D │ │ B │ │ C │ │ D │ ╰───╯ ╰───╯ ╰───╯ ╰───╯ ╰───╯ ╰───╯
Remove kinks in edges where this can be achieved by removing an edge segment.
Remove kinks in edges where this can be achieved by removing an edge segment. For example:
╭───────────╮ ╭───────────╮ │Aberystwyth│ │Aberystwyth│ ╰─────┬─────╯ ╰─┬─────────╯ │ ==> │ ╭───╯ │ │ │ v v ╭───╮ ╭───╮ │ X │ │ X │ ╰───╯ ╰───╯
Delete redundant rows that consist of nothing but vertical edges:
Delete redundant rows that consist of nothing but vertical edges:
╭───────╮ ╭───────╮ │ A │ │ A │ ╰─┬─┬─┬─╯ ╰─┬─┬─┬─╯ │ │ │ │ │ │ ╭──╯ ╰╮╰────╮ ╭──╯ ╰╮╰────╮ │ │ │ => │ │ │ │ │ │ v v v │ │ │ ╭───╮ ╭───╮ ╭───╮ v v v │ B │ │ C │ │ D │ ╭───╮ ╭───╮ ╭───╮ ╰───╯ ╰───╯ ╰───╯ │ B │ │ C │ │ D │ ╰───╯ ╰───╯ ╰───╯
Start and finish points of the edge should not intersect the vertex boxes.
-- points of flex in the edge, includes start (first) and finish (last) points
-- has an arrow at the start point.
-- has an arrow at the finish point.