Skip to content

Instantly share code, notes, and snippets.

@chaoxu
Created May 5, 2011 00:49
Show Gist options
  • Save chaoxu/956328 to your computer and use it in GitHub Desktop.
Save chaoxu/956328 to your computer and use it in GitHub Desktop.
Pebbling graph test
A = Import["pebble.txt", "Table"];
A = Select[A,
Function[x,
If[x[[1]] == x[[7]]
&& x[[3]] == Floor[Log[2, x[[1]]]]
&& x[[2]] < 2^(Floor[Log[2, x[[1]]]] + 1)
, True,
False
]]];
B = Table[
Diameter[
LineGraph[
FromAdjacencyMatrix[
Import["http://www.cefns.nau.edu/~ns46/pebbling/graphs/adm/g." <>
ToString[A[[i, 1]]] <> "." <> ToString[A[[i, 5]]] <> ".adm",
"Table"][[1 ;; -2]]]]], {i, 1, Length[A]}];
Fold[Or, False, [Table[
If[A[[i, 2]] < 2^B[[i]], True, False], {i, 1, Length[B]}]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment