Skip to content

Instantly share code, notes, and snippets.

@ricbit
Last active March 18, 2018 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricbit/de75d46145b16b28ec164b9da21ca9a4 to your computer and use it in GitHub Desktop.
Save ricbit/de75d46145b16b28ec164b9da21ca9a4 to your computer and use it in GitHub Desktop.
Count paths using brute force
count[graph_, pos_, 0] := 1
count[graph_, pos_, size_] := Sum[
If[graph[[i, pos]] == 1, count[graph, i, size - 1], 0],
{i, 1, Length[graph]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment