# Sketchboard Auto Layout > Tidy up a diagram automatically: layered flowchart layout or a balanced mind map. Takes a Sketchboard board or a plain list of links (“A -> B”) and arranges the boxes: a layered layout with few crossings for flowcharts and graphs in any direction, or a balanced left/right tree for mind maps. Returns the new positions, an SVG and the board file. Part of usefulweb.app (https://usefulweb.app/). Part of [Sketchboard](https://sketchboard.usefulweb.app/) (ownerApp: sketchboard). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://sketchboardautolayout.usefulweb.app/ (interactive tool at https://sketchboardautolayout.usefulweb.app/tool) - JSON API: POST https://sketchboardautolayout.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://sketchboardautolayout.usefulweb.app/api/v1/tool) - OpenAPI: https://sketchboardautolayout.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://sketchboardautolayout.usefulweb.app/mcp - tool `sketchboard_auto_layout` ## Inputs - edges (textarea): Links, one per line - For example “Idea -> Research” or “Research -> Prototype: needs a budget”. A line with only a name adds a lonely box. Ignored when a board is given. - board (textarea): Or a Sketchboard board (JSON) - A .sketchboard.json file. Shapes that are glued to connectors are laid out; locked shapes stay. - mode (select): Layout - direction (select): Direction (layered) - gapX (integer): Gap between neighbours - gapY (integer): Gap between ranks ## Method - Nodes are the board’s shapes, notes, texts and props that are not locked; links are connectors glued at both ends. From a link list every distinct name becomes a rounded box sized to its text. - Layered layout (Sugiyama et al. 1981): DFS back edges are reversed to remove cycles, ranks follow the longest path from the sources, long links get dummy nodes, barycentre sweeps (up to 12, the best ordering is kept) reduce crossings, and median alignment straightens links before overlaps are pushed apart. The result lists the number of crossings left between neighbouring ranks. - Mind map: a breadth-first tree from the root (the mind-map root shape, else the node with the most links); first-level branches go alternately right and left, whichever side is shorter so far, and every subtree is stacked vertically by its height. - The layout keeps the top-left corner of the old drawing and only moves boxes; glued connectors follow automatically. ## Limits - A layout is a starting point: very dense graphs keep some crossings, and nodes are not resized.