Surface of the 3x3x3 cube as a graphFind the Chromatic NumberEdge Elimination NumberUndirect a GraphIs My Graph Planar?Strongly Connected ComponentsFind a dual graphFind a set of maximal matching edgesCalculate TreewidthDetermine if a Graph is ToroidalConstruct a line graph / conjugate graph

How to safely discharge oneself

Department head said that group project may be rejected. How to mitigate?

If a character has cast the Fly spell on themselves, can they "hand off" to the Levitate spell without interruption?

Gas chromatography flame ionization detector (FID) - why hydrogen gas?

Is ideal gas incompressible?

Is there a linguistic basses for how to translate John 8:43, or are translations basing their translation on context alone?

Meaning of "half-crown enclosure"

Can a UK national work as a paid shop assistant in the USA?

How did the Allies achieve air superiority on Sicily?

Is it normal to "extract a paper" from a master thesis?

Way of refund if scammed?

Why the work done is positive when bringing 2 opposite charges together?

Can diplomats be allowed on the flight deck of a commercial European airline?

Does attacking (or having a rider attack) cancel Charge/Pounce-like abilities?

Why is this python script running in background consuming 100 % CPU?

Can the Conjure Barrage spell stack with the Disarming Attack or Trip Attack Battle Master maneuvers?

How to tease a romance without a cat and mouse chase?

If change in free energy (G) is positive, how do those reactions still occur?

Is it safe to redirect stdout and stderr to the same file without file descriptor copies?

Sony VAIO Duo 13 Wifi not working on Ubuntu 16.04

What is this dime sized black bug with white on the segments near Loveland Colorodao?

A nasty indefinite integral

Variable does not Exist: CaseTrigger

Why "strap-on" boosters, and how do other people say it?



Surface of the 3x3x3 cube as a graph


Find the Chromatic NumberEdge Elimination NumberUndirect a GraphIs My Graph Planar?Strongly Connected ComponentsFind a dual graphFind a set of maximal matching edgesCalculate TreewidthDetermine if a Graph is ToroidalConstruct a line graph / conjugate graph













7












$begingroup$


Your task is to generate a graph with 54 vertices, each corresponds to a facet on a Rubik's cube. There is an edge between two vertices iff the corresponding facets share a side.



Rules



  • You may choose to output an adjacency list, adjacency matrix, edge list, or any reasonable format to represent a graph in an algorithm. (A visual graph readable by a human is generally not a reasonable format in an algorithm in most cases.)

  • You may make either every vertex adjacent to itself, or none adjacent to itself.

  • You may either include both directions for each edge (count one or two times for self-loops), or output exactly one time for each edge, but not mix the ways.

  • You may renumber the vertices, skip some numbers, or even use non-number labels for the vertices in any way you want. You should also post the numbering if it isn't obvious, so others could check your answer in easier ways.

  • This is code-golf. Shortest code in bytes wins.

Example output



This is the numbering of vertices used in the example:



 0 1 2
3 4 5
6 7 8
9 10 11 18 19 20 27 28 29 36 37 38
12 13 14 21 22 23 30 31 32 39 40 41
15 16 17 24 25 26 33 34 35 42 43 44
45 46 47
48 49 50
51 52 53


Output as an adjacency list (vertex number before each list is optional):



0 [1 3 9 38]
1 [2 4 0 37]
2 [29 5 1 36]
3 [4 6 10 0]
4 [5 7 3 1]
5 [28 8 4 2]
6 [7 18 11 3]
7 [8 19 6 4]
8 [27 20 7 5]
9 [10 12 38 0]
10 [11 13 9 3]
11 [18 14 10 6]
12 [13 15 41 9]
13 [14 16 12 10]
14 [21 17 13 11]
15 [16 51 44 12]
16 [17 48 15 13]
17 [24 17 16 14]
18 [19 21 11 6]
19 [20 22 18 7]
20 [27 23 19 8]
21 [22 24 14 18]
22 [23 25 21 19]
23 [30 26 22 20]
24 [25 45 17 21]
25 [26 46 24 22]
26 [33 47 25 23]
27 [28 30 20 8]
28 [29 31 27 5]
29 [36 32 28 2]
30 [31 33 23 27]
31 [32 34 30 28]
32 [39 35 31 29]
33 [34 47 26 30]
34 [35 50 33 31]
35 [42 53 34 32]
36 [37 39 29 2]
37 [38 40 36 1]
38 [9 41 37 0]
39 [40 42 32 36]
40 [41 43 39 37]
41 [12 44 40 38]
42 [43 53 35 39]
43 [44 52 42 40]
44 [15 51 43 41]
45 [46 48 45 24]
46 [47 49 45 25]
47 [33 50 46 26]
48 [49 51 16 45]
49 [50 52 48 46]
50 [34 53 49 47]
51 [52 44 15 48]
52 [53 43 51 49]
53 [35 42 52 50]









