diff --git a/CHANGELOG.md b/CHANGELOG.md index bf08ee2..df01196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ The package version runs on its own semver; the schema it is generated from is `SCHEMA_DIST_TAG`. +## 0.131.0 (2026-11-16) + +- **`unplaced_by_links_3d`: what a saved `by-links-3d` layout map does not place.** Given the graph and the ids of the elements the Map's Pins stand for (a list, a tuple or a set), it answers the ids of the graph's nodes that the Map has no Pin for, by id in code point order. Every node counts, of any type and with or without a link, since the method places every node it is handed. `placed` is read as `unplaced_by_kind` reads it: a member that is not a non-empty string is passed over, and an id that is no node is no part of the answer; two nodes with one id raise `ValueError`, as `layout_by_links_3d` does. The npm SDK's `unplacedByLinks3d` answers the same list. +- Tests: the method's shared fixture gains eight cases (72) and an `unplaced` suite of eight, the same bytes as the npm SDK's copy. No answer of the method changes. + ## 0.130.1 (2026-11-16) - **`layout_by_links_3d` no longer raises on a Map whose width or height is under 0.** A Map's `width` and `height` are any whole number in the standard. One under 0 raised a `PlateError` from inside the method when that Map held the most pinned elements, and with both under 0 the Map became a plate with every place mirrored. A width or height that is not over 0 is now no size: such a Map is no plate, no other Map is tried in its stead, and the world is laid out by its links alone; a Map over a place with such a size is no small plate. The method's shared fixture gains four cases for it (64), the same bytes as the npm SDK's copy. diff --git a/src/onlyworlds/__init__.py b/src/onlyworlds/__init__.py index 3ad2120..ab97f07 100644 --- a/src/onlyworlds/__init__.py +++ b/src/onlyworlds/__init__.py @@ -91,7 +91,7 @@ unplaced_around, unplaced_by_kind, ) -from .layout_links_3d import BY_LINKS_3D_REST, LayoutByLinks3d, layout_by_links_3d +from .layout_links_3d import BY_LINKS_3D_REST, LayoutByLinks3d, layout_by_links_3d, unplaced_by_links_3d from .layout_trail import ( TRAIL_TIERS, TrailHanger, @@ -324,6 +324,7 @@ "type_word", "unplaced_around", "unplaced_by_kind", + "unplaced_by_links_3d", "unread_for", "uuid7", "verify_level", diff --git a/src/onlyworlds/_version.py b/src/onlyworlds/_version.py index 5dca202..d621b0e 100644 --- a/src/onlyworlds/_version.py +++ b/src/onlyworlds/_version.py @@ -1 +1 @@ -__version__ = "0.130.1" +__version__ = "0.131.0" diff --git a/src/onlyworlds/layout_links_3d.py b/src/onlyworlds/layout_links_3d.py index 5189aa2..03a95dd 100644 --- a/src/onlyworlds/layout_links_3d.py +++ b/src/onlyworlds/layout_links_3d.py @@ -16,8 +16,16 @@ from ._directions import DIRECTIONS from ._layout3d.method import HeldRangeError, HeldTypeError, layout3d from ._layout3d.space import space_rows +from .layout_kind import _placed_ids -__all__ = ["BY_LINKS_3D_REST", "HeldRangeError", "HeldTypeError", "LayoutByLinks3d", "layout_by_links_3d"] +__all__ = [ + "BY_LINKS_3D_REST", + "HeldRangeError", + "HeldTypeError", + "LayoutByLinks3d", + "layout_by_links_3d", + "unplaced_by_links_3d", +] #: The rest length of the by-links-3d layout: a link's length at rest, and the unit of its answer's points. BY_LINKS_3D_REST = 60.0 @@ -116,3 +124,29 @@ def layout_by_links_3d( raise TypeError("layout_by_links_3d: the graph is {nodes, edges}, as world_graph answers it") rows = space_rows(list(elements) if elements is not None else None) return cast(LayoutByLinks3d, layout3d(nodes, edges, rows, DIRECTIONS, held=held, held_unit=held_unit)) + + +def unplaced_by_links_3d(graph: Mapping[str, Any], placed: Iterable[Any]) -> list[str]: + """What a saved ``by-links-3d`` layout map does not place. + + Answers the ids of the graph's nodes that are not in ``placed``, by id in code point order. The method places + every node it is handed, of any type and with or without a link, so nothing else is left out. ``placed`` is the + ids of the elements the Map's Pins stand for, a list or a set: from ``map_space``, the ``element_id`` of each pin + whose ``map`` is this Map. A member that is not a non-empty string (a Pin that stands for no element) is passed + over, and an id that is no node of the graph is no part of the answer. The answer's length is the count a tool + shows; reading or drawing a layout map never changes it. The npm SDK's ``unplacedByLinks3d`` answers the same + list. + + Raises ``TypeError`` on a graph that is not ``{nodes, edges}`` or a ``placed`` that is not a list or a set, and, + as ``layout_by_links_3d`` does, ``ValueError`` when two nodes share an id. + """ + nodes = graph.get("nodes") if isinstance(graph, Mapping) else None + edges = graph.get("edges") if isinstance(graph, Mapping) else None + if not isinstance(nodes, list) or not isinstance(edges, list): + raise TypeError("unplaced_by_links_3d: the graph is {nodes, edges}, as world_graph answers it") + taken = _placed_ids("unplaced_by_links_3d", placed) + ids = sorted(x["id"] for x in nodes) + for i in range(1, len(ids)): + if ids[i] == ids[i - 1]: + raise ValueError(f"unplaced_by_links_3d: two nodes share the id {ids[i]}") + return [i for i in ids if i not in taken] diff --git a/tests/fixtures/layout/by-links-3d.fixture.json b/tests/fixtures/layout/by-links-3d.fixture.json index 82b52bd..523e621 100644 --- a/tests/fixtures/layout/by-links-3d.fixture.json +++ b/tests/fixtures/layout/by-links-3d.fixture.json @@ -1,4 +1,4 @@ -{"fixture":"by-links-3d, a 3D default layout: each case's input and the answer the reference implementation gives","method":"by-links-3d","call":"the layout of the graph { nodes: input.nodes, edges: input.edges } with input.rows as the world's elements, at `steps` force steps (300, the method's own count, in every case); input.held and input.heldUnit are handed only where the input has the key (a null is handed as null)","rows":"input.rows is the world's Map and Pin elements as served (only the keys the map-space profile and its layout reading read), or null. They are read as the map-space profile reads them, and its layout reading says which Map is a layout map; the method has no reading of its own","table_sha256":"37dc2bbb4a1769e4ddafc2d0a27c9889229c3ef483e8f7cd6c9ba66a0d1afb87","table":"table_sha256 is the sha256 of the directions table the method reads (directions.json), the same bytes in every implementation","rest":60,"compare":{"exact":"every element whose how is centre, with or map: each of x, y, z the same double; and every how, group, part, held, centres and ids entry","within":"every element whose how is arm, link or shelf and whose held is false: each of x, y, z within 1e-9 of a rest (6e-8 units), because those are placed with the runtime's cosine and sine","held":"every element whose want.held is true, whatever its how: each of x, y, z the same double as input.held gives for it (it stands at its held point)","refused":"a case whose want is { refused: code }: the call throws before anything runs, and the error carries that code (in JavaScript err.code, on a TypeError for held-not-object and held-not-point, a RangeError for held-box and held-unit)"},"held":"a case named \"held: ...\" hands back points the method answered for an earlier input (input.held, element id to [x, y, z]; with input.heldUnit where the points were rounded)","points":"want.points is x, y, z of each element in want.ids order (the order input.nodes was handed in), 3 numbers an element","cases":[ +{"fixture":"by-links-3d, a 3D default layout: each case's input and the answer the reference implementation gives","method":"by-links-3d","call":"the layout of the graph { nodes: input.nodes, edges: input.edges } with input.rows as the world's elements, at `steps` force steps (300, the method's own count, in every case); input.held and input.heldUnit are handed only where the input has the key (a null is handed as null)","rows":"input.rows is the world's Map and Pin elements as served (only the keys the map-space profile and its layout reading read), or null. They are read as the map-space profile reads them, and its layout reading says which Map is a layout map; the method has no reading of its own","table_sha256":"37dc2bbb4a1769e4ddafc2d0a27c9889229c3ef483e8f7cd6c9ba66a0d1afb87","table":"table_sha256 is the sha256 of the directions table the method reads (directions.json), the same bytes in every implementation","rest":60,"compare":{"exact":"every element whose how is centre, with or map: each of x, y, z the same double, a zero compared by its value whatever its sign, because the file's JSON holds no -0 (JSON writes -0 as 0); and every how, group, part, held, centres and ids entry","within":"every element whose how is arm, link or shelf and whose held is false: each of x, y, z within 1e-9 of a rest (6e-8 units), because those are placed with the runtime's cosine and sine","held":"every element whose want.held is true, whatever its how: each of x, y, z the same double as input.held gives for it (it stands at its held point)","refused":"a case whose want is { refused: code }: the call throws before anything runs, and the error carries that code (in JavaScript err.code, on a TypeError for held-not-object and held-not-point, a RangeError for held-box and held-unit)","unplaced":"exact: the same ids in the same order"},"held":"a case named \"held: ...\" hands back points the method answered for an earlier input (input.held, element id to [x, y, z]; with input.heldUnit where the points were rounded)","points":"want.points is x, y, z of each element in want.ids order (the order input.nodes was handed in), 3 numbers an element","unplaced":"`unplaced`, after the cases: for each case, the id of every node of graph.nodes that is not in placed, in code point order (the method places every node it is handed). A member of placed that is not a non-empty string is passed over; a placed id that is no node is no part of the answer","cases":[ {"name":"nothing","input":{"nodes":[],"edges":[{"source":"x","target":"y","field":"friends"}],"rows":null},"steps":300,"want":{"ids":[],"points":[],"how":[],"group":[],"part":[],"centres":[],"held":[]}}, {"name":"one element","input":{"nodes":[{"id":"a","type":"character"}],"edges":[],"rows":null},"steps":300,"want":{"ids":["a"],"points":[0,0,0],"how":["centre"],"group":["a"],"part":[null],"centres":["a"],"held":[false]}}, {"name":"two linked","input":{"nodes":[{"id":"b","type":"character"},{"id":"a","type":"character"}],"edges":[{"source":"a","target":"b","field":"friends"}],"rows":null},"steps":300,"want":{"ids":["b","a"],"points":[-26.63370938537198,-50.33677039560397,62.68394429858367,0,0,0],"how":["with","centre"],"group":["a","a"],"part":[null,null],"centres":["a"],"held":[false,false]}}, @@ -62,5 +62,22 @@ {"name":"refused: a box made too wide by an id that is no node","input":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}],"rows":null,"held":{"b1":[0,0,0],"zz":[0,46081,0]}},"steps":300,"want":{"refused":"held-box"}}, {"name":"refused: heldUnit over an eighth of a rest","input":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}],"rows":null,"held":{"b1":[0,0,0]},"heldUnit":7.6},"steps":300,"want":{"refused":"held-unit"}}, {"name":"refused: heldUnit a string","input":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}],"rows":null,"held":{"b1":[0,0,0]},"heldUnit":"1"},"steps":300,"want":{"refused":"held-unit"}}, -{"name":"refused: heldUnit under 0 with nothing held","input":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}],"rows":null,"heldUnit":-1},"steps":300,"want":{"refused":"held-unit"}} +{"name":"refused: heldUnit under 0 with nothing held","input":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}],"rows":null,"heldUnit":-1},"steps":300,"want":{"refused":"held-unit"}}, +{"name":"two small groups at once","input":{"nodes":[{"id":"e07","type":"character"},{"id":"e06","type":"character"},{"id":"e05","type":"character"},{"id":"e04","type":"character"},{"id":"e03","type":"character"},{"id":"e02","type":"character"},{"id":"e01","type":"character"},{"id":"e00","type":"character"}],"edges":[{"source":"e00","target":"e01","field":"friends"},{"source":"e01","target":"e02","field":"friends"},{"source":"e02","target":"e03","field":"friends"},{"source":"e03","target":"e04","field":"friends"},{"source":"e04","target":"e05","field":"friends"},{"source":"e05","target":"e06","field":"friends"},{"source":"e06","target":"e07","field":"friends"},{"source":"e00","target":"e07","field":"friends"},{"source":"e01","target":"e03","field":"friends"},{"source":"e04","target":"e07","field":"friends"}],"rows":null},"steps":300,"want":{"ids":["e07","e06","e05","e04","e03","e02","e01","e00"],"points":[-64.6542075048291,-49.39531993486977,-36.60083945635895,-104.10109048146614,-91.28711344746064,39.139061441902555,-171.74698934950433,-31.17501917193904,68.41955136889734,-130.96058678737649,0,0,44.69707369798427,36.40865960655955,26.629933284712706,128.81916020634125,70.71197044696218,45.91808847564399,130.96058678737649,0,0,83.49612197955902,-63.664735889289894,-46.93243696816176],"how":["with","with","with","centre","with","with","centre","with"],"group":["e04","e04","e04","e04","e01","e01","e01","e01"],"part":[null,null,null,null,null,null,null,null],"centres":["e01","e04"],"held":[false,false,false,false,false,false,false,false]}}, +{"name":"one rivals link, one way","input":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"},{"source":"b8","target":"b1","field":"rivals"}],"rows":null},"steps":300,"want":{"ids":["s2","s1","q2","q1","f1","r2","r1","b8","b7","b6","b5","b4","b3","b2","b1"],"points":[17.386855323472567,65.85321709681135,-290.9265884029304,-92.92418634043786,117.43874400819752,-290.9265884029304,29.098252309189725,151.5620982363145,-290.9265884029304,-28.43615163321898,-27.319401116747954,-290.9265884029304,-201.2866209515525,-18.578598835199912,110.27085798987571,-107.33000424029402,328.1651137748644,-5.339539320848669,-89.47743377460661,267.2603202017564,16.383532459743762,106.85873723991183,-81.11864821053345,-40.55703188876012,54.87272782896406,-50.26791361837548,-110.92658840293038,-0.9859140470964469,-15.797944338953174,-44.328061366248114,-88.29395526803359,4.9013155318202974,47.44151402536038,-101.8295653996013,93.28422332599959,20.641664916997016,-42.91583457114945,155.88165373231354,7.8434391277798685,20.686434171018952,83.67217620885674,33.06249333064183,46.956837570637276,-43.01630970762412,90.28492348593336],"how":["shelf","shelf","shelf","shelf","link","arm","arm","with","centre","with","with","centre","with","with","centre"],"group":[null,null,null,null,null,null,null,"b7","b7","b7","b4","b4","b4","b4","b1"],"part":["no-link","no-link","no-link","no-link","one-link","one-link","one-link",null,null,null,null,null,null,null,null],"centres":["b1","b4","b7"],"held":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]}}, +{"name":"ids on either side of U+FFFF","input":{"nodes":[{"id":"a𐀀","type":"character"},{"id":"aļ¼”","type":"character"}],"edges":[{"source":"aļ¼”","target":"a𐀀","field":"friends"}],"rows":null},"steps":300,"want":{"ids":["a𐀀","aļ¼”"],"points":[11.360111384224727,-15.734115824574513,-82.43668643795081,0,0,0],"how":["with","centre"],"group":["aļ¼”","aļ¼”"],"part":[null,null],"centres":["aļ¼”"],"held":[false,false]}}, +{"name":"held: one part, and it is fixed","input":{"nodes":[{"id":"n6","type":"character"},{"id":"n5","type":"character"},{"id":"n4","type":"character"},{"id":"n3","type":"character"},{"id":"n2","type":"character"},{"id":"n1","type":"character"},{"id":"h","type":"character"}],"edges":[{"source":"h","target":"n1","field":"friends"},{"source":"n1","target":"n2","field":"friends"},{"source":"h","target":"n2","field":"friends"},{"source":"n2","target":"n3","field":"friends"},{"source":"h","target":"n3","field":"friends"},{"source":"n3","target":"n4","field":"friends"},{"source":"h","target":"n4","field":"friends"},{"source":"n4","target":"n5","field":"friends"},{"source":"h","target":"n5","field":"friends"},{"source":"n5","target":"n6","field":"friends"},{"source":"h","target":"n6","field":"friends"},{"source":"n6","target":"n1","field":"friends"}],"rows":null,"held":{"h":[100,50,-30]}},"steps":300,"want":{"ids":["n6","n5","n4","n3","n2","n1","h"],"points":[187.35825027134723,51.92957085493061,-2.9140633651216037,158.0047503002602,105.09498117108954,-76.8376176455764,62.967258910273614,124.03761362411443,-71.8475810074293,17.59271894139454,38.67243146233501,-71.25916991467034,51.818157843876,-24.40301171641228,-8.090624711823807,118.58515693953143,12.069845941961225,51.42761281380207,100,50,-30],"how":["with","with","with","with","with","with","centre"],"group":["h","h","h","h","h","h","h"],"part":[null,null,null,null,null,null,null],"centres":["h"],"held":[false,false,false,false,false,false,true]}}, +{"name":"held: a pinned element that hangs takes a place","input":{"nodes":[{"id":"r3","type":"object"},{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"},{"source":"b3","target":"r3","field":"friends"}],"rows":[{"id":"m1","type":"map","name":"m1","width":100,"height":100},{"id":"p01","type":"pin","map":"m1","element_type":"character","element_id":"b2","x":20,"y":30},{"id":"p02","type":"pin","map":"m1","element_type":"character","element_id":"b8","x":40,"y":90},{"id":"p03","type":"pin","map":"m1","element_type":"object","element_id":"r1","x":85,"y":15}],"held":{"s2":[98.26496735684333,10.000280116701349,-398.65891341623546],"s1":[-12.046074307067087,61.58580702808751,-398.65891341623546],"q2":[109.97636434256049,95.70916125620451,-398.65891341623546],"q1":[52.441960400151785,-83.17233809685796,-398.65891341623546],"f1":[17.18044548425914,-83.15112417016871,221.5679290950926],"r2":[260.6813707716776,109.02743038347975,58.29129677424753],"r1":[139.64800637963702,-22.69528132798397,-218.6589134162355],"b8":[46.117262770917634,133.189291353215,-218.6589134162355],"b7":[-117.78225233823198,54.077411101272006,61.30948181978409],"b6":[-52.272639422772336,14.03852736137068,22.66091428518937],"b5":[15.007491582572515,-39.718412233262676,123.15482454711595],"b4":[89.62712187503155,7.5139948607535985,128.4702359282292],"b3":[122.90653243146473,40.881869298717845,53.13812779446528],"b2":[4.548043389264571,8.481633208255822,-218.6589134162355],"b1":[-38.74674199854377,-111.64225855193449,28.87919566822225]}},"steps":300,"want":{"ids":["r3","s2","s1","q2","q1","f1","r2","r1","b8","b7","b6","b5","b4","b3","b2","b1"],"points":[232.04198624297973,67.75333934533461,133.47952580594261,98.26496735684333,10.000280116701349,-398.65891341623546,-12.046074307067087,61.58580702808751,-398.65891341623546,109.97636434256049,95.70916125620451,-398.65891341623546,52.441960400151785,-83.17233809685796,-398.65891341623546,17.18044548425914,-83.15112417016871,221.5679290950926,260.6813707716776,109.02743038347975,58.29129677424753,139.64800637963702,-22.69528132798397,-218.6589134162355,46.117262770917634,133.189291353215,-218.6589134162355,-117.78225233823198,54.077411101272006,61.30948181978409,-52.272639422772336,14.03852736137068,22.66091428518937,15.007491582572515,-39.718412233262676,123.15482454711595,89.62712187503155,7.5139948607535985,128.4702359282292,122.90653243146473,40.881869298717845,53.13812779446528,4.548043389264571,8.481633208255822,-218.6589134162355,-38.74674199854377,-111.64225855193449,28.87919566822225],"how":["link","shelf","shelf","shelf","shelf","link","arm","map","map","centre","with","with","centre","with","map","centre"],"group":[null,null,null,null,null,null,null,null,null,"b7","b7","b4","b4","b4",null,"b1"],"part":["one-link","no-link","no-link","no-link","no-link","one-link","one-link","map","map",null,null,null,null,null,"map",null],"centres":["b1","b4","b7"],"held":[false,true,true,true,true,true,true,false,false,true,true,true,true,true,false,true]}}, +{"name":"held: the fan when u points straight down","input":{"nodes":[{"id":"l2","type":"character"},{"id":"l1","type":"character"},{"id":"m","type":"character"},{"id":"c","type":"character"}],"edges":[{"source":"c","target":"m","field":"friends"},{"source":"c","target":"l1","field":"friends"},{"source":"c","target":"l2","field":"friends"}],"rows":null,"held":{"c":[0,0,0],"m":[0,0,60]}},"steps":300,"want":{"ids":["l2","l1","m","c"],"points":[-20.264708827845716,22.121066342349593,-114,0,0,-114,0,0,60,0,0,0],"how":["link","link","with","centre"],"group":[null,null,"c","c"],"part":["one-link","one-link",null,null],"centres":["c"],"held":[false,false,true,true]}}, +{"name":"a small plate of twenty","input":{"nodes":[{"id":"k21","type":"character"},{"id":"k20","type":"character"},{"id":"k19","type":"character"},{"id":"k18","type":"character"},{"id":"k17","type":"character"},{"id":"k16","type":"character"},{"id":"k15","type":"character"},{"id":"k14","type":"character"},{"id":"k13","type":"character"},{"id":"k12","type":"character"},{"id":"k11","type":"character"},{"id":"k10","type":"character"},{"id":"k09","type":"character"},{"id":"k08","type":"character"},{"id":"k07","type":"character"},{"id":"k06","type":"character"},{"id":"k05","type":"character"},{"id":"k04","type":"character"},{"id":"k03","type":"character"},{"id":"k02","type":"character"},{"id":"k01","type":"character"},{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}],"rows":[{"id":"m1","type":"map","name":"m1","width":100,"height":100},{"id":"m2","type":"map","name":"m2","width":50,"height":40,"location":"b4"},{"id":"p1-00","type":"pin","map":"m1","element_type":"character","element_id":"b4","x":10,"y":10},{"id":"p1-01","type":"pin","map":"m1","element_type":"character","element_id":"k01","x":30,"y":10},{"id":"p1-02","type":"pin","map":"m1","element_type":"character","element_id":"k02","x":50,"y":10},{"id":"p1-03","type":"pin","map":"m1","element_type":"character","element_id":"k03","x":70,"y":10},{"id":"p1-04","type":"pin","map":"m1","element_type":"character","element_id":"k04","x":90,"y":10},{"id":"p1-05","type":"pin","map":"m1","element_type":"character","element_id":"k05","x":10,"y":30},{"id":"p1-06","type":"pin","map":"m1","element_type":"character","element_id":"k06","x":30,"y":30},{"id":"p1-07","type":"pin","map":"m1","element_type":"character","element_id":"k07","x":50,"y":30},{"id":"p1-08","type":"pin","map":"m1","element_type":"character","element_id":"k08","x":70,"y":30},{"id":"p1-09","type":"pin","map":"m1","element_type":"character","element_id":"k09","x":90,"y":30},{"id":"p1-10","type":"pin","map":"m1","element_type":"character","element_id":"k10","x":10,"y":50},{"id":"p1-11","type":"pin","map":"m1","element_type":"character","element_id":"k11","x":30,"y":50},{"id":"p1-12","type":"pin","map":"m1","element_type":"character","element_id":"k12","x":50,"y":50},{"id":"p1-13","type":"pin","map":"m1","element_type":"character","element_id":"k13","x":70,"y":50},{"id":"p1-14","type":"pin","map":"m1","element_type":"character","element_id":"k14","x":90,"y":50},{"id":"p1-15","type":"pin","map":"m1","element_type":"character","element_id":"k15","x":10,"y":70},{"id":"p1-16","type":"pin","map":"m1","element_type":"character","element_id":"k16","x":30,"y":70},{"id":"p1-17","type":"pin","map":"m1","element_type":"character","element_id":"k17","x":50,"y":70},{"id":"p1-18","type":"pin","map":"m1","element_type":"character","element_id":"k18","x":70,"y":70},{"id":"p1-19","type":"pin","map":"m1","element_type":"character","element_id":"k19","x":90,"y":70},{"id":"p1-20","type":"pin","map":"m1","element_type":"character","element_id":"k20","x":10,"y":90},{"id":"p2-00","type":"pin","map":"m2","element_type":"character","element_id":"k02","x":5,"y":5},{"id":"p2-01","type":"pin","map":"m2","element_type":"character","element_id":"k03","x":15,"y":5},{"id":"p2-02","type":"pin","map":"m2","element_type":"character","element_id":"k04","x":25,"y":5},{"id":"p2-03","type":"pin","map":"m2","element_type":"character","element_id":"k05","x":35,"y":5},{"id":"p2-04","type":"pin","map":"m2","element_type":"character","element_id":"k06","x":45,"y":5},{"id":"p2-05","type":"pin","map":"m2","element_type":"character","element_id":"k07","x":5,"y":15},{"id":"p2-06","type":"pin","map":"m2","element_type":"character","element_id":"k08","x":15,"y":15},{"id":"p2-07","type":"pin","map":"m2","element_type":"character","element_id":"k09","x":25,"y":15},{"id":"p2-08","type":"pin","map":"m2","element_type":"character","element_id":"k10","x":35,"y":15},{"id":"p2-09","type":"pin","map":"m2","element_type":"character","element_id":"k11","x":45,"y":15},{"id":"p2-10","type":"pin","map":"m2","element_type":"character","element_id":"k12","x":5,"y":25},{"id":"p2-11","type":"pin","map":"m2","element_type":"character","element_id":"k13","x":15,"y":25},{"id":"p2-12","type":"pin","map":"m2","element_type":"character","element_id":"k14","x":25,"y":25},{"id":"p2-13","type":"pin","map":"m2","element_type":"character","element_id":"k15","x":35,"y":25},{"id":"p2-14","type":"pin","map":"m2","element_type":"character","element_id":"k16","x":45,"y":25},{"id":"p2-15","type":"pin","map":"m2","element_type":"character","element_id":"k17","x":5,"y":35},{"id":"p2-16","type":"pin","map":"m2","element_type":"character","element_id":"k18","x":15,"y":35},{"id":"p2-17","type":"pin","map":"m2","element_type":"character","element_id":"k19","x":25,"y":35},{"id":"p2-18","type":"pin","map":"m2","element_type":"character","element_id":"k20","x":35,"y":35},{"id":"p2-19","type":"pin","map":"m2","element_type":"character","element_id":"k21","x":45,"y":35}]},"steps":300,"want":{"ids":["k21","k20","k19","k18","k17","k16","k15","k14","k13","k12","k11","k10","k09","k08","k07","k06","k05","k04","k03","k02","k01","s2","s1","q2","q1","f1","r2","r1","b8","b7","b6","b5","b4","b3","b2","b1"],"points":[-22.64842494811566,-320.7485954914731,-249.4364053522748,-70.64842494811566,83.17867122428751,-489.4364053522748,369.27884176764496,-26.80314545465265,-489.4364053522748,259.2970250887048,-26.80314545465265,-489.4364053522748,149.31520840976467,-26.80314545465265,-489.4364053522748,39.3333917308245,-26.80314545465265,-489.4364053522748,-70.64842494811566,-26.80314545465265,-489.4364053522748,369.27884176764496,-136.7849621335928,-489.4364053522748,259.2970250887048,-136.7849621335928,-489.4364053522748,149.31520840976467,-136.7849621335928,-489.4364053522748,39.3333917308245,-136.7849621335928,-489.4364053522748,-70.64842494811566,-136.7849621335928,-489.4364053522748,369.27884176764496,-246.76677881253298,-489.4364053522748,259.2970250887048,-246.76677881253298,-489.4364053522748,149.31520840976467,-246.76677881253298,-489.4364053522748,39.3333917308245,-246.76677881253298,-489.4364053522748,-70.64842494811566,-246.76677881253298,-489.4364053522748,369.27884176764496,-356.7485954914731,-489.4364053522748,259.2970250887048,-356.7485954914731,-489.4364053522748,149.31520840976467,-356.7485954914731,-489.4364053522748,39.3333917308245,-356.7485954914731,-489.4364053522748,-39.19231204871616,-77.20856717171965,-669.4364053522747,-149.5033537126266,-25.62304026033349,-669.4364053522747,-27.480915062999003,8.500313967783512,-669.4364053522747,-85.0153190054077,-170.38118538527897,-669.4364053522747,-197.14907969890282,-49.78108150210039,25.380231729877465,-137.9797503694143,-26.74678956586138,185.31554018614585,-107.84649475372805,-83.99452045170824,167.57619931841992,-52.033892342202826,91.2213168244053,294.4588911237162,-12.351073191748753,11.314594788002239,299.573665395621,-57.204380939686516,-26.17859737243686,206.27694988238827,-101.88039371837137,-81.18135725302913,69.1493861819299,-70.64842494811566,-356.7485954914731,-489.4364053522748,-73.90895473157521,-269.622252306478,16.504803076399632,-77.14885262411647,-183.04732390382725,89.07495702716514,-136.96413521801588,125.47036734559063,189.86273995665377],"how":["map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","shelf","shelf","shelf","shelf","link","arm","arm","with","centre","with","with","map","with","with","centre"],"group":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"b7","b7","b7","b4","b4","b4","b4","b1"],"part":["map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","map","no-link","no-link","no-link","no-link","one-link","one-link","one-link",null,null,null,null,null,null,null,null],"centres":["b1","b4","b7"],"held":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]}}, +{"name":"held: a place passed over because it is near","input":{"nodes":[{"id":"f0","type":"character"},{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"q1","target":"q2","field":"friends"},{"source":"b5","target":"f0","field":"friends"}],"rows":null,"held":{"s2":[84.40198472905804,4.283808977263129,-310.7191262561572],"s1":[-25.90905693485238,55.86933588864929,-310.7191262561572],"q2":[96.1133817147752,89.9926901167663,-310.7191262561572],"q1":[38.5789777723665,-88.88880923629617,-310.7191262561572],"f1":[-106.17788138365609,-126.38604999881686,138.07981557860447],"r2":[188.3951282137921,84.18268908138815,263.95912950511695],"r1":[151.83933451370774,33.26506077030564,240.06207792691336],"b8":[-43.08125578587824,6.833411417025399,-130.71912625615718],"b7":[38.52640162843316,-35.29333980117323,-122.92929969078678],"b6":[38.02821784038996,-3.499757855374204,-37.092899627567185],"b5":[-28.995012069898106,-45.83684375966108,68.52078458366483],"b4":[42.88354548611926,-39.28484049243998,126.94701828570845],"b3":[94.03772045449811,28.860361253265857,138.30425348142552],"b2":[40.37558023668299,69.70302784176151,72.99912606651363],"b1":[-81.4099471145524,74.5781802936132,-4.017718594921658]}},"steps":300,"want":{"ids":["f0","s2","s1","q2","q1","f1","r2","r1","b8","b7","b6","b5","b4","b3","b2","b1"],"points":[-96.14341983914129,-146.14336987078968,117.85710821810989,84.40198472905804,4.283808977263129,-310.7191262561572,-25.90905693485238,55.86933588864929,-310.7191262561572,96.1133817147752,89.9926901167663,-310.7191262561572,38.5789777723665,-88.88880923629617,-310.7191262561572,-106.17788138365609,-126.38604999881686,138.07981557860447,188.3951282137921,84.18268908138815,263.95912950511695,151.83933451370774,33.26506077030564,240.06207792691336,-43.08125578587824,6.833411417025399,-130.71912625615718,38.52640162843316,-35.29333980117323,-122.92929969078678,38.02821784038996,-3.499757855374204,-37.092899627567185,-28.995012069898106,-45.83684375966108,68.52078458366483,42.88354548611926,-39.28484049243998,126.94701828570845,94.03772045449811,28.860361253265857,138.30425348142552,40.37558023668299,69.70302784176151,72.99912606651363,-81.4099471145524,74.5781802936132,-4.017718594921658],"how":["link","shelf","shelf","shelf","shelf","shelf","arm","arm","with","centre","with","with","centre","with","with","centre"],"group":[null,null,null,null,null,null,null,null,"b7","b7","b7","b4","b4","b4","b4","b1"],"part":["one-link","no-link","no-link","no-link","no-link","no-link","one-link","one-link",null,null,null,null,null,null,null,null],"centres":["b1","b4","b7"],"held":[false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true]}} +],"unplaced":[ +{"name":"by-links-3d-a-map-that-places-all","graph":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}]},"placed":["b1","b2","b3","b4","b5","b6","b7","b8","r1","r2","f1","q1","q2","s1","s2"],"want":[]}, +{"name":"by-links-3d-one-element-more","graph":{"nodes":[{"id":"b9","type":"character"},{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"},{"source":"b8","target":"b9","field":"friends"},{"source":"b9","target":"b2","field":"friends"}]},"placed":["b1","b2","b3","b4","b5","b6","b7","b8","r1","r2","f1","q1","q2","s1","s2"],"want":["b9"]}, +{"name":"by-links-3d-a-placed-id-that-is-no-node","graph":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}]},"placed":["b1","b2","b3","b4","b5","b6","b7","b8","r1","r2","f1","q1","q2","s1","zz"],"want":["s2"]}, +{"name":"by-links-3d-a-member-of-placed-that-is-no-id","graph":{"nodes":[{"id":"7","type":"character"},{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"},{"source":"b1","target":"7","field":"friends"}]},"placed":[null,"",7,"b1","b2","b3","b4","b5","b6","b7","b8","r1","r2","f1","q1","q2","s1","s2"],"want":["7"]}, +{"name":"by-links-3d-a-node-with-no-link-and-a-node-off-the-main-piece","graph":{"nodes":[{"id":"s2","type":"character"},{"id":"s1","type":"object"},{"id":"q2","type":"species"},{"id":"q1","type":"species"},{"id":"f1","type":"character"},{"id":"r2","type":"object"},{"id":"r1","type":"object"},{"id":"b8","type":"character"},{"id":"b7","type":"location"},{"id":"b6","type":"character"},{"id":"b5","type":"institution"},{"id":"b4","type":"character"},{"id":"b3","type":"location"},{"id":"b2","type":"character"},{"id":"b1","type":"character"}],"edges":[{"source":"b1","target":"b2","field":"friends"},{"source":"b2","target":"b3","field":"friends"},{"source":"b3","target":"b4","field":"friends"},{"source":"b4","target":"b5","field":"friends"},{"source":"b5","target":"b6","field":"friends"},{"source":"b6","target":"b7","field":"friends"},{"source":"b7","target":"b8","field":"friends"},{"source":"b8","target":"b1","field":"friends"},{"source":"b1","target":"b4","field":"friends"},{"source":"b1","target":"b5","field":"friends"},{"source":"b1","target":"b6","field":"friends"},{"source":"b4","target":"b7","field":"friends"},{"source":"b2","target":"b6","field":"friends"},{"source":"b3","target":"r1","field":"friends"},{"source":"r1","target":"r2","field":"friends"},{"source":"b5","target":"f1","field":"friends"},{"source":"q1","target":"q2","field":"friends"}]},"placed":["b1","b2","b3","b4","b5","b6","b7","b8","r1","r2","f1"],"want":["q1","q2","s1","s2"]}, +{"name":"by-links-3d-map-space-nodes-are-nodes","graph":{"nodes":[{"id":"d4","type":"marker"},{"id":"d0","type":"character"},{"id":"d3","type":"map"},{"id":"d1","type":"zone"},{"id":"d2","type":"pin"}],"edges":[{"source":"d2","target":"d0","field":"element_id"},{"source":"d2","target":"d3","field":"map"}]},"placed":["d0"],"want":["d1","d2","d3","d4"]}, +{"name":"by-links-3d-ids-past-the-first-plane","graph":{"nodes":[{"id":"a𐀀","type":"character"},{"id":"aļ¼”","type":"character"}],"edges":[]},"placed":[],"want":["aļ¼”","a𐀀"]}, +{"name":"by-links-3d-the-answer-by-id","graph":{"nodes":[{"id":"c3","type":"character"},{"id":"a1","type":"character"},{"id":"d4","type":"character"},{"id":"b2","type":"character"}],"edges":[{"source":"a1","target":"b2","field":"friends"},{"source":"b2","target":"c3","field":"friends"},{"source":"c3","target":"d4","field":"friends"}]},"placed":["d4"],"want":["a1","b2","c3"]} ]} diff --git a/tests/test_layout_links_3d.py b/tests/test_layout_links_3d.py index ed39a04..43b5296 100644 --- a/tests/test_layout_links_3d.py +++ b/tests/test_layout_links_3d.py @@ -8,6 +8,7 @@ those are placed with the runtime's cosine and sine held every element answered as held: the very double the case's input.held gives for it refused the call raises before anything runs, with the case's code +Its ``unplaced`` cases are ``unplaced_by_links_3d`` of a graph and a Map's placed ids: the same ids in the same order. Then the baked directions table against the table the fixture names, the handed order, the inputs left unchanged, and the exports.""" @@ -23,14 +24,14 @@ import pytest import onlyworlds -from onlyworlds import BY_LINKS_3D_REST, LayoutByLinks3d, layout_by_links_3d +from onlyworlds import BY_LINKS_3D_REST, LayoutByLinks3d, layout_by_links_3d, unplaced_by_links_3d from onlyworlds._directions import DIRECTIONS from onlyworlds.layout_links_3d import HeldRangeError, HeldTypeError REPO = Path(__file__).resolve().parent.parent FIXTURE = REPO / "tests" / "fixtures" / "layout" / "by-links-3d.fixture.json" TABLE = REPO / "codegen" / "layout" / "directions.json" -FIXTURE_SHA = "16284adffac8903777e754cc01d547de95a61447b6d945ca2f641ddf93c4d4eb" +FIXTURE_SHA = "b29606c379633a5fa13f35f71d449b67cb417013c2bfc223024650c7945edb37" BYTES = FIXTURE.read_bytes() @@ -79,7 +80,7 @@ def test_the_fixture_is_the_one_both_packages_hold() -> None: assert hashlib.sha256(BYTES).hexdigest() == FIXTURE_SHA assert FX["method"] == "by-links-3d" assert FX["rest"] == BY_LINKS_3D_REST - assert list(FX["compare"]) == ["exact", "within", "held", "refused"] + assert list(FX["compare"]) == ["exact", "within", "held", "refused", "unplaced"] def test_the_baked_directions_are_the_table_the_fixture_names() -> None: @@ -184,8 +185,39 @@ def test_the_refusals_and_the_graph() -> None: layout_by_links_3d({"nodes": [{"id": "a", "type": "character"}] * 2, "edges": []}) +@pytest.mark.parametrize("case", FX["unplaced"], ids=[c["name"] for c in FX["unplaced"]]) +def test_unplaced_case_exactly(case: dict[str, Any]) -> None: + assert unplaced_by_links_3d(copy.deepcopy(case["graph"]), copy.deepcopy(case["placed"])) == case["want"] + + +def test_unplaced_reads_a_list_and_a_set_alike_and_passes_over_what_is_no_id() -> None: + case = next(c for c in FX["unplaced"] if c["name"] == "by-links-3d-a-placed-id-that-is-no-node") + assert case["want"] == ["s2"] + graph, placed = case["graph"], case["placed"] + for given in (list(placed), tuple(placed), set(placed)): + assert unplaced_by_links_3d(copy.deepcopy(graph), given) == case["want"] + # a Pin that stands for no element gives no id: None, "" and a number place nothing + assert unplaced_by_links_3d(copy.deepcopy(graph), [None, "", 7, *placed, *placed]) == case["want"] + # nothing placed: every node, by id in code point order, whatever order was handed + ids = [x["id"] for x in graph["nodes"]] + assert unplaced_by_links_3d(copy.deepcopy(graph), []) == sorted(ids) + assert ids != sorted(ids) + one = {"nodes": [{"id": "a", "type": "character"}], "edges": []} + not_placed: tuple[Any, ...] = ("a", None, {"a": True}) + for bad in not_placed: + with pytest.raises(TypeError, match=r"^unplaced_by_links_3d: placed is a list or a set of element ids$"): + unplaced_by_links_3d(copy.deepcopy(one), bad) + not_graphs: tuple[Any, ...] = ({"nodes": []}, {"edges": []}, {"nodes": {}, "edges": []}, None, []) + for not_a_graph in not_graphs: + with pytest.raises(TypeError, match=r"^unplaced_by_links_3d: the graph is \{nodes, edges\}"): + unplaced_by_links_3d(not_a_graph, []) + with pytest.raises(ValueError, match=r"^unplaced_by_links_3d: two nodes share the id a$"): + unplaced_by_links_3d({"nodes": [{"id": "a", "type": "character"}] * 2, "edges": []}, []) + assert unplaced_by_links_3d({"nodes": [], "edges": []}, []) == [] + + def test_the_names_are_exported() -> None: - for name in ("layout_by_links_3d", "LayoutByLinks3d", "BY_LINKS_3D_REST"): + for name in ("layout_by_links_3d", "unplaced_by_links_3d", "LayoutByLinks3d", "BY_LINKS_3D_REST"): assert name in onlyworlds.__all__ assert getattr(onlyworlds, name) is not None assert BY_LINKS_3D_REST == 60.0