algorithms – How to find the “center” of a subset of vertices in a graph?

Cross-post from StackOverflow.

I have an undirected, positive-weighted, connected graph with vertices V and edges E. I also have a subset S of vertices. Right now V contains about 22000 vertices and E about 23000 edges, but these are expected to go up to about a million for larger inputs. S, on the other hand, will usually contain fewer than 1000 vertices, and they are relatively close together in the graph.

I want to find the “center” of S, meaning a vertex c from which the distance to the furthest vertex in S is as small as possible. It’s like the graph center but only for a subset of vertices. (Edit:) It’s also a 1-center problem on a graph; the more general k-center problem is NP-hard but this one is probably easier.

Is there an algorithm to find this center efficiently? Ideally, the performance would only depend on S and its surroundings, and not on the entire graph.

I’ve thought about starting a breadth-first search from all vertices s_i in S simultaneously, stopping when a vertex v_i has been encountered by all s_i, but this is more or less O(|S|²) in both time and memory. It’s probably feasible in this case, but it feels like there might be a better way.

fa.functional analysis – Is there a topological space $X$ for which every $f colon X to mathbb{R}$ is differentiable when restricted to some dense subset of $X$?

I was recently doing some research on Blumberg’s Theorem which states that:

For every $fcolon mathbb{R} to mathbb{R}$ there exists a dense subset $D$ of $mathbb{R}$ such that $f|_D$ is continuous.

Wondering whether this theorem can be strengthened by replacing continuity with differentiability I found this question and as Will Brian has shown this is not possible, since any continuous but nowhere differentiable function would not satisfy this stronger property.

Going further with this train of thought, is there a topological space $X$ where:

For every $f colon X to mathbb{R}$ there exists a dense subset $D$ of $X$ such that $f|_D$ is differentiable.

complexity theory – Is NP a strict subset of DTIME(e^n)

I need to prove whether or not $NP$ is a strict subset of $text{DTIME}(e^n)$ or whether this is unknown, but I’m not sure if I’m thinking about the problem correctly. It seems to me that any language in NP can be solved in $O(2^n)$ time by reducing it to $text{SAT}$ (since $text{SAT}$ is NP-complete) and solving that in $O(2^n)$ time. I know that $2^n = o(frac{e^n}{log e^n})$, so it would seem at first that $NP$ would indeed be a strict subset of $text{DTIME}(2^n),$ but it doesn’t seem that $e^n$ is a “time-constructible” function, so maybe the time hierarchy theorem doesn’t apply in this case? What does that then mean about NP’s relationship with $text{DTIME}(e^n)?$

real analysis – Prove that a set $U subset M$ is open if and only if none of its points are limits of it’s complement

I just completed this exercise from Pugh and would like to double-check that my proof holds:

Prove that a set $U subset M$ is open if and only if none of its points are limits of it’s complement

Pf: Assume $U subset M$ is open. Now assume for contradiction that there exists $x in U$ that is a limit of $U^{c}$. By Theorem 5 $U^{c}$ is closed so we have reached our contradiction
Now assume $x in U$ then $ x notin lim U^{c}$. We want to show $U$ is open. We know $M = U cup U^{c}$ so by hypothesis all $x in lim U^{c}$ implies $x in U^{c}$ so $U^{c}$ is closed so by Theorem 5 $U subset M$ is open.

algorithms – How to Show Subset Sum $le_p$ 3-Partition

Given a set of integers S (positive and negative, may contain duplicates) can S be divided into three disjoint subsets that all sum to the same value? Prove this problem is NP-complete.


Is it possible to show directly that Subset Sum $le_p$ 3-Partition, or would I have to do

Subset Sum $le_p$ Partition $le_p$ 3-Partition?

np complete – Showing that Subset Sum Reduces to 3-Partition

Given a set of integers S (positive and negative, may contain duplicates) can S be divided into three disjoint subsets that all sum to the same value? Prove this problem is NP-complete.


This is a classic NP reduction question, except with the twist of it being a partition of 3 subsets instead of 2.

To prove that it is NP-complete I need to show that some NP-complete problem reduces to this problem. So I want to show that the subset sum problem reduces to this 3-Partition problem.

This is a solution to the 2-Partition problem that I understand. If someone could show me what needs to be modified for the 3-Partition version that would be great. I don’t think it’s as easy as considering $T$ $cup$ ${s-3t}$ rather than $T$ $cup$ ${s-2t}$, but perhaps it is.

EDIT: Would I have to do something like Subset Sum $le_p$ Partition $le_p$ 3-Partition? Or is there a way to go directly from Subset Sum $le_p$ 3-Partition?

algorithms – Unconstrained subset sum vs constrained subset sum?

