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

Is the derivative with respect to a fermion field Grassmann-odd?

Does Nitrogen inside commercial airliner wheels prevent blowouts on touchdown?

Count Even Digits In Number

Count rotary dial pulses in a phone number (including letters)

Have 1.5% of all nuclear reactors ever built melted down?

Construct a word ladder

Can a person survive on blood in place of water?

What was the idiom for something that we take without a doubt?

Do photons bend spacetime or not?

Which melee weapons have the Two-Handed property, but lack Heavy and Special?

What is a really good book for complex variables?

Compaq Portable vs IBM 5155 Portable PC

Where can I find visible/radio telescopic observations of the center of the Milky Way galaxy?

Gladys goes shopping

Why would Ryanair allow me to book this journey through a third party, but not through their own website?

How to deal with a colleague who is being aggressive?

In general, would I need to season a meat when making a sauce?

Why is this Simple Puzzle impossible to solve?

How to use libraries with delays inside within a time critical STM32 HAL application?

Using credit/debit card details vs swiping a card in a payment (credit card) terminal

How to know if a folder is a symbolic link?

Is it rude to call a professor by their last name with no prefix in a non-academic setting?

Why did David Cameron offer a referendum on the European Union?

Is the field of q-series 'dead'?



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













16












$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 45 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 17 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$











  • $begingroup$
    @DavidC 45 was also wrong. Thanks. Fixed.
    $endgroup$
    – jimmy23013
    May 20 at 16:28















16












$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 45 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 17 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$











  • $begingroup$
    @DavidC 45 was also wrong. Thanks. Fixed.
    $endgroup$
    – jimmy23013
    May 20 at 16:28













16












16








16


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 45 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 17 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 45 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 17 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








edited May 20 at 16:27







jimmy23013

















asked May 19 at 20:25









jimmy23013jimmy23013

30k561132




30k561132











  • $begingroup$
    @DavidC 45 was also wrong. Thanks. Fixed.
    $endgroup$
    – jimmy23013
    May 20 at 16:28
















  • $begingroup$
    @DavidC 45 was also wrong. Thanks. Fixed.
    $endgroup$
    – jimmy23013
    May 20 at 16:28















$begingroup$
@DavidC 45 was also wrong. Thanks. Fixed.
$endgroup$
– jimmy23013
May 20 at 16:28




$begingroup$
@DavidC 45 was also wrong. Thanks. Fixed.
$endgroup$
– jimmy23013
May 20 at 16:28










4 Answers
4






active

oldest

votes


















7












$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
    May 19 at 23:41










  • $begingroup$
    @jimmy23013 using π is very nice :) thank you!
    $endgroup$
    – ngn
    May 19 at 23:48


















5












$begingroup$


Ruby, 79 bytes





54.timesi


Try it online!



Prints a representation of a unidirectional graph, as a list of the vertices to the right of and below each vertex as shown in the map below.



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





share|improve this answer











$endgroup$




















    3












    $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$




















      3












      $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

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        7












        $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
          May 19 at 23:41










        • $begingroup$
          @jimmy23013 using π is very nice :) thank you!
          $endgroup$
          – ngn
          May 19 at 23:48















        7












        $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
          May 19 at 23:41










        • $begingroup$
          @jimmy23013 using π is very nice :) thank you!
          $endgroup$
          – ngn
          May 19 at 23:48













        7












        7








        7





        $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 May 19 at 23:51

























        answered May 19 at 21:32









        ngnngn

        7,57612661




        7,57612661











        • $begingroup$
          4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
          $endgroup$
          – jimmy23013
          May 19 at 23:41










        • $begingroup$
          @jimmy23013 using π is very nice :) thank you!
          $endgroup$
          – ngn
          May 19 at 23:48
















        • $begingroup$
          4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
          $endgroup$
          – jimmy23013
          May 19 at 23:41










        • $begingroup$
          @jimmy23013 using π is very nice :) thank you!
          $endgroup$
          – ngn
          May 19 at 23:48















        $begingroup$
        4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
        $endgroup$
        – jimmy23013
        May 19 at 23:41




        $begingroup$
        4≥+/¨|∘.-⍨,(⍳3)∘.⌽7 ¯1∘.,○⍳3 3
        $endgroup$
        – jimmy23013
        May 19 at 23:41












        $begingroup$
        @jimmy23013 using π is very nice :) thank you!
        $endgroup$
        – ngn
        May 19 at 23:48




        $begingroup$
        @jimmy23013 using π is very nice :) thank you!
        $endgroup$
        – ngn
        May 19 at 23:48











        5












        $begingroup$


        Ruby, 79 bytes





        54.timesi


        Try it online!



        Prints a representation of a unidirectional graph, as a list of the vertices to the right of and below each vertex as shown in the map below.



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





        share|improve this answer











        $endgroup$

















          5












          $begingroup$


          Ruby, 79 bytes





          54.timesi


          Try it online!



          Prints a representation of a unidirectional graph, as a list of the vertices to the right of and below each vertex as shown in the map below.



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





          share|improve this answer











          $endgroup$















            5












            5








            5





            $begingroup$


            Ruby, 79 bytes





            54.timesi


            Try it online!



            Prints a representation of a unidirectional graph, as a list of the vertices to the right of and below each vertex as shown in the map below.



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





            share|improve this answer











            $endgroup$




            Ruby, 79 bytes





            54.timesi


            Try it online!



            Prints a representation of a unidirectional graph, as a list of the vertices to the right of and below each vertex as shown in the map below.



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






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 20 at 4:32

























            answered May 20 at 4:25









            Level River StLevel River St

            20.6k32683




            20.6k32683





















                3












                $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$

















                  3












                  $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$















                    3












                    3








                    3





                    $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 May 19 at 23:18









                    cardboard_boxcardboard_box

                    4,1751431




                    4,1751431





















                        3












                        $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$

















                          3












                          $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$















                            3












                            3








                            3





                            $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 May 19 at 23:45









                            NeilNeil

                            84.6k845182




                            84.6k845182



























                                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

                                Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                                Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                                Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form