## #StackBounty: #graphs #optimization #scheduling #loops Is the RecMII really important?

### Bounty: 100

Recently I’ve asked a question on SO about dependence graph and modulo scheduling, because I’m not able to get the distance of some loop carried dependency and I needed some help.

I’m building a dependence graph so that I can implement the modulo scheduler of this paper and aside for some problem that blocks me I have a question about the importance of some parameters.

In particular about the recurrence-constrained MII (RecMII).
I noticed that in some case you probably can’t get the loop carried distance of some dependency (for example `a[i]=a[f(a[i-1])] +a[i*i-2*i-1]`), so I’m asking:

• Is the RecMII really important in the modulo scheduling algorithm? If yes how much? (It just seems a way to reduce the try needed to find a valid II)
• What happens if I neglect it? Just some increase execution time of
the main loop that try to find the II or I also decrease the quality
of my scheduler?
• Can the Modulo scheduler be used only on the data dependency graph? (I’m asking this because it’s really easy to build such graph, you only need to go through the def-use chain)

Get this bounty!!!

## #StackBounty: #tikz-pgf #positioning #graphs Placement of several graphs in the same tikzpicture

### Bounty: 50

I am trying to produce this image, which includes three labels, and three graphs, all automatically generated by a (Java) program. The program generates graphs (specifically, of finite state automata) and employs LaTeX and TikZ to present these graphs to clients. The graphs tend to be large, often very large, and it is very difficult to pro-grammatically make adjustment to the process for the purpose of rendering.

The above image was generated by the LaTeX input at the end of this questions. You will notice that it is consists of three nodes, and three graphs. They are placed with magic numbers which I worked out manually. It is fairly easy to add anything before or after
the graphs, but it is not possible to tweak the actual list of nodes and edges. It is also not possible to know in advance which nodes would be present on the graphs.

The question is whether it is possible to enclose the graphs and nodes with something that would compute their size, and place them, e.g., in a chain.

Yet another restriction is that the entire spiel should be in a single `tikzpicture` environment.

``````  documentclass{sciposter}
usepackage[paperwidth=84cm,paperheight=120cm,centering,textwidth=74cm,textheight=100cm,left=2cm,top=2cm]{geometry}

usepackage{tikz}
begin{document}
usetikzlibrary{graphs,chains,shapes,quotes}
usetikzlibrary{automata, positioning, arrows}
usetikzlibrary{graphdrawing}
usegdlibrary{trees,force,layered,circular}
tikzstyle{accept}=[fill=green!50]
tikzstyle{initial}=[circle,draw]
tikzstyle{every node}=[rectangle]
tikzstyle{epsilon}=[]
tikzstyle{graphs/every graph}=[simple necklace layout,
nodes={ellipse,fill=olive!20,inner sep=2pt,outer sep=2pt}, level sep =12ex, sibling sep=4ex, node distance = 35ex]

defmagicOne{(0,-3)}
defmagicTwo{(0,-63)}
defmagicThree{(0,-95)}
begin{tikzpicture}
node at (0,0) {Huge NFSA};
node at (0,-61) {Huge DFSA};
node at (0,-92)  {Huge Minimized DFSA};
begin{scope} path magicOne
graph{
"\$q_{0}\$" [initial,accept] -> ["varepsilon"] "\$q_{1}\$" ;
"\$q_{0}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{0}\$"  -> [""] "\$q_{3}\$" ;
"\$q_{0}\$"  -> [""] "\$q_{8}\$" ;
"\$q_{0}\$"  -> ["varepsilon",loop] "\$q_{0}\$" ;
"\$q_{1}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{1}\$"  -> [""] "\$q_{3}\$" ;
"\$q_{1}\$"  -> ["varepsilon"] "\$q_{8}\$" ;
"\$q_{2}\$"  -> ["a, b",loop] "\$q_{2}\$" ;
"\$q_{3}\$"  -> ["b"] "\$q_{2}\$" ;
"\$q_{3}\$"  -> ["a"] "\$q_{4}\$" ;
"\$q_{3}\$"  -> [""] "\$q_{5}\$" ;
"\$q_{4}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{4}\$"  -> ["varepsilon"] "\$q_{5}\$" ;
"\$q_{5}\$"  -> ["a"] "\$q_{2}\$" ;
"\$q_{5}\$"  -> [""] "\$q_{6}\$" ;
"\$q_{5}\$"  -> [""] "\$q_{7}\$" ;
"\$q_{5}\$"  -> [""] "\$q_{10}\$" ;
"\$q_{5}\$"  -> ["b"] "\$q_{12}\$" ;
"\$q_{6}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{6}\$"  -> ["varepsilon"] "\$q_{7}\$" ;
"\$q_{6}\$"  -> ["varepsilon"] "\$q_{10}\$" ;
"\$q_{7}\$"  -> ["a"] "\$q_{2}\$" ;
"\$q_{7}\$"  -> [""] "\$q_{1}\$" ;
"\$q_{7}\$"  -> [""] "\$q_{3}\$" ;
"\$q_{7}\$"  -> [""] "\$q_{8}\$" ;
"\$q_{7}\$"  -> [""] "\$q_{0}\$" ;
"\$q_{7}\$"  -> ["b"] "\$q_{9}\$" [accept];
"\$q_{8}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{8}\$"  -> ["varepsilon"] "\$q_{3}\$" ;
"\$q_{9}\$"  -> [""] "\$q_{1}\$" ;
"\$q_{9}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{9}\$"  -> [""] "\$q_{3}\$" ;
"\$q_{9}\$"  -> [""] "\$q_{8}\$" ;
"\$q_{9}\$"  -> ["varepsilon"] "\$q_{0}\$" ;
"\$q_{10}\$"  -> ["b"] "\$q_{2}\$" ;
"\$q_{10}\$"  -> [""] "\$q_{1}\$" ;
"\$q_{10}\$"  -> [""] "\$q_{3}\$" ;
"\$q_{10}\$"  -> [""] "\$q_{8}\$" ;
"\$q_{10}\$"  -> [""] "\$q_{0}\$" ;
"\$q_{10}\$"  -> ["a"] "\$q_{11}\$" [accept];
"\$q_{11}\$"  -> [""] "\$q_{1}\$" ;
"\$q_{11}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{11}\$"  -> [""] "\$q_{3}\$" ;
"\$q_{11}\$"  -> [""] "\$q_{8}\$" ;
"\$q_{11}\$"  -> ["varepsilon"] "\$q_{0}\$" ;
"\$q_{12}\$"  -> ["varepsilon"] "\$q_{6}\$" ;
"\$q_{12}\$"  -> ["a, b"] "\$q_{2}\$" ;
"\$q_{12}\$"  -> [""] "\$q_{7}\$" ;
"\$q_{12}\$"  -> [""] "\$q_{10}\$" ;
}
; end{scope}

begin{scope} path magicTwo
graph{
"\$q_{0}\$" [initial,accept] -> ["b"] "\$q_{1}\$" ;
"\$q_{0}\$"  -> ["a"] "\$q_{2}\$" ;
"\$q_{1}\$"  -> ["a, b",loop] "\$q_{1}\$" ;
"\$q_{2}\$"  -> ["a"] "\$q_{1}\$" ;
"\$q_{2}\$"  -> ["b"] "\$q_{3}\$" ;
"\$q_{3}\$"  -> ["a"] "\$q_{4}\$" [accept];
"\$q_{3}\$"  -> ["b"] "\$q_{5}\$" [accept];
"\$q_{4}\$"  -> ["b"] "\$q_{1}\$" ;
"\$q_{4}\$"  -> ["a"] "\$q_{2}\$" ;
"\$q_{5}\$"  -> ["b"] "\$q_{1}\$" ;
"\$q_{5}\$"  -> ["a"] "\$q_{2}\$" ;
}

; end{scope}

begin{scope} path magicThree
graph{
"\$q_{0}\$" [initial,accept] -> ["b"] "\$q_{1}\$" ;
"\$q_{0}\$"  -> ["a"] "\$q_{2}\$" ;
"\$q_{1}\$"  -> ["a, b",loop] "\$q_{1}\$" ;
"\$q_{2}\$"  -> ["a"] "\$q_{1}\$" ;
"\$q_{2}\$"  -> ["b"] "\$q_{3}\$" ;
"\$q_{3}\$"  -> ["a, b"] "\$q_{0}\$" ;
}

; end{scope}
end{tikzpicture}

end{document}

``````

Get this bounty!!!

## #StackBounty: #graphs #algorithm-analysis #machine-learning #runtime-analysis #graph-traversal Why does it take O(n!) time to specify a…

### Bounty: 50

I was reading a paper for learning graphs (paper is GraphRNN) and it says in section 2.2 (emphasis by me):

Vector-representation based models. One naive approach would be to represent G by flattening $$A^π$$ into a vector in $$R^{n^2}$$, which is then used as input to any off-the-shelf generative model, such as a VAE or GAN. However, this approach suffers from serious drawbacks: it cannot naturally generalize to graphs of varying size, and requires training on all possible node permutations or specifying a canonical permutation,both of which require O(n!) time in general

I understand how flattening the adjacency matrix would require the algorithm to receive all possible orderings and thus it takes $$O(n!)$$ to learn it – but I don’t understand why specifying a canonical ordering has that issue to. With some abuse of notation just do $$pi(G,A) = G^pi,A^pi$$ for all graphs before giving them to the training algorithm. Something like (say we have $$N$$ graphs with $$n$$ verticies and we loop T times):

``````for t in T
for G,A in Graphs.Dataset
Gpi, Api = pi(G,A)  # takes worst case O(n^2) to at least do print the adj matrix
y = mdl(Gpi, Api)
loss(y,Gpi,Api).backward().sgd() # assume we are doing SGD or something
``````

The run time seems $$O(N)*O(n^2)$$ not $$O(N)*O(n!)$$. So I am not sure why the canonical representation takes $$O(n!)$$ (note I am aware that just multiplying big-Os like that can lead to problems but specifying the summation explicitly in this case I think leads to no issues).

Thanks for the help!

cross:

Get this bounty!!!

## #StackBounty: #ganache #graphs Failed to deploy to Graph node: Ethereum network not supported by registrar: mainnet

### Bounty: 50

I followed this tutorial on the graph document: https://thegraph.com/docs/quick-start#local-development

However, I got an error message after I run `yarn deploy-local`.

``````Failed to deploy to Graph node http://127.0.0.1:8020/: Ethereum network not supported by registrar: mainnet
``````

Is there anything I am missing here?

This is the whole log

``````Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
Skip migration: Bump mapping specVersion from 0.0.1 to 0.0.2
✔ Apply migrations

Path: repository
The repository is still set to https://github.com/graphprotocol/example-subgraph.

Path: description
The description is still the one from the example subgraph.

Compile data source: Gravity => build/Gravity/Gravity.wasm
✔ Compile subgraph
Copy schema file build/schema.graphql
Write subgraph file build/Gravity/abis/Gravity.json
Write subgraph manifest build/subgraph.yaml
✔ Write compiled subgraph to build/
.. QmbSFRGGvHM7Cn8YSjDL41diDMxN4LQUDEMqaa5VVc5sC4
.. QmbK8bwncci52cstF3P8Q8i4oGjrMt1pUqdv5Uf1VXqXdb

Build completed: QmYc13fDLwyvTT5crdGWGuFbaN23YxJ8RG8EGNW4Bac24j

✖ Failed to deploy to Graph node http://127.0.0.1:8020/: Ethereum network not supported by registrar: mainnet
error Command failed with exit code 1.
``````

Get this bounty!!!

## #StackBounty: #graphs #computational-geometry Approximation Algorithms via Unit Disk Graph Embeddings

### Bounty: 100

A unit disk graph is defined by a collection of $$n$$ vertices corresponding to $$n$$ points on the plane, with an edge between any two vertices whose distance is at most $$r$$.
Some $$NP$$-hard problems become solvable in polynomial time for unit disk graphs. I am interested in designing approximation algorithms by adapting such algorithms to general graphs as follows:

Let $$A$$ be an algorithm that solves an $$NP$$-hard problem in polynomial time in the special case of unit disk graphs.

• Given a graph $$G$$, first embed it into the plane in such a way that vertex pairs connected by an edge tend to be close together, whereas vertex pairs that aren’t connected tend to be farther apart.

Of course, the resulting graph is probably not going to be a unit disk graph, but hopefully it is close to such a graph in some sense.

• Use the algorithm $$A$$ to find a solution for the graph.

Hopefully, if the embedding of $$G$$ is close to a unit disk graph, $$A$$ will return a good approximation to the $$NP$$-hard problem.

Has this type of thing been studied? In particular, I haven’t been able to find an appropriate algorithm for the first item.
"Low distortion Embeddings" is something related but different: There, the goal is that all edges should have similar lengths, whereas in my case I don’t care about eliminating short edges. I just don’t want any long edges.

I have an idea but it’s rather silly: I thought of running a physical simulation in which we place an attractive force on edges between vertices that are far apart, and a repelling force on non-edges between vertices that are close together. We would wait for the system to reach an equilibrium, which hopefully would minimize some potential function that measures the distance between our embedding and a unit disk graph.

Get this bounty!!!

## #StackBounty: #algorithms #graphs #algorithm-analysis #breadth-first-search Total running time expressed in O notation of a word ladder…

### Bounty: 100

I am trying to figure out a big O expression for the running time given $$V,E,F$$ for a word ladder or word chain program that I have written in Java. I am using undirected graphs with BFS.

What is known, and I have calculated.

Time complexity: $$O(V + E)$$ for building the graph $$G(V, E)$$ of words. The second part of the program consists of a while loop and a for loop of finding the shortest path (using BFS), which is $$O(V^2)$$.

Space complexity: $$O(V)$$ in the worst case. The graph holds all the words. The nodes are made up of a single node class object which contains $$n$$ neighbor(s).

Process:

1. Program loads into buffer a file with words.
2. The program builds the graph.
3. The program runs test and loads into buffer information from a test file (different file). Then selects start and end node and performs the shortest path search.

Now, I am trying to come up with an $$O(n)$$ time algorithm or total time complexity for $$V,E,F$$, where:

• $$V$$ is the number of vertices
• $$E$$ is the number of edges
• $$F$$ is the number of test cases (number of lines in the test file)

What I am essentially trying to do is express the running time as big O involving $$V,E,F$$.

Here you can find similar code.

According to this page, the time complexity is $$O(M^2N)$$, where $$M$$ is the length of each word and $$N$$ is the total number of words in the input word list, and the space complexity is $$O(M^2N)$$.

Combining the above steps, the overall space complexity is $$O(M^2N) + O(MN) + O(MN) = O(M^2N)$$ space.

Graph code: https://algs4.cs.princeton.edu/41graph/Graph.java.html, not mine, I have implemented my own version which is lighter.

Here is an example of what the input looks like.

Data file:(Used to build the Graph(V,E))

``````their
moist
other
blimp
limps
there
pismo
abcde
bcdez
zcdea
bcdef
fzcde
``````

Test file:(Used for testing and finding the shortest path, start word, end word).

``````other there
other their
their other
blimp moist
limps limps
moist limps
abcde zcdea
``````

## So, each line, is parsed into: `string start="other";`, `string end="there";` This is done for each line.

EDIT:
BFS five letter, that’s what I am doing. But, I am trying to express in O(…) an overall running time for this program given input of N lines of word from data file, and testfile

Get this bounty!!!

## #StackBounty: #algorithms #graphs #algorithm-analysis #breadth-first-search Running time of word ladder program

### Bounty: 100

I am trying to figure out a big O expression for the running time given $$V,E,F$$ for a word ladder or word chain program that I have written in Java. I am using undirected graphs with BFS.

What is known, and I have calculated.

Time complexity: $$O(V + E)$$ for building the graph $$G(V, E)$$ of words. The second part of the program consists of a while loop and a for loop of finding the shortest path (using BFS), which is $$O(V^2)$$.

Space complexity: $$O(V)$$ in the worst case. The graph holds all the words. The nodes are made up of a single node class object which contains $$n$$ neighbor(s).

Process:

1. Program loads into buffer a file with words.
2. The program builds the graph.
3. The program runs test and loads into buffer information from a test file (different file). Then selects start and end node and performs the shortest path search.

Now, I am trying to come up with an $$O(n)$$ time algorithm or total time complexity for $$V,E,F$$, where $$V$$ is the number of vertices, $$E$$ is the number of edges, and $$F$$ is the number of test cases (number of lines in the test file).

What I am essentially trying to do is express the running time as big O involving $$V,E,F$$.

Here you can find similar code.

According to this page, the time complexity is $$O(M^2N)$$, where $$M$$ is the length of each word and $$N$$ is the total number of words in the input word list, and the space complexity is $$O(M^2N)$$.

Combining the above steps, the overall space complexity is $$O(M^2N) + O(MN) + O(MN) = O(M^2N)$$ space.

Graph code: https://algs4.cs.princeton.edu/41graph/Graph.java.html, not mine, I have implemented my own version which is lighter.

Here is an example of what the input looks like.

Data file:(Used to build the Graph(V,E))

``````their
moist
other
blimp
limps
there
pismo
abcde
bcdez
zcdea
bcdef
fzcde
``````

Test file:(Used for testing and finding the shortest path, start word, end word).

``````other there
other their
their other
blimp moist
limps limps
moist limps
abcde zcdea
``````

EDIT:
BFS five letter, that’s what I am doing. But, I am trying to express in O(…) an overall running time for this program given input of N lines of word from data file, and testfile

Get this bounty!!!

## #StackBounty: #algorithms #graphs #dynamic-programming #heuristics Scheduling tasks on a graph with assistance

### Bounty: 150

This is a follow-up to a question that I recently posted here: Completing tasks on a graph. In that question, I posted the following:

Consider a graph $$G = (V, E)$$, where $$V = {0, 1, 2, ldots, n}$$. The graph $$G$$ is complete, which means we can traverse $$(i, j)$$ for all $$i, j in V$$. At each vertex $$v in V$$, there is a task that we must complete. The task at vertex $$v$$ takes $$q_v > 0$$ minutes for $$v neq 0$$, and we must complete all tasks. We start at Vertex $$0$$, and we have $$q_0 = 0$$.

It will obviously take us exactly $$sum_{i = 1}^{n} q_i$$ total time for us to complete all of the tasks on our own (it doesn’t take any time to traverse the edges). However, suppose we have a single helper. We are allowed to dispatch the helper at any node (say $$v$$), and we can leave the node, go work on other tasks, and pick up the helper after $$q_v$$ minutes to drop it off at another node. A caveat is that the helper cannot move on its own; it must be picked up and dropped off.

Is there some sort of algorithm that allows one to find the best strategy (i.e., one that minimizes the total time) when we are allowed one helper?

As a summary, in the initial post, I asked for an approximation/heuristic that would allow me to minimize the total time spent completing all of the tasks with the assistance of a helper. Tom van der Zanden proposed an answer in which the longest job is always assigned to the helper, and they showed that this is an efficient polynomial-time approximation scheme for the makespan.

However, I now want to consider a slight variant of the problem. Most of the problem remains the same, but the following constraint is added: The helper cannot be dispatched at any node. Instead, there is a subset of vertices $$S subseteq V$$ that is known to everyone at the start of problem, and the helper can only be dispatched at the vertices in this subset.

I looked at the extreme cases (i.e., $$S = emptyset$$ and $$S = V$$). When $$S = V$$, the heuristic proposed in the previous post obviously works. When $$S = emptyset$$, the total time taken is fixed since we cannot exercise the option to use a helper vehicle.

I was wondering whether there was an approximation scheme or heuristic that might be efficient in this general case.

Get this bounty!!!

## #StackBounty: #algorithms #graphs #monte-carlo Devise Mont Carlo and Las Vegas Algorithms to Solve Maximum Independent Set

### Bounty: 50

I am trying to devise a Las Vegas algorithm to solve Maximum Independent Set, but I don’t know how to start.

Also, I want to devise a Mont Carlo algorithm for this problem.

I would appreciate any help.
Thank you.

Get this bounty!!!

## #StackBounty: #graphs #asymptote How to graph the inverse trigonometric function (arctan, arccotan) in asymptote?

### Bounty: 100

A want to add the inverse trig.function for tangens to the code of asymptote. Thank you for adivise.

``````settings.outformat="pdf";
unitsize(2.5cm);
import graph;

real xmin = -pi/2;
real xmax = pi/2;
real ymin = -pi/2;
real ymax = pi/2;

xlimits(xmin,xmax);
ylimits(ymin,ymax);

//axis and the grid :

xaxis(Label("\$x\$",align=2E),Ticks("\$%.2f\$",new real[]{xmin,-1,1,xmax},Size=1mm,1bp),Arrow);
yaxis(Label("\$y\$",align=2N),Ticks("\$%.2f\$",new real[]{xmin,-1,1,xmax},Size=1mm,1bp),Arrow);

// function y=sin(x)
real f(real x) {return sin(x)/cos(x); }
path g = graph(f,xmin+0.5, xmax-0.5);
draw(g,red,
L= Label("\$y=tan(x)\$", UnFill,
position=EndPoint));

// function y=x
draw((xmin-0.25,ymin-0.25)--(xmax+0.25,ymax+0.25),
L= Label("\$y=x\$", UnFill,position=EndPoint));
``````

Get this bounty!!!