In class, we discussed two question types: constrained subset-sum and unconstrained subset-sum. Let me define the question specifically and then I will mention what I am confused by.

Question 1: Given an unconstrained set of numbers, find whether or not a certain subset of them adds up to a target value.

Question 2: Given a constrained set of numbers, find whether or not a certain subset of them adds up to a target value.

Now in answer to these questions, our professor mentioned that in the former case, there is no way to do better than $2^{n}$ since we would need to check all possible combinations of the n numbers. But in the second case, we can do better since if we know our numbers are in the range of (0,n), our sums can only be in range (0, $n^{2}$), so our running time may be polynomial and not exponential. I have understood up until this point, but when discussing the specific implementation of the two programs is where I am confused.

So, for the first problem(unconstrained subset-sum), the idea is that we do an implicit traversal of a tree. Where for each number in the set we say, use this or no don’t use this. So we get $2^{n}$ possible combinations. I am not sure if we could use dynamic programming in this case also?

But in the other case, the approach used in class was we used a linked list to store all the possible sums that could be computed by a certain subset of the numbers, and then we took another number from the set, and added it to all the values in the linked list to generate all possible sums that could be formed using this number. If the number is already in the list, we don’t bother to add it.

Question 1:

What I fail to understand is that, how come this time around the running time is polynomial, when really we are still trying to generate all possible sums like we did the last time? After all we are still trying to generate all possible sums right?

Question 2:

My second confusion is that why cannot we use the second approach (using a linked list to store all the possible sums) to solve the unconstrained subset sum problem?

Question 3:

Finally, my final question is that, in this case(i.e. for the constrained subset sum), I saw that we could use dynamic programming. I am wondering how we can use DP, because the way I am looking at it, each time we are generating unique subsets and so we will never share subproblems?

logic – what is the truth table for A subset B?

Let me explain we know that:
XOR (exclusive-or) ≡ symmetric difference = (A-B) ∪ (B-A).

we know that:
XNOR (¬XOR i.e. negation of XOR) ≡ ↔ (Bi-condontional statement) = A=B iff (if and only if) B=A.

we know that:
A-B (set difference) ≡ PΛ¬Q ≡ ¬(P→Q).

we know that:
A∩B ≡ PΛQ

we know that:
A∪B ≡ PνQ

we know that:
XOR (exclusive-or) ≡ symmetric difference = (A-B) ∪ (B-A).

we know that:
XNOR (¬XOR i.e. negation of XOR) ≡ ↔ (Bi-condontional statement) = A=B iff (if and only if) B=A.

we know that:
A-B (set difference) ≡ PΛ¬Q ≡ ¬(P→Q).

we know that:
A∩B ≡ PΛQ

we know that:
A∪B ≡ PνQ

I know this because I worked it out last night here are the truth tables in this PDF:
https://www.dropbox.com/s/nc8201ccwwis4hi/truth%20tables.pdf?dl=0

now comes the fun part I have absolutely no idea what the hell are the truth tables for these:

  • A ⊆ B
  • A ⊂ B
  • A ⊇ B
  • A ⊃ B

also what are the truth tables for negation of these sets:

  • ¬(A ⊆ B)
  • ¬(A ⊂ B)
  • ¬(A ⊇ B)
  • ¬(A ⊃ B)

Please Somebody help my brain is wrecked and I can’t think any more about this stuff. Let me know if there is anything you need I’d be happy to try and answer.

inequalities – Shrinking subset and product

Given a segment and a value $c$ less than the segment length, let $A_1,dots,A_n$ be finite unions of intervals on the segment. We choose a finite union of intervals $B$ with $|B|=c$ that maximizes $|Bcap A_1|timesdotstimes |Bcap A_n|$, where $|cdot|$ denotes the length (i.e. Lebesgue measure). If there are many such $B$, we choose one arbitrarily.

Now, we shrink $A_1$ to $A_1’subseteq A_1$, and choose $B’$ using the same procedure. Is it always true that $|B’cap A_1’|le |Bcap A_1|$?

If $A_1,dots,A_n$ are disjoint finite unions, the answer is positive, as shown here.

real analysis – For every nonempty, compact subset $S$ of complete metric space $M$, if $Ssubset S’$, then $S$ is uncoutable.

In my textbook (Pugh’s), I read a theorem that

  • every nonempty, perfect, complete metric space is uncountable.

In the given proof of this theorem, it seems that it only requires the metric space to be nonempty, complete, and every point is a limit point (cluster point), so I think the same proof would work for any nonempty, compact subset $Ssubset M$ where $Ssubset S’$? The compactness ensures that every Cauchy sequence converges to a point in $S$.