## How to describe the graph of a spiral whos origin moves over time?

Problem:

I am trying to figure out how I would graph the absolute coordinates of the spiral

r = 14 + 0.69θ^1.8, θ = 4π to 0

when the relative system starts with its origin at absolute (0,0) at θ = 4π and drifts towards (-15, -3) as θ approaches zero.

Context:

I’m mapping out spiraling Christmas lights on my bedroom ceiling. The strands start in the corners, run along the wall until midpoints (ie x/y axis lines) then begin spiraling towards the center until they merge into a ring near the middle. Here is an example from a previous apartment:

My new bedroom has a ceiling fan about 15″ x 3″ off center, so if I treat the ceiling center as the origin its going to look awkward with the fan off to one corner. Treating the fan as the origin would cause the strands to end unevenly across the 4 walls, and would make it harder since I have to go outside inward.

The solution I came up with is to try an elliptical effect where the coordinates start at the walls with the ceiling center as the origin and gradually shift the origin towards the fan as the strands wrap inward.

I’d really like a way to graph this out to see how it will look before I go through the trouble of putting hundreds of thumbtacks in my ceiling 🙂

## vertex cover of bipartite graph

A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set.

A minimum vertex cover is a vertex cover with minimal cardinality.

Consider a set of all minimum vertex covers of a given bipartite graph.

our task is to divide all vertices of the graph into three sets.

A vertex is in set N (“Never”) if there is no minimum vertex cover containing this vertex.

A vertex is in set A (“Always”) if it is a part of every minimum vertex cover of the given graph.

If a vertex belongs neither to N nor to A, it goes to the set E (“Exists”).

How to classify vertices ?

## Directed graph that returns before all its child nodes are visited?

Give an example of a directed graph in which a depth-ﬁrst search backs up from a vertex $$v$$ before all the vertices that can be reached from $$v$$ via one or more edges are discovered.

My professor recently asked this question as a warm up to lecture, but never answered it. I still have not figure how that is possible. Why would it return if it’s not complete?

I just can’t see a scenario where this would happen.

It would never return, since DFS is (essentially) recursive and it can’t return without having hit all base cases.

## I want to use Graph in ListViewItem

I’m making the WPF application with OxyPlot.

I want to use Graph in ListView’s item and I want to add Graph with dynamically.

I can make ListView with a lot of Graph. But when I move with MouseWheel or use ScrollBar’s Up and down(▲ and ▼), I get Exception “This PlotModel is already in use by some other PlotView control.”.

My xaml’s code is here.

``       <Grid Margin="20,65,19,10">         <ListView ItemsSource="{Binding ListSource}"                         HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">              <ItemsControl.ItemsPanel>                 <ItemsPanelTemplate>                     <VirtualizingStackPanel IsVirtualizing="True" IsItemsHost="True" />                 </ItemsPanelTemplate>             </ItemsControl.ItemsPanel>             <!--https://github.com/oxyplot/oxyplot/blob/develop/Source/Examples/WPF/WpfExamples/Examples/PerformanceDemo/MainWindow.xaml-->              <ItemsControl.ItemTemplate>                 <DataTemplate>                     <VirtualizingStackPanel>                         <Label Content="{Binding Tag}"/>                         <oxy:PlotView  Height="130" Margin="20,23,20,0"                             Model="{Binding Chart}" Controller="{Binding Controller}"                             Background="{Binding Path=Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" MinWidth="600">                         </oxy:PlotView>                     </VirtualizingStackPanel>                 </DataTemplate>             </ItemsControl.ItemTemplate>         </ListView>     </Grid> ``

And it cause when ListView’s item is over 10 items.

And it dosen’t cause when I use ScrollBar’s slider.

I must not use the ListView with OxyPlot? (I want to solve this problem as possible as.)

## Context

For context, this problem is part of my attempt to determine the path of least inertia for a free and open-source laser scanner DAC API I am developing. The following problem arises during the vector image optimisation pass. I convert the 2D vector image into a graph of 2D positions and add blank edges (i.e. transparent lines) to represent the image as a strongly connected, undirected Eulerian graph from which I should be able to determine the optimal Eulerian circuit.

## Problem

Given a strongly connected, undirected Eulerian graph (i.e. each vertex has an even degree), I’m trying to determine the Eulerian circuit that results in the minimum possible accumulative angle, where each vertex is a position in 2D space and each edge describes a straight line between the vertices.

## My Solution Attempt

My attempt at solving this was to first simplify the problem by looking at each vertex individually. We know that each vertex must have an even degree, and thus for each vertex there must be an optimal set of incoming/outgoing edge pairs (where each edge is used once) that results in a minimum accumulative angular distance. By minimum accumulative angular distance, I’m referring to the sum of the difference between the result of the difference between the angle of each incoming/outgoing edge pair and a straight line. For example, given the following vertex A and its neighbours B, C, D and E:

an example of optimal pairs would be (DA, AB) and (EA, AC) as they are cumulatively the least sharp angles through which A may be traversed (and in turn would induce the least inertia), whereas the pairs (EA, AD) and (BA, AC) would be the least optimal as cumulatively they contain the sharpest angles to be traversed (resulting in the highest inertia).

Once the set of optimal pairs is determined for each vertex, I suspect the Eulerian Circuit can be created by starting at one of the vertices, picking a direction to begin and following the optimal pairs until the beginning is reached again.

## My Solution Attempt Issues

Currently however I’m running into two issues.

1. I don’t know for sure whether or not my assumption holds true for all Euler graphs (where all nodes have an even degree).
2. I’m unsure of the best approach for determining the set of optimal edge pairs for each vertex. I suspect it may be possible to represent each vertex and its edges as a sub-graph and treat the problem as finding the shortest path (where the “shorter” distances are the paths through the vertex that result in the straightest angles), but I’m struggling to come up with a sub-graph representation that would allow me to do this.

## Related Research

In section 3.4 of Accurate and Efficient Drawing Method for Laser Projection the paper describes using Hierholzer’s algorithm for finding an optimal Eulerian circuit with the amendment that during traversal of each vertex you select the unvisited edge along the angle closest to a straight line. One issue that occurs to me with this approach is that it is not clear to me that this always results in the absolute optimal circuit, only one that is probably more optimal than a naive construction without this added amendment.

## Questions

1. Is there an existing solution to the original Problem stated above? If so, is there somewhere I might read further on this?
2. If not, does my attempted solution sound like a reasonable approach? If so, do you have an idea of how I might represent the sub-graph for determining the set of edge pairs resulting in the minimum accumulative angular distance for each vertex?
3. If not, can you recommend an approach I might be able to take to make progress on solving the previously mentioned Problem?

## Easter Bar Graph

Computing Easter for a given year is a classic computational problem.

It is also one of the few cases when code seems to just have to live with magic numbers.

Alternative to magic numbers: Decoding Gauss’ Easter Algorithm

So I thought today, I’d do something positive and make an Easter bar graph.

C99 Review goal: General coding comments, style, etc.

``// easter.h // chux: April 15, 2019  #ifndef EASTER_H #define EASTER_H  #define EASTER_EPOCH_YEAR 33 #define EASTER_JULIAN_YEAR EASTER_EPOCH_YEAR #define EASTER_GREGORIAN_EPOCH_YEAR 1582 /* 15 October 1582 */ #define EASTER_JULIAN_PERIOD 532 #define EASTER_GREGORIAN_PERIOD 5700000  typedef struct ymd {   int y, m, d; } ymd;  ymd Easter_DateJulian(int year); ymd Easter_DateGregorian(int year); ymd Easter_Date(int year);  #endif  // easter.c  /*  * Anonymous Gregorian algorithm: Meeus/Jones/Butcher  *  * Dates of Easter  * Astronomical Algorithms 1991  * Jean Meeus  * https://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm  *   * Meeus's Julian algorithm  * https://en.wikipedia.org/wiki/Computus#Meeus's_Julian_algorithm  */ ymd Easter_DateJulian(int year) {   if (year < EASTER_EPOCH_YEAR) {     return (ymd) {0, 0, 0};   }   int a = year % 4;   int b = year % 7;   int c = year % 19;   int d = (19 * c + 15) % 30;   int e = (2 * a + 4 * b - d + 34) % 7;   int f = (d + e + 114) / 31;   int g = (d + e + 114) % 31;   return (ymd) {year, f, g + 1}; }  ymd Easter_DateGregorian(int year) {   if (year <= EASTER_GREGORIAN_EPOCH_YEAR) {     return (ymd) {0, 0, 0};   }   int a = year%19;   int b = year/100;   int c = year%100;   int d = b/4;   int e = b%4;   int f = (b+8)/25;   int g = (b-f+1)/3;   int h = (19*a + b - d - g + 15)%30;   int i = c/4;   int k = c%4;   int l = (32 + 2*e + 2*i - h - k)%7;   int m = (a+11*h + 22*l) / 451;   int n = (h + l - 7 *m + 114)/31;   int p = (h + l - 7 *m + 114)%31;   return (ymd) {year, n, p+1}; }  ymd Easter_Date(int year) {   return (year > EASTER_GREGORIAN_EPOCH_YEAR) ?       Easter_DateGregorian(year) : Easter_DateJulian(year); } ``

Test

``// main.c  // **Alternate code used as a check** // Find easter on any given year // https://codereview.stackexchange.com/questions/193847/find-easter-on-any-given-year // Decoding Gauss' Easter Algorithm // https://math.stackexchange.com/q/896954/83175  static ymd Easter(int year) {     int a = year%19;     int b = year/100;     int c = (b - (b/4) - ((8*b + 13)/25) + (19*a) + 15)%30;     int d = c - (c/28)*(1 - (c/28)*(29/(c + 1))*((21 - a)/11));     int e = d - ((year + (year/4) + d + 2 - b + (b/4))%7);     int month = 3 + ((e + 40)/44);     int day = e + 28 - (31*(month/4));     return (ymd) {year, month , day}; }  #include <assert.h> #include <stdio.h>  int main(void) {   int count[5][32] = { 0 };   for (int year = EASTER_GREGORIAN_EPOCH_YEAR + 1;       year <= EASTER_GREGORIAN_EPOCH_YEAR + EASTER_GREGORIAN_PERIOD;       year++) {     ymd e1 = Easter_Date(year);     ymd e2 = Easter(year);     if (e1.d != e2.d) {       printf("%5d-%02d-%02d ", e1.y, e1.m, e1.d);       printf("%5d-%02d-%02d ", e2.y, e2.m, e2.d);       puts("");     }     assert(e1.m >= 3 && e1.m <=4);     assert(e1.d >= 1 && e1.d <=31);     count[e1.m][e1.d]++;   }   for (int m = 3; m <= 4; m++) {     for (int d = 1; d <= 31; d++) {       if (count[m][d]) {         double permill =  round(1000.0*count[m][d]/EASTER_GREGORIAN_PERIOD);         printf("%d, %2d, %3.1f%%, %0*d\n", m, d, permill/10, (int) permill, 0);       }     }   }   return 0; } ``

Output: Month, Day, Percentage, Graph

``3, 22, 0.5%, 00000 3, 23, 1.0%, 0000000000 3, 24, 1.4%, 00000000000000 3, 25, 1.9%, 0000000000000000000 3, 26, 2.3%, 00000000000000000000000 3, 27, 2.9%, 00000000000000000000000000000 3, 28, 3.3%, 000000000000000000000000000000000 3, 29, 3.4%, 0000000000000000000000000000000000 3, 30, 3.3%, 000000000000000000000000000000000 3, 31, 3.3%, 000000000000000000000000000000000 4,  1, 3.4%, 0000000000000000000000000000000000 4,  2, 3.3%, 000000000000000000000000000000000 4,  3, 3.4%, 0000000000000000000000000000000000 4,  4, 3.3%, 000000000000000000000000000000000 4,  5, 3.4%, 0000000000000000000000000000000000 4,  6, 3.3%, 000000000000000000000000000000000 4,  7, 3.3%, 000000000000000000000000000000000 4,  8, 3.4%, 0000000000000000000000000000000000 4,  9, 3.3%, 000000000000000000000000000000000 4, 10, 3.4%, 0000000000000000000000000000000000 4, 11, 3.3%, 000000000000000000000000000000000 4, 12, 3.4%, 0000000000000000000000000000000000 4, 13, 3.3%, 000000000000000000000000000000000 4, 14, 3.3%, 000000000000000000000000000000000 4, 15, 3.4%, 0000000000000000000000000000000000 4, 16, 3.3%, 000000000000000000000000000000000 4, 17, 3.4%, 0000000000000000000000000000000000 4, 18, 3.5%, 00000000000000000000000000000000000 4, 19, 3.9%, 000000000000000000000000000000000000000 4, 20, 3.3%, 000000000000000000000000000000000  <-- 2019 4, 21, 2.9%, 00000000000000000000000000000 4, 22, 2.4%, 000000000000000000000000 4, 23, 1.9%, 0000000000000000000 4, 24, 1.5%, 000000000000000 4, 25, 0.7%, 0000000 ``

## Properties of the collection of maximal independent sets of a graph

Let $$G$$ be a graph and define

$$\mathscr{I}(G) = \{S \subset V(G)| S$$ is a maximal indepedent set of $$G\}$$

1. What is known about $$\mathscr{I}(G)$$?

2. What are some of the properties of $$\mathscr{I}(G)$$?

3. How does $$\mathscr{I}(G)$$ relates to other properties of $$G$$ for example chromatic number?

4. Is it possible to decide if a collection $$\mathscr{A}$$ is equal to $$\mathscr{I}(H)$$ for some graph $$H$$?

## Generalized geography game graph

I’m studying the Sipser textbook for my theory of complexity class. In a part of the book (i.e., Space Complexity chapter), for showing that Generalized Geography game is PSPACE-complete, the author has given an argument to model this game with TQBF problem (which is proven to be PSPACE-complete).

In a step of the argument, he has tried to construct a directed graph by using the definitions of TQBF problem (universal and existential quantifiers). What he has come up with is the following graph:

1. I, actually, don’t get it why the diamond structure has been used for showing choice possibilities of player $$x_i$$. Couldn’t we use a simple structure like what we do on binary trees?
1. How would it be if we use a hexagon shape instead of diamond for showing choices of $$x_i$$?