share|improve this question









$endgroup$
















    7












    $begingroup$


    Your task is to generate a graph with 54 vertices, each corresponds to a facet on a Rubik's cube. There is an edge between two vertices iff the corresponding facets share a side.



    Rules



    • You may choose to output an adjacency list, adjacency matrix, edge list, or any reasonable format to represent a graph in an algorithm. (A visual graph readable by a human is generally not a reasonable format in an algorithm in most cases.)

    • You may make either every vertex adjacent to itself, or none adjacent to itself.

    • You may either include both directions for each edge (count one or two times for self-loops), or output exactly one time for each edge, but not mix the ways.

    • You may renumber the vertices, skip some numbers, or even use non-number labels for the vertices in any way you want. You should also post the numbering if it isn't obvious, so others could check your answer in easier ways.

    • This is code-golf. Shortest code in bytes wins.

    Example output



    This is the numbering of vertices used in the example:



     0 1 2
    3 4 5
    6 7 8
    9 10 11 18 19 20 27 28 29 36 37 38
    12 13 14 21 22 23 30 31 32 39 40 41
    15 16 17 24 25 26 33 34 35 42 43 44
    45 46 47
    48 49 50
    51 52 53


    Output as an adjacency list (vertex number before each list is optional):



    0 [1 3 9 38]
    1 [2 4 0 37]
    2 [29 5 1 36]
    3 [4 6 10 0]
    4 [5 7 3 1]
    5 [28 8 4 2]
    6 [7 18 11 3]
    7 [8 19 6 4]
    8 [27 20 7 5]
    9 [10 12 38 0]
    10 [11 13 9 3]
    11 [18 14 10 6]
    12 [13 15 41 9]
    13 [14 16 12 10]
    14 [21 17 13 11]
    15 [16 51 44 12]
    16 [17 48 15 13]
    17 [24 17 16 14]
    18 [19 21 11 6]
    19 [20 22 18 7]
    20 [27 23 19 8]
    21 [22 24 14 18]
    22 [23 25 21 19]
    23 [30 26 22 20]
    24 [25 45 17 21]
    25 [26 46 24 22]
    26 [33 47 25 23]
    27 [28 30 20 8]
    28 [29 31 27 5]
    29 [36 32 28 2]
    30 [31 33 23 27]
    31 [32 34 30 28]
    32 [39 35 31 29]
    33 [34 47 26 30]
    34 [35 50 33 31]
    35 [42 53 34 32]
    36 [37 39 29 2]
    37 [38 40 36 1]
    38 [9 41 37 0]
    39 [40 42 32 36]
    40 [41 43 39 37]
    41 [12 44 40 38]
    42 [43 53 35 39]
    43 [44 52 42 40]
    44 [15 51 43 41]
    45 [46 48 45 24]
    46 [47 49 45 25]
    47 [33 50 46 26]
    48 [49 51 16 45]
    49 [50 52 48 46]
    50 [34 53 49 47]
    51 [52 44 15 48]
    52 [53 43 51 49]
    53 [35 42 52 50]









    share|improve this question









    $endgroup$














      7












      7








      7


      1



      $begingroup$


      Your task is to generate a graph with 54 vertices, each corresponds to a facet on a Rubik's cube. There is an edge between two vertices iff the corresponding facets share a side.



      Rules



      • You may choose to output an adjacency list, adjacency matrix, edge list, or any reasonable format to represent a graph in an algorithm. (A visual graph readable by a human is generally not a reasonable format in an algorithm in most cases.)

      • You may make either every vertex adjacent to itself, or none adjacent to itself.

      • You may either include both directions for each edge (count one or two times for self-loops), or output exactly one time for each edge, but not mix the ways.

      • You may renumber the vertices, skip some numbers, or even use non-number labels for the vertices in any way you want. You should also post the numbering if it isn't obvious, so others could check your answer in easier ways.

      • This is code-golf. Shortest code in bytes wins.

      Example output



      This is the numbering of vertices used in the example:



       0 1 2
      3 4 5
      6 7 8
      9 10 11 18 19 20 27 28 29 36 37 38
      12 13 14 21 22 23 30 31 32 39 40 41
      15 16 17 24 25 26 33 34 35 42 43 44
      45 46 47
      48 49 50
      51 52 53


      Output as an adjacency list (vertex number before each list is optional):



      0 [1 3 9 38]
      1 [2 4 0 37]
      2 [29 5 1 36]
      3 [4 6 10 0]
      4 [5 7 3 1]
      5 [28 8 4 2]
      6 [7 18 11 3]
      7 [8 19 6 4]
      8 [27 20 7 5]
      9 [10 12 38 0]
      10 [11 13 9 3]
      11 [18 14 10 6]
      12 [13 15 41 9]
      13 [14 16 12 10]
      14 [21 17 13 11]
      15 [16 51 44 12]
      16 [17 48 15 13]
      17 [24 17 16 14]
      18 [19 21 11 6]
      19 [20 22 18 7]
      20 [27 23 19 8]
      21 [22 24 14 18]
      22 [23 25 21 19]
      23 [30 26 22 20]
      24 [25 45 17 21]
      25 [26 46 24 22]
      26 [33 47 25 23]
      27 [28 30 20 8]
      28 [29 31 27 5]
      29 [36 32 28 2]
      30 [31 33 23 27]
      31 [32 34 30 28]
      32 [39 35 31 29]
      33 [34 47 26 30]
      34 [35 50 33 31]
      35 [42 53 34 32]
      36 [37 39 29 2]
      37 [38 40 36 1]
      38 [9 41 37 0]
      39 [40 42 32 36]
      40 [41 43 39 37]
      41 [12 44 40 38]
      42 [43 53 35 39]
      43 [44 52 42 40]
      44 [15 51 43 41]
      45 [46 48 45 24]
      46 [47 49 45 25]
      47 [33 50 46 26]
      48 [49 51 16 45]
      49 [50 52 48 46]
      50 [34 53 49 47]
      51 [52 44 15 48]
      52 [53 43 51 49]
      53 [35 42 52 50]









      share|improve this question









      $endgroup$




      Your task is to generate a graph with 54 vertices, each corresponds to a facet on a Rubik's cube. There is an edge between two vertices iff the corresponding facets share a side.



      Rules



      • You may choose to output an adjacency list, adjacency matrix, edge list, or any reasonable format to represent a graph in an algorithm. (A visual graph readable by a human is generally not a reasonable format in an algorithm in most cases.)

      • You may make either every vertex adjacent to itself, or none adjacent to itself.

      • You may either include both directions for each edge (count one or two times for self-loops), or output exactly one time for each edge, but not mix the ways.

      • You may renumber the vertices, skip some numbers, or even use non-number labels for the vertices in any way you want. You should also post the numbering if it isn't obvious, so others could check your answer in easier ways.

      • This is code-golf. Shortest code in bytes wins.

      Example output



      This is the numbering of vertices used in the example:



       0 1 2
      3 4 5
      6 7 8
      9 10 11 18 19 20 27 28 29 36 37 38
      12 13 14 21 22 23 30 31 32 39 40 41
      15 16 17 24 25 26 33 34 35 42 43 44
      45 46 47
      48 49 50
      51 52 53


      Output as an adjacency list (vertex number before each list is optional):



      0 [1 3 9 38]
      1 [2 4 0 37]
      2 [29 5 1 36]
      3 [4 6 10 0]
      4 [5 7 3 1]
      5 [28 8 4 2]
      6 [7 18 11 3]
      7 [8 19 6 4]
      8 [27 20 7 5]
      9 [10 12 38 0]
      10 [11 13 9 3]
      11 [18 14 10 6]
      12 [13 15 41 9]
      13 [14 16 12 10]
      14 [21 17 13 11]
      15 [16 51 44 12]
      16 [17 48 15 13]
      17 [24 17 16 14]
      18 [19 21 11 6]
      19 [20 22 18 7]
      20 [27 23 19 8]
      21 [22 24 14 18]
      22 [23 25 21 19]
      23 [30 26 22 20]
      24 [25 45 17 21]
      25 [26 46 24 22]
      26 [33 47 25 23]
      27 [28 30 20 8]
      28 [29 31 27 5]
      29 [36 32 28 2]
      30 [31 33 23 27]
      31 [32 34 30 28]
      32 [39 35 31 29]
      33 [34 47 26 30]
      34 [35 50 33 31]
      35 [42 53 34 32]
      36 [37 39 29 2]
      37 [38 40 36 1]
      38 [9 41 37 0]
      39 [40 42 32 36]
      40 [41 43 39 37]
      41 [12 44 40 38]
      42 [43 53 35 39]
      43 [44 52 42 40]
      44 [15 51 43 41]
      45 [46 48 45 24]
      46 [47 49 45 25]
      47 [33 50 46 26]
      48 [49 51 16 45]
      49 [50 52 48 46]
      50 [34 53 49 47]
      51 [52 44 15 48]
      52 [53 43 51 49]
      53 [35 42 52 50]






      code-golf kolmogorov-complexity graph-theory rubiks-cube






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      jimmy23013jimmy23013

      30k561130




      30k561130




















          3 Answers
          3






          active

          oldest

          votes


















          3












          $begingroup$


          APL (Dyalog Classic), 34 30 bytes



          -4 thanks to jimmy23013





          4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3


          Try it online!



          outputs an adjacency matrix with each vertex adjacent to itself



          ⍳3 3 generate an array of (0 0)(0 1)(0 2)(1 0)(1 1)(1 2)(2 0)(2 1)(2 2)



          multiply all by π



          7 ¯1∘., prepend 7 or -1 in all possible ways



          (⍳3)∘.⌽ rotate coord triples by 0 1 2 steps in all possible ways



          +/¨|∘.-⍨, compute manhattan distance between each pair



          4≥ it must be no greater than 4 for neighbouring facets






          share|improve this answer











          $endgroup$












          • $begingroup$
            4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
            $endgroup$
            – jimmy23013
            42 mins ago










          • $begingroup$
            4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
            $endgroup$
            – jimmy23013
            38 mins ago










          • $begingroup$
            @jimmy23013 using π is very nice :) thank you!
            $endgroup$
            – ngn
            32 mins ago


















          1












          $begingroup$

          Python 2.7, 145



          def p(n):l=(3-n%2*6,n/6%3*2-2,n/18*2-2);k=n/2%3;return l[k:]+l[:k]
          r=range(54)
          x=[[sum((x-y)**2for x,y in zip(p(i),p(j)))<5for i in r]for j in r]


          Try it online!



          Defines an adjacency matrix x as a list of lists of boolean values. Facets count as being adjacent to themselves.



          p(n) computes the coordinates of the center of the nth facet of a 3x3x3 cube whose facets are 2 units across. Adjacency is determined by testing if 2 facets have a square distance under 5 (adjacent facets have square distance at most 4, non-adjacent facets have square distance at least 6).






          share|improve this answer









          $endgroup$




















            0












            $begingroup$


            Charcoal, 48 bytes



            F⁷F⁷F⁷⊞υ⟦ικλ⟧≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υIEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


            Try it online! Link is to verbose version of code. Explanation:



            F⁷F⁷F⁷⊞υ⟦ικλ⟧


            Generate all sets of 3-dimensional coordinates in the range [0..6] for each dimension.



            ≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υ


            Keep only those coordinates that are centres of 2x2 squares on one of the faces x=0, y=0, z=0, x=6, y=6, z=6.



            IEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


            For each coordinate, print the indices of those coordinates whose taxicab distance is 2.



            The vertices are numbered as follows:



             33 34 35
            21 22 23
            9 10 11
            36 24 12 0 1 2 13 25 37 47 46 45
            38 26 14 3 4 5 15 27 39 50 49 48
            40 28 16 6 7 8 17 29 41 53 52 51
            18 19 20
            30 31 32
            42 43 44





            share|improve this answer









            $endgroup$













              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "200"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f185807%2fsurface-of-the-3x3x3-cube-as-a-graph%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3












              $begingroup$


              APL (Dyalog Classic), 34 30 bytes



              -4 thanks to jimmy23013





              4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3


              Try it online!



              outputs an adjacency matrix with each vertex adjacent to itself



              ⍳3 3 generate an array of (0 0)(0 1)(0 2)(1 0)(1 1)(1 2)(2 0)(2 1)(2 2)



              multiply all by π



              7 ¯1∘., prepend 7 or -1 in all possible ways



              (⍳3)∘.⌽ rotate coord triples by 0 1 2 steps in all possible ways



              +/¨|∘.-⍨, compute manhattan distance between each pair



              4≥ it must be no greater than 4 for neighbouring facets






              share|improve this answer











              $endgroup$












              • $begingroup$
                4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                42 mins ago










              • $begingroup$
                4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                38 mins ago










              • $begingroup$
                @jimmy23013 using π is very nice :) thank you!
                $endgroup$
                – ngn
                32 mins ago















              3












              $begingroup$


              APL (Dyalog Classic), 34 30 bytes



              -4 thanks to jimmy23013





              4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3


              Try it online!



              outputs an adjacency matrix with each vertex adjacent to itself



              ⍳3 3 generate an array of (0 0)(0 1)(0 2)(1 0)(1 1)(1 2)(2 0)(2 1)(2 2)



              multiply all by π



              7 ¯1∘., prepend 7 or -1 in all possible ways



              (⍳3)∘.⌽ rotate coord triples by 0 1 2 steps in all possible ways



              +/¨|∘.-⍨, compute manhattan distance between each pair



              4≥ it must be no greater than 4 for neighbouring facets






              share|improve this answer











              $endgroup$












              • $begingroup$
                4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                42 mins ago










              • $begingroup$
                4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                38 mins ago










              • $begingroup$
                @jimmy23013 using π is very nice :) thank you!
                $endgroup$
                – ngn
                32 mins ago













              3












              3








              3





              $begingroup$


              APL (Dyalog Classic), 34 30 bytes



              -4 thanks to jimmy23013





              4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3


              Try it online!



              outputs an adjacency matrix with each vertex adjacent to itself



              ⍳3 3 generate an array of (0 0)(0 1)(0 2)(1 0)(1 1)(1 2)(2 0)(2 1)(2 2)



              multiply all by π



              7 ¯1∘., prepend 7 or -1 in all possible ways



              (⍳3)∘.⌽ rotate coord triples by 0 1 2 steps in all possible ways



              +/¨|∘.-⍨, compute manhattan distance between each pair



              4≥ it must be no greater than 4 for neighbouring facets






              share|improve this answer











              $endgroup$




              APL (Dyalog Classic), 34 30 bytes



              -4 thanks to jimmy23013





              4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3


              Try it online!



              outputs an adjacency matrix with each vertex adjacent to itself



              ⍳3 3 generate an array of (0 0)(0 1)(0 2)(1 0)(1 1)(1 2)(2 0)(2 1)(2 2)



              multiply all by π



              7 ¯1∘., prepend 7 or -1 in all possible ways



              (⍳3)∘.⌽ rotate coord triples by 0 1 2 steps in all possible ways



              +/¨|∘.-⍨, compute manhattan distance between each pair



              4≥ it must be no greater than 4 for neighbouring facets







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 29 mins ago

























              answered 2 hours ago









              ngnngn

              7,51112661




              7,51112661











              • $begingroup$
                4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                42 mins ago










              • $begingroup$
                4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                38 mins ago










              • $begingroup$
                @jimmy23013 using π is very nice :) thank you!
                $endgroup$
                – ngn
                32 mins ago
















              • $begingroup$
                4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                42 mins ago










              • $begingroup$
                4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
                $endgroup$
                – jimmy23013
                38 mins ago










              • $begingroup$
                @jimmy23013 using π is very nice :) thank you!
                $endgroup$
                – ngn
                32 mins ago















              $begingroup$
              4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
              $endgroup$
              – jimmy23013
              42 mins ago




              $begingroup$
              4≥∘.(+/∘|-)⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
              $endgroup$
              – jimmy23013
              42 mins ago












              $begingroup$
              4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
              $endgroup$
              – jimmy23013
              38 mins ago




              $begingroup$
              4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
              $endgroup$
              – jimmy23013
              38 mins ago












              $begingroup$
              @jimmy23013 using π is very nice :) thank you!
              $endgroup$
              – ngn
              32 mins ago




              $begingroup$
              @jimmy23013 using π is very nice :) thank you!
              $endgroup$
              – ngn
              32 mins ago











              1












              $begingroup$

              Python 2.7, 145



              def p(n):l=(3-n%2*6,n/6%3*2-2,n/18*2-2);k=n/2%3;return l[k:]+l[:k]
              r=range(54)
              x=[[sum((x-y)**2for x,y in zip(p(i),p(j)))<5for i in r]for j in r]


              Try it online!



              Defines an adjacency matrix x as a list of lists of boolean values. Facets count as being adjacent to themselves.



              p(n) computes the coordinates of the center of the nth facet of a 3x3x3 cube whose facets are 2 units across. Adjacency is determined by testing if 2 facets have a square distance under 5 (adjacent facets have square distance at most 4, non-adjacent facets have square distance at least 6).






              share|improve this answer









              $endgroup$

















                1












                $begingroup$

                Python 2.7, 145



                def p(n):l=(3-n%2*6,n/6%3*2-2,n/18*2-2);k=n/2%3;return l[k:]+l[:k]
                r=range(54)
                x=[[sum((x-y)**2for x,y in zip(p(i),p(j)))<5for i in r]for j in r]


                Try it online!



                Defines an adjacency matrix x as a list of lists of boolean values. Facets count as being adjacent to themselves.



                p(n) computes the coordinates of the center of the nth facet of a 3x3x3 cube whose facets are 2 units across. Adjacency is determined by testing if 2 facets have a square distance under 5 (adjacent facets have square distance at most 4, non-adjacent facets have square distance at least 6).






                share|improve this answer









                $endgroup$















                  1












                  1








                  1





                  $begingroup$

                  Python 2.7, 145



                  def p(n):l=(3-n%2*6,n/6%3*2-2,n/18*2-2);k=n/2%3;return l[k:]+l[:k]
                  r=range(54)
                  x=[[sum((x-y)**2for x,y in zip(p(i),p(j)))<5for i in r]for j in r]


                  Try it online!



                  Defines an adjacency matrix x as a list of lists of boolean values. Facets count as being adjacent to themselves.



                  p(n) computes the coordinates of the center of the nth facet of a 3x3x3 cube whose facets are 2 units across. Adjacency is determined by testing if 2 facets have a square distance under 5 (adjacent facets have square distance at most 4, non-adjacent facets have square distance at least 6).






                  share|improve this answer









                  $endgroup$



                  Python 2.7, 145



                  def p(n):l=(3-n%2*6,n/6%3*2-2,n/18*2-2);k=n/2%3;return l[k:]+l[:k]
                  r=range(54)
                  x=[[sum((x-y)**2for x,y in zip(p(i),p(j)))<5for i in r]for j in r]


                  Try it online!



                  Defines an adjacency matrix x as a list of lists of boolean values. Facets count as being adjacent to themselves.



                  p(n) computes the coordinates of the center of the nth facet of a 3x3x3 cube whose facets are 2 units across. Adjacency is determined by testing if 2 facets have a square distance under 5 (adjacent facets have square distance at most 4, non-adjacent facets have square distance at least 6).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  cardboard_boxcardboard_box

                  4,0351430




                  4,0351430





















                      0












                      $begingroup$


                      Charcoal, 48 bytes



                      F⁷F⁷F⁷⊞υ⟦ικλ⟧≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υIEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                      Try it online! Link is to verbose version of code. Explanation:



                      F⁷F⁷F⁷⊞υ⟦ικλ⟧


                      Generate all sets of 3-dimensional coordinates in the range [0..6] for each dimension.



                      ≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υ


                      Keep only those coordinates that are centres of 2x2 squares on one of the faces x=0, y=0, z=0, x=6, y=6, z=6.



                      IEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                      For each coordinate, print the indices of those coordinates whose taxicab distance is 2.



                      The vertices are numbered as follows:



                       33 34 35
                      21 22 23
                      9 10 11
                      36 24 12 0 1 2 13 25 37 47 46 45
                      38 26 14 3 4 5 15 27 39 50 49 48
                      40 28 16 6 7 8 17 29 41 53 52 51
                      18 19 20
                      30 31 32
                      42 43 44





                      share|improve this answer









                      $endgroup$

















                        0












                        $begingroup$


                        Charcoal, 48 bytes



                        F⁷F⁷F⁷⊞υ⟦ικλ⟧≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υIEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                        Try it online! Link is to verbose version of code. Explanation:



                        F⁷F⁷F⁷⊞υ⟦ικλ⟧


                        Generate all sets of 3-dimensional coordinates in the range [0..6] for each dimension.



                        ≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υ


                        Keep only those coordinates that are centres of 2x2 squares on one of the faces x=0, y=0, z=0, x=6, y=6, z=6.



                        IEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                        For each coordinate, print the indices of those coordinates whose taxicab distance is 2.



                        The vertices are numbered as follows:



                         33 34 35
                        21 22 23
                        9 10 11
                        36 24 12 0 1 2 13 25 37 47 46 45
                        38 26 14 3 4 5 15 27 39 50 49 48
                        40 28 16 6 7 8 17 29 41 53 52 51
                        18 19 20
                        30 31 32
                        42 43 44





                        share|improve this answer









                        $endgroup$















                          0












                          0








                          0





                          $begingroup$


                          Charcoal, 48 bytes



                          F⁷F⁷F⁷⊞υ⟦ικλ⟧≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υIEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                          Try it online! Link is to verbose version of code. Explanation:



                          F⁷F⁷F⁷⊞υ⟦ικλ⟧


                          Generate all sets of 3-dimensional coordinates in the range [0..6] for each dimension.



                          ≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υ


                          Keep only those coordinates that are centres of 2x2 squares on one of the faces x=0, y=0, z=0, x=6, y=6, z=6.



                          IEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                          For each coordinate, print the indices of those coordinates whose taxicab distance is 2.



                          The vertices are numbered as follows:



                           33 34 35
                          21 22 23
                          9 10 11
                          36 24 12 0 1 2 13 25 37 47 46 45
                          38 26 14 3 4 5 15 27 39 50 49 48
                          40 28 16 6 7 8 17 29 41 53 52 51
                          18 19 20
                          30 31 32
                          42 43 44





                          share|improve this answer









                          $endgroup$




                          Charcoal, 48 bytes



                          F⁷F⁷F⁷⊞υ⟦ικλ⟧≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υIEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                          Try it online! Link is to verbose version of code. Explanation:



                          F⁷F⁷F⁷⊞υ⟦ικλ⟧


                          Generate all sets of 3-dimensional coordinates in the range [0..6] for each dimension.



                          ≔Φυ⁼Φ﹪ι⁶¬﹪λ²⟦⁰⟧υ


                          Keep only those coordinates that are centres of 2x2 squares on one of the faces x=0, y=0, z=0, x=6, y=6, z=6.



                          IEυΦLυ⁼²ΣE§υλ↔⁻ν§ιξ


                          For each coordinate, print the indices of those coordinates whose taxicab distance is 2.



                          The vertices are numbered as follows:



                           33 34 35
                          21 22 23
                          9 10 11
                          36 24 12 0 1 2 13 25 37 47 46 45
                          38 26 14 3 4 5 15 27 39 50 49 48
                          40 28 16 6 7 8 17 29 41 53 52 51
                          18 19 20
                          30 31 32
                          42 43 44






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 34 mins ago









                          NeilNeil

                          84.1k845182




                          84.1k845182



























                              draft saved

                              draft discarded
















































                              If this is an answer to a challenge…



                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                Explanations of your answer make it more interesting to read and are very much encouraged.


                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                              More generally…



                              • …Please make sure to answer the question and provide sufficient detail.


                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f185807%2fsurface-of-the-3x3x3-cube-as-a-graph%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

                              The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

                              19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу