## graphs – Minimal coverage of the clique

How to solve the problem of the minimum coverage of the clique by using linear / full programming in a reasonable time?

Having an undirected graph, I try to partition all its vertices in cliques so that the number of cliques is as small as possible. The problem can be formulated as an entire program, where each vertex corresponds to an integer variable (index of its clique), and whose objective function is to minimize the sum of all these variables. For each edge do not in the graph, a condition is created to ensure that the corresponding vertex variables are not equal, like this:

$$b_k in {0, 1 }$$
$$x_i – x_j + M * b_k> = 1$$
$$x_j – x_i + M * (1-b_k)> = 1$$

$$b_k$$ indicates the relationship between the values ​​of $$x_i$$ and $$x_j$$. With a big enough $$M$$one of the conditions is always true, in which case the other guarantees that the distance between the values ​​is at least 1.

However, this approach seems to have an exponential complexity, operating only on very small graphs.

Assuming that the number of cliques should be reduced and there is usually no border between the cliques, is there a better approach to this problem? I think first of all to find the maximum independent group and use it to correct some variables (because it is guaranteed that they belong to different cliques). Will it help to increase speed?

## graphs – Algorithm to generate random incrementing numbers up to a limit

I'm trying to write code to generate incremental sequences of numbers such as:

``````0 + 1 + 3 + 5 + 1 = 9
0 + 5 + 1 + 1 + 1 = 8
0 + 1 + 1 + 2 + 1 = 5
``````

I have 3 constraints:

1) I need to have a limited number of addends (here it is `= 5`)

2) the final sum must be less than a certain limit (the limit is here `<9`)

3) addends must be random

For now, I generate sequences randomly and selects only those that are appropriate. For 2-digit numbers and for long sequences (`> 8`) my algorithm takes a lot of time.

At least can you tell me that the CS branch is studying such problems?

## "Mobility" in graphs – Mathematics Stack Exchange

Let $$G$$ to be a graph on $$n$$ the tops, $$D$$ a subset of vertices. We interpret $$D$$ like a pebble pattern on $$G$$. A summit $$v$$ of $$G$$ is occupied if it is in $$D$$, unoccupied other. A move take a pebble from a busy top and move it to an adjacent unoccupied vertex.

the mobility of $$D$$, noted by $$m (D)$$ is the number of possible moves. the $$k$$-mobility of $$G$$, noted by $$m_k (G)$$ is the maximum mobility of any vertex-sized subset $$k$$. Mobility of $$G$$, noted by $$m (G)$$, is the maximum mobility of any subset of vertices. (Btw, do these concepts have official names, are they studied?)

It's easy to show that $$m_k (G)$$ is symmetrical on the segment $$[0,n]$$. It's also easy to show that $$m (G)$$ is equal to the number of edges of a larger subgraph covering two parts.

I'm interested in one aspect of the behavior of $$m_k (G)$$ (for fixed $$G$$). Let $$m = lfloor frac n2 rfloor$$. The question is: is $$m_k (G)$$ weakly unimodal on the segment $$[0,m]$$in other words, is there an index $$t$$ such as $$m_ {i-1} (G) leq m_i (G)$$ for $$i leq t$$ and $$m_ {i + 1} (G) geq m_i (G)$$ for $$i geq t$$. A proof (or a counter-example) of the trees would already help a lot.

Some partial results (for trees and on the segment $$[0,m]$$):

1. It is easy to find an example where the function becomes stationary, then increases further.
2. Computers running on small random trees did not produce counter-examples.
3. If the function decreases, it decreases exactly $$1$$ (my proof is not quite trivial).
4. A local maximum can be anywhere, for star charts this is at $$i = 1$$, for cycles it's a $$i = m$$.

## Upper bound of the length of the cycles without chord in the d-regular graphs

Given a $$d$$regular graph with $$n$$ is there a known upper limit (not trivial) on the length of cycles without strings (presumably $$d$$ and $$n$$)? I did not find anything after some online research. Thank you.

## graphs and networks – Express an Edge list as a 0-1 table with headers

Consider the edges

`edges = {S1040 [DirectedEdge]F283, S1197[DirectedEdge]F243, S1197[DirectedEdge]F245, S1863[DirectedEdge]F243, S1863[DirectedEdge]F245, S1863[DirectedEdge]F283, S1863[DirectedEdge]F244, S1863[DirectedEdge]F246, S1863[DirectedEdge]F247, S1863[DirectedEdge]F280, S1863 [DirectedEdge]F281, S1863[DirectedEdge]F282, S1863[DirectedEdge]F284, S2174[DirectedEdge]F243, S2174[DirectedEdge]F280, S2174[DirectedEdge]F281, S2174[DirectedEdge]F284, S2325[DirectedEdge]F247, S2340[DirectedEdge]F245, S2344[DirectedEdge]F282}`

How can I create an adjacency matrix from this chart as a table where the lines are the Fxxx nodes and the columns are the Syyyy nodes and where the rows and columns are in ascending order . For example, line 1 corresponds to F243, line 2 to F244, and so on. Similarly, column 1 corresponds to S1040, column 2 to S1197, and so on.

## data – How to design the best UX for Graphs?

#### Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

## graphs and networks – Grouping of edge points of an image?

Consider the following picture

I want to group the points obtained after the detection of the contours, then, later, to color the contour points.

My attempt:

``````img = URLExecute["https://i.stack.imgur.com/4q309.png"];
edgeImg = img // EdgeDetect;
edgePoints = PixelValuePositions[edgeImg, 1];
clusteredEdgePoints = FindClusters[edgePoints, Method -> "NeighborhoodContraction"];
{edgeImg, Graphics[{ColorData["DarkRainbow"][RandomReal[]], Line[#]} & / @
clusteredEdgePoints]}
``````

{, }

Question:

We can see, `FindClusters` did not group the internal and external ellipses. How should I say `FindClusters` to group internal and external ellipses? or is there another alternative?

Note: I would like the question to be as general as possible, that is, I would not want to enter the number of clusters explicitly.

Some other pictures may be as follows:

``````img1 = URLExecute["https://i.stack.imgur.com/Z150N.png"];
img2 = URLExecute["https://i.stack.imgur.com/spkHI.png"];
``````

,

## graphs – Optimization of the algorithm of De Boor & # 39; s

According to the De Boor algorithm, a basic B-Spline function can be evaluated using the formula:

$$B_ {i, 0} = left { begin {array} {ll} 1 & mbox {if} t_i the x

$$B_ {i, p} = frac {x-t_i} {t_ {i + p} -t_i} B_ {i-1, p} (x) + frac {t + {i + p + 1} – x} {t_ {i + p + 1} -t_ {i + 1}} B_ {i + 1, p-1} (x)$$

where the function $$B$$ is defined for $$n$$ checkpoints for the degree curve $$d$$. The domain $$t$$ is divided into $$n + d + 1$$ points called nodes (in the node vector). To evaluate this, we can define a recursive function $$B (i, p)$$.

B-Spline itself is represented by:
$$S (x) = sum {c_iB_ {i, p}}$$.

To evaluate this, Wikipedia's algorithm tells us to take $$p + 1$$ checkpoints from $$c_ {k-p}$$ at $$c_p$$and then repeatedly take the weighted average of each consecutive pair, eventually reducing it to one point.

I find this algorithm very good for one or two evaluations; However, when we draw a curve, we take hundreds of points in the curve and connect them to make it smooth. The recursive formula still requires up to $$(p-1) + (p-2) + (p-3) …$$ calculations, no? (To take the weighted averages)

In my research, however, we need to evaluate only one polynomial – because B-Spline is ultimately composed of $$p + d + 1$$ basic polynomials (as I will show).

Suppose we take a node vector $$[0, .33, .67, 1]$$ and checkpoints $$[0, 1, 0]$$ (diploma $$1$$), we can then represent the basic polynomials in the form:

$$c_0B_ {0,1} = 0, mbox {if} 0 leq x <.25, + 0, mbox {if} .25 leq x <.5$$
$$c_1B_ {1,1} = 4x-1, mbox {si} .25 leq x <.5, + , , – 4x + 3, mbox {si} .5 leq x <.75$$
$$c_2B_ {2,1} = 0, mbox {if} .5 leq x <0,75 + 0, mbox {if} .75 leq x <1$$

Now we can flatten that they produce:
$$S (x) = sum {c_i B_ {i, 1}} = left { begin {array} {ll} 0 & mbox {if} 0 the x <.25 \ 4x-1 & mbox {if} .25 the x <.5 \ -4x + 3 & mbox {if} .5 the x <.5 \ 0 & mbox {if} .75 the x <1 \ end {array} right.$$

Now, if we were to calculate $$S$$ to no matter $$x$$, we can directly deduce which polynomial to use and then calculate it $$d$$ multiplications and $$d + 1$$ additions.

I've implemented this calculation explicitly using `Polynomial` objects in JavaScript. See https://cs-numerical-analysis.github.io/.

Source: https://github.com/cs-numerical-analysis/cs-numerical-analysis.github.io/blob/master/src/graphs/BSpline.js

I want to know why people do not use the algorithm that I have described. If you calculated the polynomial representation of B-Spline then flatten outside, it will be a one-time cost. Should not this one-time cost be offset by removing the unnecessary recursive average?

## graphs and networks – Maintaining associative bracketing in place

The following Mathematica code displays the vertices of a given graph after the conversion of an expression into an appropriate format (using both tensor and parallel notation headers.) Labels are displayed at the vertex level, but the associative rules are How can I avoid this? (ie, how do I keep square brackets when vertices are displayed?

``````DiplayGraph[g_] : =
With[{vlist = VertexList[g]}
Graphic[g, VertexLabels ->

vlist -> Map[# /. {ExpProduct -> (ToString[
HoldForm[CircleTimes[##]]]&)
Parallel -> (ToString[
HoldForm[DoubleVerticalBar[##]]]&)} &, vlist]],
EdgeLabelStyle -> Directive[10, Background -> White],
VertexLabelStyle -> Directive[10, Background -> White]]]
``````

When running this code on a graph:

``````DisplayGraph[Graph[{A[1, 2] -> B[2, B[3, 4]]}]]
``````

the following output is generated:

I would like 2 || 3 || 4 to appear as 2 || (3 || 4) consistent with parentheses in B[2, B[3, 4]](that is, I do not want associative deletion of parentheses). Which command can be inserted to ensure this?

## graphs – Rebuilt the shortest path from a list of predecessors

I'm trying to make a shortest path reconstruction with the given parameters:

• a table P, which contains the predecessors of each vertex on the shortest path from S to I
• a starting vertex S, defined by a P[S] = -1
• the end of the summit T, which is the destination of the shortest path I am trying to reconstruct

My idea was to start at the end of the table, find the predecessor of the T-summit, and continue looking for the predecessors of the predecessors until I was at the starting point S. Is my solution correct? Thank you!