Skip to main content
deleted 3 characters in body
Source Link
Adam
  • 4k
  • 7
  • 24

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

With \[And], \[Not] and \[Function] counted as one character, I count 149 characters when removing the unnecessary whitespace (all whitespaces).

I swear it worked immediately on my computer :)

all graphs

Test with Or @@ IsomorphicGraphQ @@@ Subsets[%109Subsets[%, {2}]

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

With \[And], \[Not] and \[Function] counted as one character, I count 149 characters when removing the unnecessary whitespace (all whitespaces).

I swear it worked immediately on my computer :)

all graphs

Test with Or @@ IsomorphicGraphQ @@@ Subsets[%109, {2}]

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

With \[And], \[Not] and \[Function] counted as one character, I count 149 characters when removing the unnecessary whitespace (all whitespaces).

I swear it worked immediately on my computer :)

all graphs

Test with Or @@ IsomorphicGraphQ @@@ Subsets[%, {2}]

add testing function
Source Link
Adam
  • 4k
  • 7
  • 24

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

With \[And], \[Not] and \[Function] counted as one character, I count 149 characters when removing the unnecessary whitespace (all whitespaces).

I swear it worked immediately on my computer :)

all graphs

Test with Or @@ IsomorphicGraphQ @@@ Subsets[%109, {2}]

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

I swear it worked immediately on my computer :)

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

With \[And], \[Not] and \[Function] counted as one character, I count 149 characters when removing the unnecessary whitespace (all whitespaces).

I swear it worked immediately on my computer :)

all graphs

Test with Or @@ IsomorphicGraphQ @@@ Subsets[%109, {2}]

Source Link
Adam
  • 4k
  • 7
  • 24

Brute force, and nondeterministic

NestWhile[l \[Function] 
 If[
    FreeQ[VertexDegree@#, 2] \[And]
    TreeGraphQ@# \[And] 
    And @@ Table[\[Not] IsomorphicGraphQ[G, #], {G, l}]
  ,l~Append~#,l
 ] &@RandomGraph@{10, 9}
, {}, Length@# < 10 &]

I swear it worked immediately on my computer :)