|
23 | 23 | {{1, 2, 3}, {3, 4, 5}, {1, 2, 3, 4}}
|
24 | 24 | };
|
25 | 25 |
|
| 26 | + {$minArrowheadSize, $maxArrowheadSize} = |
| 27 | + WolframPhysicsProjectStyleData["SpatialGraph", "ArrowheadLengthFunction"][ |
| 28 | + <|"PlotRange" -> #|>] & /@ {0, 1.*^100}; |
| 29 | + |
26 | 30 | $selfLoopLength = FirstCase[
|
27 | 31 | WolframModelPlot[{{1, 1}}, "HyperedgeRendering" -> "Subgraphs"],
|
28 | 32 | Line[pts_] :> RegionMeasure[Line[pts]],
|
|
293 | 297 | ]
|
294 | 298 | } & /@ {VertexSize, "ArrowheadLength"},
|
295 | 299 |
|
| 300 | + VerificationTest[ |
| 301 | + Head[WolframModelPlot[#, "ArrowheadLength" -> Automatic]], |
| 302 | + Graphics |
| 303 | + ] & /@ {{{1, 2, 3}, {3, 4, 5}}, {{1, 1}}, {{1}}, {}}, |
| 304 | + |
296 | 305 | (* HypergraphPlot can still be used *)
|
297 | 306 |
|
298 | 307 | VerificationTest[
|
|
598 | 607 | {{{1, 2}}, {{1, 2, 3}}, {{1, 2, 3}, {3, 4, 5}}, RandomInteger[10, {5, 5}]})
|
599 | 608 | ],
|
600 | 609 |
|
601 |
| - VerificationTest[ |
602 |
| - Equal @@ ( |
603 |
| - Mean[Cases[ |
604 |
| - WolframModelPlot[#, "HyperedgeRendering" -> "Subgraphs"], |
605 |
| - Line[pts_] :> EuclideanDistance @@ pts, |
606 |
| - All]] & /@ |
607 |
| - {{{1, 2}}, {{1, 2, 3}}, {{1, 2, 3}, {3, 4, 5}}, {{1, 2, 3}, {3, 4, 5}, {5, 6, 1}}, {{1, 2, 3, 4, 5, 1}}}) |
608 |
| - ], |
609 |
| - |
610 |
| - VerificationTest[ |
611 |
| - Abs[ |
612 |
| - First[ |
613 |
| - Nearest[ |
614 |
| - Cases[ |
615 |
| - WolframModelPlot[#, "HyperedgeRendering" -> "Subgraphs"], |
616 |
| - Line[pts_] :> RegionMeasure[Line[pts]], |
617 |
| - All], |
618 |
| - $selfLoopLength]] - |
619 |
| - $selfLoopLength] < |
620 |
| - 1.*^-10 |
621 |
| - ] & /@ { |
622 |
| - {{1, 1}}, |
623 |
| - {{1, 2, 3}, {1, 1}}, |
624 |
| - {{1, 2, 3}, {3, 4, 5}, {5, 5}}, |
625 |
| - {{1, 2, 3}, {3, 4, 5}, {5, 6, 1, 1}}, |
626 |
| - {{1, 2, 3, 4, 5, 5, 1}}}, |
| 610 | + With[{$minArrowheadSize = $minArrowheadSize, $maxArrowheadSize = $maxArrowheadSize}, |
| 611 | + VerificationTest[ |
| 612 | + Length[DeleteDuplicates[ |
| 613 | + Mean[Cases[ |
| 614 | + WolframModelPlot[#, "HyperedgeRendering" -> "Subgraphs"], |
| 615 | + Line[pts_] :> EuclideanDistance @@ pts, |
| 616 | + All]] & /@ |
| 617 | + {{{1, 2}}, {{1, 2, 3}}, {{1, 2, 3}, {3, 4, 5}}, {{1, 2, 3}, {3, 4, 5}, {5, 6, 1}}, {{1, 2, 3, 4, 5, 1}}}, |
| 618 | + #2 - #1 <= $maxArrowheadSize - $minArrowheadSize &]] == 1 |
| 619 | + ]], |
| 620 | + |
| 621 | + With[{ |
| 622 | + $minArrowheadSize = $minArrowheadSize, $maxArrowheadSize = $maxArrowheadSize, $selfLoopLength = $selfLoopLength}, |
| 623 | + VerificationTest[ |
| 624 | + Abs[ |
| 625 | + First[ |
| 626 | + Nearest[ |
| 627 | + Cases[ |
| 628 | + WolframModelPlot[#, "HyperedgeRendering" -> "Subgraphs"], |
| 629 | + Line[pts_] :> RegionMeasure[Line[pts]], |
| 630 | + All], |
| 631 | + $selfLoopLength]] - |
| 632 | + $selfLoopLength] < |
| 633 | + $maxArrowheadSize - $minArrowheadSize |
| 634 | + ] & /@ { |
| 635 | + {{1, 1}}, |
| 636 | + {{1, 2, 3}, {1, 1}}, |
| 637 | + {{1, 2, 3}, {3, 4, 5}, {5, 5}}, |
| 638 | + {{1, 2, 3}, {3, 4, 5}, {5, 6, 1, 1}}, |
| 639 | + {{1, 2, 3, 4, 5, 5, 1}}}], |
627 | 640 |
|
628 | 641 | (* Automatic image size *)
|
629 | 642 | VerificationTest[
|
|
0 commit comments