Advanced maths

Minimum rectilinear graph crossings calculator on supplied planar sites

Assign vertices to fixed planar sites to minimize straight-line crossing edge pairs, using exact integer orientation predicates.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Assign vertices to fixed planar sites to minimize straight-line crossing edge pairs, using exact integer orientation predicates.

THE FORMULAmin over bijections π: V→sites of the number of nonincident edge pairs with proper segment intersections.

A worked example

K4 placed at the four corners of a square has one proper crossing pair in every vertex assignment: the two diagonals. The minimum on these supplied sites is therefore 1, although K4 is topologically planar.

Good to know

Simple graphs on at most eight vertices, with an equal number of distinct integer planar sites and no three collinear. Exhaustive assignments, exact BigInt orientations and a stated work cap. Counts unordered nonincident edge pairs, not distinct crossing locations. Not the unrestricted rectilinear crossing number.

The sites are part of the problem

A graph drawing needs both connections and vertex positions. Here the available positions are supplied in advance, and the calculator chooses a bijection between graph vertices and those sites. Each edge is drawn as a straight segment. The objective counts pairs of edges that cross properly away from shared endpoints.

This is more constrained than topological planarity, which permits curved edges and freely chosen positions. It is also more constrained than the unrestricted rectilinear crossing number, which can optimize the locations themselves. An answer of one on the entered sites does not prove that every possible straight drawing of the graph has a crossing.

Two site assignments with crossing edge-pair counts and one optimal arrangementK₄ on four convex sitesTwo diagonals: one pairFixed-site minimum = 1
Scroll across to see the full diagram.
All six K4 edges on four square corners force one crossing pair. This does not contradict the graph’s topological planarity.

Compare this with the Graph planarity calculator with embedding certificate. Assign graph vertices to fixed geometric sites to minimize straight-segment crossings; topological planarity permits curved edges and freely chosen sites.

Keep labels and geometry separate

The graph vertices are labeled from zero through the number of sites minus one. Enter one unordered endpoint pair for each edge, and enter each planar coordinate pair once. A missing edge changes the optimization problem. Reordering the site list changes site IDs but should not change the optimum crossing count.

Coordinates must be integers within the stated implementation bound, and no three sites may lie on one line. General position removes ambiguous edge-through-vertex and overlapping-segment cases. If measured decimal positions are important, scaling them to exact integers is possible, but deliberate rounding can change collinearity and should be checked before calculation.

Count a proper crossing exactly

For two nonincident edges ab and cd, compute the orientation of c and d relative to directed line ab, and the orientation of a and b relative to cd. The segments cross properly exactly when both orientation pairs have opposite signs. With integer coordinates, determinant signs can be evaluated using BigInt arithmetic.

Edges sharing a graph endpoint are not counted as crossing pairs, even though their segments meet there. Multiple independent pairs crossing at one geometric point count separately. This pair-count convention is standard for this objective and differs from counting the number of distinct visible intersection locations in a rendered picture.

Why exhaustive assignment proves a minimum

Every permutation of the supplied sites is a possible placement of the labeled graph vertices. The search evaluates the crossing-pair count for every placement within the supported bound and retains one with minimum count. A completed enumeration therefore proves an optimum for the fixed site set, without needing a geometric local-search assumption.

Symmetries can produce many placements with the same count. The returned assignment is only one witness and need not be canonical under graph automorphisms or reflections. A work-cap interruption prevents a minimum claim: a currently good drawing is an upper bound until all relevant placements have been examined or a valid lower-bound certificate closes the gap.

Understand K4 on a square

The default graph contains all six edges among four vertices, and the sites are the four square corners. Whatever labels are assigned, all four sides and both diagonals appear. The two diagonals have one proper crossing, while every other nonincident pair lies on separate square sides or avoids a proper intersection.

Thus every assignment has crossing-pair count one. K4 nevertheless has a crossing-free straight drawing if one vertex is placed inside the triangle formed by the other three. That placement is unavailable in the default site set. The contrast is a useful check that the calculator is solving a prescribed-position assignment problem rather than merely testing graph planarity.

Replay the selected witness

The output should identify which input site receives each graph vertex, list the crossing edge pairs, and give the number of assignments examined. Recreate the selected segments from that mapping and run the determinant test on every nonincident pair. Counting the listed witness pairs verifies its objective value independently.

Minimality requires more than replaying the winner: it depends on the completed exhaustive comparison or a valid objective lower bound. Reflections and translations preserve crossing status, and a nonzero uniform scaling does too. These transformations supply additional tests without changing the combinatorial objective or inventing additional candidate sites.

Use the result within its geometric scope

A minimum-crossing assignment can help compare small fixed-position layouts, but it does not optimize edge length, angular resolution, congestion or label readability. A placement with fewer crossing pairs may create very long edges. Inspect those separate design requirements before adopting the returned drawing for a physical or visual network.

For larger graphs, a heuristic can be useful if it reports an upper bound honestly. This page’s exact small-instance result should not be extrapolated to a much larger network. Preserve the supplied sites and full graph when comparing another implementation, because deleting isolated vertices or changing the available coordinates changes the assignment space.

A few questions, answered

Does zero crossings prove topological planarity?

A verified straight drawing without crossings does prove planarity, but a positive fixed-site optimum does not prove nonplanarity.

Are shared endpoints counted?

No. Only proper intersections of nonincident edge pairs count.

What if three edges cross at one point?

Each nonincident crossing pair counts separately; the objective is not the number of distinct intersection locations.

Can the calculator move the supplied sites?

No. It only chooses the bijection between graph vertices and the fixed coordinates.

Find your calculator

Start typing to explore the library.