Questions tagged [enumeration]

This tag covers algorithms that enumerate some set, whether finite or infinite. Do not use it for questions about computability classes, such as recursively enumerable (RE) sets; use tags [computability] and [semi-decidability] for these.

This tag covers algorithms that enumerate some set, whether finite or infinite.

Do not use it for questions about computability classes, such as recursively enumerable (RE) sets; use tags and for these.

177 questions
30
votes
2 answers

Why are the total functions not enumerable?

We learned about the concept of enumerations of functions. In practice, they correspond to programming languages. In a passing remark, the professor mentioned that the class of all total functions (i.e. the functions that always terminate for every…
Raphael
  • 73,212
  • 30
  • 182
  • 400
21
votes
1 answer

Find the Simple Cycles in a Directed Graph

This problem, for me, looks very interesting. It was about to find a simple cycle (i.e. cycle where are not repeat nodes) in a directed graph. My solution is going like this, i.e, this graph is a case problem: I know that there is a cycle in a…
Jonathan Prieto-Cubides
  • 2,229
  • 3
  • 18
  • 26
16
votes
1 answer

Complexity classes pertaining to listing all solutions?

I was reading a question over at Stack Overflow asking whether it was NP-hard to list all simple cycles in a graph containing a particular node and it occurred to me that I couldn't think of any existing complexity class that was well-suited for…
13
votes
8 answers

Can any known sub-Turing-complete model of computation enumerate precisely the set of prime numbers?

I wish there were more, but the subject pretty much captures my whole question. Is there a non-Turing-complete model (some constrained term rewriting system or automaton or what have you) which is known to be able to enumerate the prime numbers, all…
Trev
  • 316
  • 2
  • 10
12
votes
3 answers

How fast can we find all Four-Square combinations that sum to N?

A question was asked at Stack Overflow here: Given an integer $N$, print out all possible combinations of integer values of $A,B,C$ and $D$ which solve the equation $A^2+B^2+C^2+D^2 = N$. This question is of course related to Bachet's Conjecture…
11
votes
1 answer

Average length of s-t (simple) paths in a directed graph

Given the fact that $s$-$t$ path enumeration is a #P-complete problem, could there be efficient methods that compute (or at least approximate) the average length of $s$-$t$ path without enumerating them? What if paths are allowed to revisit…
10
votes
2 answers

Why are computable numbers (in Turing's sense) enumerable?

Why are computable numbers (in Turing's sense) enumerable? It must be very obvious, but I'm currently just not seeing it.
Michiel Borkent
  • 233
  • 1
  • 7
8
votes
0 answers

What is the best algorithm to compute ALL homomorphisms between two rooted labeled trees?

Lets consider two node-labeled rooted trees Q and D. According to wikipedia definition ( https://en.wikipedia.org/wiki/Tree_homomorphism ) a mapping m from the nodes of Q to the nodes of D is a tree homomorphism iff : m maps the root of Q to the…
Luz
  • 343
  • 1
  • 10
8
votes
1 answer

Linear time algorithm for finding $k$ shortest paths from $s$ to $t$

Definition. Given a graph $G=(V,E)$ and two vertices $s$ and $t$, the $k$-shortest-paths problem is finding the $k$ shortest simple paths between $s$ and $t$ in $G$. Note that the length of these paths is not necessarily equal, and vertices…
orezvani
  • 1,944
  • 15
  • 20
8
votes
2 answers

How can I generate first n elements of the sequence 3^i * 5^j * 7^k?

How can I efficiently generate the first N elements of the sequence $3^i 5^j 7^k$, where $i,j,k \in \mathbb{N}$? I've googled around a bit and found the sequence in OEIS, but I don't really see a simple way of generating it.
8
votes
1 answer

Generate algorithmically all grid points inside a hypercube

$\def\R{\mathbb{R}}\def\Z{\mathbb{Z}}\def\n#1{\|#1\|_\infty}$The problem comes directly from computational mathematics, and can be stated as follows: Given a regular matrix $M\in\R^{d\times d}$, find effectively all vectors $v\in\Z^d$ such that…
yo'
  • 311
  • 1
  • 10
7
votes
2 answers

Algorithm for listing all binary trees of a given height

I've been trying to find an algorithm to list all binary trees of a given height $h$. Note that I'm not trying to count them: the number of such trees is given in the OEIS (A001699). All the algorithms that I have been able to see list all binary…
Shiwen Yao
  • 171
  • 3
7
votes
2 answers

Is there an algorithm to find all the shortest paths between two nodes?

Given a directed graph, Dijkstra or Bellman-Ford can tell you the shortest path between two nodes. What if there are two (or n) paths that are shortest, is there an algorithm that will tell you all such paths? Edit: I have just thought up a possible…
dan
  • 203
  • 1
  • 2
  • 7
6
votes
1 answer

Find all cycles through a given vertex

Given a directed graph $G$ and a vertex $v$, how can we enumerate all simple cycles that pass through $v$? I found a question that describes how to enumerate all simple cycles in $G$, but I want only the cycles that pass through $v$, so this…
D.W.
  • 167,959
  • 22
  • 232
  • 500
6
votes
1 answer

Enumeration of winning coalitions

Taken from Wikipedeia: A simple voting game, taken from Game Theory and Strategy by Phillip D. Straffin: [6; 4, 3, 2, 1] The numbers in the brackets mean a measure requires 6 votes to pass, and voter A can cast four votes, B three votes, C two, and…
1
2 3
11 12