category stringclasses 107
values | title stringlengths 15 179 | question_link stringlengths 59 147 | question_body stringlengths 53 33.8k | answer_html stringlengths 0 28.8k | __index_level_0__ int64 0 1.58k |
|---|---|---|---|---|---|
graph theory | Proof that n-dependent Set in Graph theory is NP Complete | https://cs.stackexchange.com/questions/132334/proof-that-n-dependent-set-in-graph-theory-is-np-complete | <p>Consider an undirected graph <span class="math-container">$G$</span>. A subset <span class="math-container">$S \subseteq V(G)$</span> is n-dependent if for every <span class="math-container">$x \in S, d_{<S>}(x) \leq n-1$</span>. The n-dependence number of <span class="math-container">$G$</span>, denoted <span... | 100 | |
graph theory | Difference between graph-partitioning and graph-clustering | https://cs.stackexchange.com/questions/54683/difference-between-graph-partitioning-and-graph-clustering | <p>What is the difference between graph-partitioning and graph-clustering in graph theory?</p>
| <p>Graph partitioning and graph clustering are informal concepts, which (usually) mean partitioning the vertex set under some constraints (for example, the number of parts) such that some objective function is maximized (or minimized). We usually have some specific constraints and objective function in mind. However <e... | 101 |
graph theory | A Question about a Question related to Graph Theory and Maximum Flow | https://cs.stackexchange.com/questions/88899/a-question-about-a-question-related-to-graph-theory-and-maximum-flow | <p>The following question is from the book "Introduction to Algorithms" By Cormen and three other authors.</p>
<p>$26.2-10$<br>
Show how to find a maximum flow in a network $G = (V,E)$ by a sequence of at
most $|E|$ augmenting paths. (Hint: Determine the paths after finding the maximum
flow.)</p>
<p>I find this quest... | <p>It's asking you to prove that there exists a sequence of $|E|$ augmenting paths that yields the maximum flow.</p>
<p>The hint suggests: suppose you already knew the maximum flow. Then use that information to choose $|E|$ augmenting paths, that will yield that maximum flow.</p>
<p>Yes, this sounds weird. Obviousl... | 102 |
graph theory | A question about the graph theory or data structure and algorithms | https://cs.stackexchange.com/questions/155295/a-question-about-the-graph-theory-or-data-structure-and-algorithms | <p>I would like to ask this question as I am not sure about the answer.</p>
<p>Let <span class="math-container">$G=(V,E)$</span> be a connected, undirected graph, and let <span class="math-container">$x,y\in V$</span> be two different vertices. Let <span class="math-container">$A$</span> be the problem of finding the s... | <p>Problem <span class="math-container">$A$</span> can be solved in polynomial time. Problem <span class="math-container">$B$</span> is NP-hard.
This means that options 2 and 5 are certainly false.</p>
<p>We don't know whether option 1 is true. If it is true is, then P=NP.</p>
<p>Option 3 is currently true (but might b... | 103 |
graph theory | What is the proper way to write logic formula, say concerning graph theory? | https://cs.stackexchange.com/questions/157369/what-is-the-proper-way-to-write-logic-formula-say-concerning-graph-theory | <p>Say for example I'd like to state that there exists a pair of vertices such that they form an edge in one graph but not some other graph. I'd go about it as follows:</p>
<p><span class="math-container">$$ \exists u, v \in V, (u,v) \in G, (u,v) \not\in H $$</span></p>
<p>My main question here is: Is my use of commas ... | <p>The standard logical notation I have seen among computer scientists for saying there exists <span class="math-container">$x \in X$</span> such that <span class="math-container">$\varphi(x)$</span> holds is to write</p>
<p><span class="math-container">$$\exists x \in X . \varphi(x).$$</span></p>
<p>In other words, we... | 104 |
graph theory | Rank of a graph in matroid theory | https://cs.stackexchange.com/questions/150541/rank-of-a-graph-in-matroid-theory | <p>I was going through the concept of graphs as matroids and I came upon the rank of a graph. Wikipedia lists it as <span class="math-container">$n - c$</span>, <span class="math-container">$n = |V|$</span>, <span class="math-container">$c =$</span> # of connected components.</p>
<p>I do understand rank and nullity of ... | <p>The rank of a graphical matroid is the size of a spanning forest, which consists of a spanning tree in each connected component. A spanning tree for a connected component of size <span class="math-container">$m$</span> contains <span class="math-container">$m - 1$</span> edges. Summing this over all connected compon... | 105 |
graph theory | Graph theory: BFS (Breadth First Search) - why is current processed first? | https://cs.stackexchange.com/questions/117964/graph-theory-bfs-breadth-first-search-why-is-current-processed-first | <p>I am referencing some code I found on GeeksForGeeks.com: Why is the current node printed (and processed) first before its children are processed? Wouldn't "breadth first" mean "Process children first, then process parent"? or, is that only for Trees? I can't be the only one to not understand this, so instead of flam... | <p>1) In answer to the semantic question "Wouldn't 'breadth first' mean 'Process children first, then process parent'?"</p>
<p>This question is a duplicate of the following: <a href="https://cs.stackexchange.com/questions/107187/what-is-the-meaning-of-breadth-in-breadth-first-search">What is the meaning of 'breadt... | 106 |
graph theory | Formulate the Marriage Problem into a Maximum-flow problem (Graph theory) | https://cs.stackexchange.com/questions/33569/formulate-the-marriage-problem-into-a-maximum-flow-problem-graph-theory | <p>Suppose I have $M=\{1,\ldots, n\}$ men and $W = \{1, \ldots, n\}$ women and $B =\{1, \ldots, m\}$ brokers, such that each broker knows a subset of $M \times W$ and for each pair in this subset a marriage can be set up among the corresponding man and women.</p>
<p>Each broker $i$ can set up a maximum of $b_i$ marria... | <p>You shouldn't need to keep track of state. This can all be handled with capacity constraints over the nodes. The network can be structured as follows:</p>
<p>Start with the graph where one partition consists only of the "men" nodes and the other partition consists of the "women" nodes. Now, add a node for each brok... | 107 |
graph theory | Applications of Graph Automorphisms | https://cs.stackexchange.com/questions/65391/applications-of-graph-automorphisms | <p>I've seen the topic of the automorphism group appear in several introductory graph theory books I've looked at. It always feel oddly disjointed and poorly motivated to me.</p>
<p>Is there any practical (or impractical for that matter) applications of knowing the automorphism group of a graph?</p>
| <p>Automorphism capture a natural notion of symmetry of graphs. As a result, they can be used to speed up algorithms that would otherwise run slowly by chopping down the search space.</p>
<p>For example, integer programming is usually solved via branch-and-bound. However, if an equation is degenerate this can take far... | 108 |
graph theory | Using an undirected graph to represent an ordered pair? | https://cs.stackexchange.com/questions/151497/using-an-undirected-graph-to-represent-an-ordered-pair | <p>Set theory depends on a set membership function <span class="math-container">$\epsilon$</span> which is a class of ordered pairs. Is it possible to construct <em>the ordered pair</em> from an undirected graph of <em>unordered pairs</em>? Alternatively, is there a way to construct a undirected graph that represents... | 109 | |
graph theory | What does "local" mean? | https://cs.stackexchange.com/questions/86260/what-does-local-mean | <p>I study graph theory on my own using Diestel's <em>Graph Theory</em> book (with Algorithmic graph theory in mind). I don't understand what <em>local property</em>, <em>global property</em>, <em>locality</em> mean given a graph $G$. </p>
<p>For example, on the page 5 it says </p>
<blockquote>
<p>The average degre... | <p><strong>Local property</strong> - a property that relates to a specific vertex and its near neighbors. For example, the number of neighbors or 2nd order neighbors a vertex $v$ has. "<em>locally looks like a tree</em>" more formally could be written as the sub-graph of vertices with distance $k$ or less of the vertex... | 110 |
graph theory | Understanding The Mapping Of Edges to Nodes In A Graph Theory Problem | https://cs.stackexchange.com/questions/59995/understanding-the-mapping-of-edges-to-nodes-in-a-graph-theory-problem | <p>I am really confused with this <a href="https://community.topcoder.com/stat?c=problem_statement&pm=13707" rel="nofollow">problem</a>.</p>
<p><strong>Here's the problem:</strong> <br></p>
<p>You have $N$ points numbered $1$ through $N$,inclusive, and $N$ arrows again numbered $1$ through $N$,inclusive. No two a... | <p>$a[0] = 1, a[1] = 2, a[2] = 3$. </p>
<p>"The arrow from place $i$ points to place $a[i−1]$"</p>
<p>So yes, all $3$ places in this sample point to themselves. It actually says in the explanation that "in each round each token will stay in the same place". </p>
<p>In the second sample, all three places point toward... | 111 |
graph theory | Research on exact-cover problem and graph theory for NP-complete problems? | https://cs.stackexchange.com/questions/142318/research-on-exact-cover-problem-and-graph-theory-for-np-complete-problems | <p>Sorry for the vagueness, but I'm trying to study the latest progress on the exact cover problem and using graphs for NP-complete problems. Googling around has not been very helpful. I understand the basics but I can't find a key journal in this area or where to look online. Any references would be greatly appreciate... | 112 | |
graph theory | What is the difference between regular trees and phylogenetic trees in terms of graph theory? | https://cs.stackexchange.com/questions/49355/what-is-the-difference-between-regular-trees-and-phylogenetic-trees-in-terms-of | <p>If I am not mistaken, a tree is any graph that does not contain cycles.</p>
<p>However, I am currently taking a bioinformatics course where we deal a lot with algorithms on phylogenetic trees. Usually you are given a phylogenetic tree with <span class="math-container">$n$</span> leafs, and then you run some algorith... | <p>Phylogenetic trees are usually "full binary trees", that is rooted trees in which every internal node has exactly two children. A full binary tree having $n$ leaves has exactly $2n-1$ nodes.</p>
| 113 |
graph theory | How to find a Graph Embedding given a metric space? | https://cs.stackexchange.com/questions/90473/how-to-find-a-graph-embedding-given-a-metric-space | <p>I am interested to learn more about <a href="https://math.stackexchange.com/questions/520768/whats-the-relation-between-topology-and-graph-theory">topological graph theory</a> and <a href="https://en.wikipedia.org/wiki/Graph_embedding" rel="nofollow noreferrer">Graph Embedding</a>.</p>
<p>Assume I have a <a href="h... | 114 | |
graph theory | Can any object be written as a graph? | https://cs.stackexchange.com/questions/48888/can-any-object-be-written-as-a-graph | <p>Lately graph theory has come into everyday practice with graph databases. So I wonder if any object can be written as a graph? I don't have the formal definition of an object, but say it is a C <code>struct</code> or a Java <code>Object</code>, isn't it so that we can express objects as graphs and that it is a more ... | 115 | |
graph theory | Undirected graph with exponential number of simple cycles | https://cs.stackexchange.com/questions/101241/undirected-graph-with-exponential-number-of-simple-cycles | <p>Hey I am new to graph theory and this question has me stuck for hours.</p>
<p>What is an example of undirected graph with n nodes where the number of simple cycles is exponential in n.</p>
<p>I was looking at complete graphs, but here's the catch: the total number of edges should be in theta of n.</p>
<p>Please h... | <p><a href="https://en.wikipedia.org/wiki/M%C3%B6bius_ladder" rel="nofollow noreferrer">The Möbius ladder</a> <span class="math-container">$M_{2n}$</span>, also called pizza graph, which has <span class="math-container">$2n$</span> vertices and <span class="math-container">$3n$</span> edges, have <span class="mat... | 116 |
graph theory | How to remove cycles from a directed graph | https://cs.stackexchange.com/questions/90481/how-to-remove-cycles-from-a-directed-graph | <p>I saw <a href="https://stackoverflow.com/questions/6284469/how-to-remove-cycles-in-an-unweighted-directed-graph-such-that-the-number-of-ed">this</a> from SO which led to <a href="https://en.wikipedia.org/wiki/Feedback_arc_set" rel="noreferrer">Feedback Arc Set</a>, which describes the problem nicely:</p>
<blockquot... | <p>There is a paper "breaking cycles in noisy hierarchies" which talks about leveraging graph hierarchy to delete cycle edges to reduce a directed graph to a DAG. </p>
<p>The reduced DAG will maintain the graph hierarchy of the original graph as much as possible. </p>
<p>The corresponding code is available on Github:... | 117 |
graph theory | Is there an algorithm for getting the boundary of a non-planar graph? | https://cs.stackexchange.com/questions/124367/is-there-an-algorithm-for-getting-the-boundary-of-a-non-planar-graph | <p>This is my first question here!</p>
<p>If I have a non-planar graph where every vertex connects to 3 other vertices, and where the edges are allowed to intersect, how do I find the boundary of the graph?</p>
<p>For example in the below graph, the pink line shows the boundary of the graph which needs to be found. The... | 118 | |
graph theory | number of edges in a graph | https://cs.stackexchange.com/questions/23532/number-of-edges-in-a-graph | <p>I got a problem related to graph theory - </p>
<p>Consider an undirected graph ܩ where self-loops are not allowed. The vertex set of G is
{(i,j):1<=i,j <=12}. There is an edge between (a, b) and (c, d) if |a-c|<=1 and |b-d|<=1
The number of edges in this graph is </p>
<p>Answer is given as 506
but I am... | <p>For a grid in the range of $[n_1,n_2]$, according to the problem statment, the number of edges is:</p>
<p>$$\#edges=\frac{8 \times (n_2-n_1+1)^2- 4\times 5-4\times3\times(n_2-n_1-1)}{2}$$</p>
<p><strong>explanation</strong>:
suppose every node has a degree of 8, then sum of the degrees is $8\times(n_2-n_1+1)^2$; F... | 119 |
graph theory | Memory needed for computational graph | https://cs.stackexchange.com/questions/67711/memory-needed-for-computational-graph | <p>Suppose we have a set of equations like this</p>
<pre><code>p7=f(p1+p6); p6=f(p2+p5); p5=f(p3+p4); p4=f(p3); p3=f(p2); p2=f(p1); p1=f()
</code></pre>
<p>It can be represented by computational graph below</p>
<p><img src="https://i.sstatic.net/LKTOM.png" width="352" height="352"> </p>
<p>If each intermediate valu... | <p>Your problem sounds similar to one-shot (black) pebbling. <a href="https://www.jair.org/media/4030/live-4030-7803-jair.pdf" rel="nofollow noreferrer">Wu, Austrin, Pitassi, and Liu</a>, in their paper titled <em>Inapproximability of treewidth, one-shot pebbling, and related layout problems</em> (J. Artificial Intelli... | 120 |
graph theory | How to solve an arrangement problem at the Archive Nationale of France using graph theory? | https://cs.stackexchange.com/questions/48511/how-to-solve-an-arrangement-problem-at-the-archive-nationale-of-france-using-gra | <p>Good evening! I'm actually doing an internship at the Archives Nationales of France and I encountered a situation I wanted to solve using graphs...</p>
<h1>I. The dusty situation</h1>
<p>We want to optimize the arrangement of books of my library according to their height in order to minimize their archive cost. The ... | <p>I see you as asking, "I want to solve this with Dijkstra's algorithm but I can't set up a good graph to run on," therefore I will present you with such a graph.</p>
<h1>A digraph where vertices are sets of shelved books.</h1>
<p>Okay, we have books with heights $H_n,$ $1 \le n \le N$ and widths $W_n,$ with heights... | 121 |
graph theory | Directed Trees: Finding all the edges and vertices in a specific direction | https://cs.stackexchange.com/questions/112388/directed-trees-finding-all-the-edges-and-vertices-in-a-specific-direction | <p>I am an electrical engineer without experience in graph theory. However, I have a problem which I believe can be solved by graph theory. We have a directed tree, such as the one below. We want to find all the vertices and edges starting from a vertex in a given direction. For instance, in the figure below, we want t... | 122 | |
graph theory | Is this graph Hamiltonian? | https://cs.stackexchange.com/questions/141068/is-this-graph-hamiltonian | <p>My case is a <em>directed</em> graph with <span class="math-container">$n$</span> nodes with <span class="math-container">$(n-1)^2+1$</span> edges. I have done the following till now.</p>
<p>We know that the maximum number of edges for a directed graph <span class="math-container">$K_n$</span> on <span class="math-c... | <p>The complete digraph of <span class="math-container">$n$</span> nodes, <span class="math-container">$K_n$</span> has <span class="math-container">$n(n-1)$</span> edges. Describe a digraph of <span class="math-container">$n$</span> nodes with <span class="math-container">$n(n-1)-\delta$</span> edges as a digraph &quo... | 123 |
graph theory | Finding a Hamiltonian Path through the complete graph on 37 vertices: $K_{37}$ | https://cs.stackexchange.com/questions/39833/finding-a-hamiltonian-path-through-the-complete-graph-on-37-vertices-k-37 | <p>I'm planning on making a fiber art $K_{37}$ (like the one I laser etched with help: <a href="http://www.thingiverse.com/thing:88130" rel="nofollow">K37: The complete graph on 37 nodes, svg</a>). To accomplish this, the plan is to construct 37 pegs equally spaced in a annulus made from wood and then to string yarn be... | <p>It seems that you're trying to construct the graph $K_{37}$ from string and nails without cutting the string. For this, you don't want a <a href="https://en.wikipedia.org/wiki/Hamiltonian_path" rel="nofollow">Hamiltonian path</a> (a path that visits every vertex exactly once) but an <a href="https://en.wikipedia.or... | 124 |
graph theory | Clarification sought for definition of a cut that respects a set A of edges in Graph Theory | https://cs.stackexchange.com/questions/14607/clarification-sought-for-definition-of-a-cut-that-respects-a-set-a-of-edges-in-g | <p>From CLRS (3rd edition), I came have this question on page 626:</p>
<p>Given these definitions from the text,</p>
<p>DEFINITIONS:
Given an undirected graph G = (V,E),
<p>1. A CUT (S ,V-S) of G is a partition of V,
<p>2. A LIGHT EDGE over a cut is any edge crossing the cut with a weight smaller than or equal to an... | <p>One mistake you're making with the statement:</p>
<blockquote>
<p>In every example in the text, the set A is coincident with one of the partitions of the cut but I cannot see why this must be.</p>
</blockquote>
<p>$A$ is a set of <em>edges</em>, while a cut is a partition of <em>vertices</em>: $(S, V - S)$.</p>
... | 125 |
graph theory | In the dataflow programming paradigm programs are modeled as directed graphs. Are the edges of the graph variables? And are the vertexes functions? | https://cs.stackexchange.com/questions/128583/in-the-dataflow-programming-paradigm-programs-are-modeled-as-directed-graphs-ar | <p>As I understand it in dataflow programming, programs are structured as directed graphs, an example of which is below
<a href="https://i.sstatic.net/qII4K.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qII4K.png" alt="enter image description here" /></a></p>
<p>Is it true to say that the arrows (or ed... | <p>To be precise, the nodes represent the <em><strong>blocks</strong></em> (consisting a set of statements) and the edges represent <em><strong>possible data flow</strong></em> (the execution path).</p>
<p>Now basically the data flow analysis gives the information regarding the definition and use of data in the program... | 126 |
graph theory | Is There a Term for "Factoring" a Graph by an Equivalence Relation on Nodes? | https://cs.stackexchange.com/questions/152000/is-there-a-term-for-factoring-a-graph-by-an-equivalence-relation-on-nodes | <p>I have a coding problem I'm running into that feels like it's solved:</p>
<p>Given a (directed) graph, and an equivalence relation on nodes, merge the equivalent nodes in a way that preserves the graph structure to create a "factor" graph, in the sense that every edge connected to one of the equivalent nod... | 127 | |
graph theory | Find closed loops in an undirected graph given an adjacency list | https://cs.stackexchange.com/questions/56076/find-closed-loops-in-an-undirected-graph-given-an-adjacency-list | <p>I am trying to find all the cycles in an undirected graph given the adjacency list of the vertices, with the an output of all the cycles in form of the vertices they are made up of.</p>
<p>For example -<a href="https://i.sstatic.net/Ku4fd.jpg" rel="nofollow noreferrer">https://i.sstatic.net/Ku4fd.jpg</a></p>
<p>Th... | 128 | |
graph theory | Given all maximal independent sets of a graph, find the maximum indepdent set | https://cs.stackexchange.com/questions/93405/given-all-maximal-independent-sets-of-a-graph-find-the-maximum-indepdent-set | <p>I am new to this independent set problem in graph theory. As per my understanding so far an independent set is a set of vertices in which no two vertices are adjacent. And the maximal independent set is a set of vertices in which if some vertex is added it will construct an edge. </p>
<p>I understand this now my qu... | <p>If an independent set is <em>maximal</em>, it means you cannot add any more vertices into the set. As you correctly suggest, this does <em>not</em> mean that the set is necessarily a maximum independent set in the graph. </p>
<p>You are also correct in saying that every maximum independent set is maximal, and that ... | 129 |
graph theory | n-Cube as a Cayley Graph | https://cs.stackexchange.com/questions/23724/n-cube-as-a-cayley-graph | <p>I'm taking a class on graph theory that uses "Graph Theory (Graduate Texts in Mathematics)" by Bondy and Murty. One of the questions is about Cayley graphs and the n-cube, and I don't understand how to interpret it. It runs as follows:</p>
<blockquote>
<p>Let $\Gamma$ be a group and $S$ be a subset of $\Gamma$ no... | <p>The question is asking you to find a suitable group $\Gamma$ and a subset $S$, so that $CG(\Gamma,S)$ is the n-cube.</p>
<p>Since by definition of $CG$, the nodes are the elements of $\Gamma$, you don't have a choice here, leaving the group operation and $S$.</p>
<p>$xy$ and the inverse of $y$ are then understood ... | 130 |
graph theory | Reference request on computer networks | https://cs.stackexchange.com/questions/142304/reference-request-on-computer-networks | <p>I read about correctness of iterative and recursive algorithms.I need a sequence of book recommendations for learning mathematical aspects of computer networks and data communtions such as applications of graph theory and number theory in routing and security and error control respectively.Please provide layerwise r... | 131 | |
graph theory | What is the difference between Partition and Division? | https://cs.stackexchange.com/questions/139384/what-is-the-difference-between-partition-and-division | <p>While reading graph theory, I came across different definitions where they use partitions and divisions, I was wondering, are these terms same or different?</p>
<p>Can anyone explain me their difference in Set Theory?</p>
<p>I know this is a simple question but anyone hardly talk about it but they always make here a... | <p><strong>I will explain this with an example :</strong></p>
<p><em>Consider a set <span class="math-container">$S$</span> which contains a collections of sets with a constant k such that:</em>
<span class="math-container">$$ S = \{ \{S_1\}, \{S_2\}, \{S_3\},\{S_4\},..........\{S_k\} \}$$</span></p>
<h3>In Partition o... | 132 |
graph theory | Space complexity of directed and undirected graph | https://cs.stackexchange.com/questions/49062/space-complexity-of-directed-and-undirected-graph | <p>I have started reading graph theory from <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow">Introduction to Algorithm</a>. The author starts by saying that if the graph is dense then:</p>
<p>$$|E|\text{ close to }|V|^2$$ else if the graph is sparse then:</p>
<p>$$|E|\text{ is much less... | <p>It's hard to know for sure from what you've written, but I suspect what you're doing wrong is that you're considering what the space requirement would be for a complete graph. For a complete graph, the space requirement for the adjacency list representation is indeed $\Theta(V^2)$ -- this is consistent with what is... | 133 |
graph theory | Does an algorithm exist that transforms any connected graph, cyclic or not, into tree form? | https://cs.stackexchange.com/questions/126500/does-an-algorithm-exist-that-transforms-any-connected-graph-cyclic-or-not-into | <p>I developed an algorithm that transforms any simple connected graph, cyclic or not, into a tree.
The resulting tree is syntax-preserving, in a sense that it allows to reconstruct the original input graph and only the original input graph. In other words, the constructed tree preserves adjacency information, while re... | <p>In a general graph, the number of edges can go up to <span class="math-container">$\mathcal{O}(n^2)$</span> (where n is the number of verticies). But in a tree, that number is always <span class="math-container">$n-1$</span>.</p>
<p>Then, we understand that its impossible to convert a graph to a tree preserving syn... | 134 |
graph theory | Doubt in vertex connectivity less than edge connectivity | https://cs.stackexchange.com/questions/109400/doubt-in-vertex-connectivity-less-than-edge-connectivity | <p>Sir i recently started graph theory. I understood the reason why edge connectivity is less than min degree(remove all vertices incident to min degree vertex). I have doubt in 2nd part of proof when given graph is not complete graph. how to prove here vertex connectivity less than edge connectivity?
confused here. Pl... | <p>I'm not sure I understand your question, so this is the specific question I'm answering:</p>
<blockquote>
<p>Why is the vertex connectivity of a graph always less than or equal to its edge connectivity?</p>
</blockquote>
<p>If that's wrong, please let me know in the comments or edit the question.</p>
<hr>
<p>T... | 135 |
graph theory | Intuition behind eigenvalues of an adjacency matrix | https://cs.stackexchange.com/questions/109963/intuition-behind-eigenvalues-of-an-adjacency-matrix | <p>I am currently working to understand the use of the <a href="https://en.wikipedia.org/wiki/Cheeger_bound" rel="noreferrer">Cheeger bound</a> and of Cheeger's inequality, and their use for spectral partitioning, conductance, expansion, etc, but I still struggle to have a start of an intuition regarding the second eig... | <p>The second (in magnitude) eigenvalue controls the rate of convergence of the random walk on the graph. This is explained in many lecture notes, for example <a href="https://web.archive.org/web/20170829012125/https://people.eecs.berkeley.edu/%7Eluca/cs278-08/lecture11.pdf" rel="nofollow noreferrer">lecture notes of L... | 136 |
graph theory | Directed Acyclic Graph partition into minimum subgraphs with a constraint | https://cs.stackexchange.com/questions/112221/directed-acyclic-graph-partition-into-minimum-subgraphs-with-a-constraint | <p><a href="https://i.sstatic.net/20JSo.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/20JSo.jpg" alt="enter image description here"></a></p>
<p>I have this problem, not sure there is a name for it, wherein a Directed Acyclic Graph has different colored nodes. The idea is to partition it into minimum n... | 137 | |
graph theory | What are some applications of computing the permanent of a matrix? | https://cs.stackexchange.com/questions/14438/what-are-some-applications-of-computing-the-permanent-of-a-matrix | <p>What are some applications that require computing the <a href="http://en.wikipedia.org/wiki/Permanent" rel="nofollow">permanent of a matrix?</a></p>
<p>One application I know of is related to graph theory and matchings. Apparently, the number of perfect matchings of a bipartite graph is the permanent of its inciden... | <p>Valiant proved that <a href="http://en.wikipedia.org/wiki/Permanent_is_sharp-P-complete" rel="noreferrer">the permanent is $\# P$-complete</a>, which means that an efficient algorithm for computing the permanent can be used to solve any problem in <a href="http://en.wikipedia.org/wiki/Sharp-P" rel="noreferrer">$\# P... | 138 |
graph theory | Is there a "well known" example of a constraint satisfaction problem on a 3-element set which is polynomial-time solvable? | https://cs.stackexchange.com/questions/98307/is-there-a-well-known-example-of-a-constraint-satisfaction-problem-on-a-3-elem | <p>I'm basically looking for an example (in maybe graph theory) of a constraint satisfaction problem which has a 3-element set as a domain and the problem is known to be polynomial-time solvable.</p>
| <p>If you want a graph, it needs to be bipartite. Hence the path of two edges or any subgraph thereof. (Here I am following the convention that graphs have no loops. As David Richerby points out in a comment, graphs with loops also have polynomial-time CSPs (by virtue of triviality).)</p>
<p>A more interesting example... | 139 |
graph theory | N-Guest Table, Graph Problem | https://cs.stackexchange.com/questions/77178/n-guest-table-graph-problem | <p>The Queen of England wants to organize a set of tables for n guests talking different languages. The tables have to be set in a way that every guest can speak to his neighbor on the right and his neighbor on the left.</p>
<p>Four possibilities come up :
1- One table for all guests.
2- One table for all guests, but ... | 140 | |
graph theory | Is the optimal order of graph vertices s.t. minimizes edges to later vertices a well-known problem? | https://cs.stackexchange.com/questions/68894/is-the-optimal-order-of-graph-vertices-s-t-minimizes-edges-to-later-vertices-a | <p>I'm a little unfamiliar with graph theory, and I found an interesting problem in my work that I do not know if its already well-known or can be easily mapped to another one. If I were to express the problem more formally:</p>
<p>Given a directed unweighted graph $\langle V,E \rangle$, find a total order between ver... | <p><a href="https://cs.stackexchange.com/a/68906/1984">Szymon Stankiewicz</a> is right -- this problem is basically Feedback Arc Set, which is unfortunately NP-complete. But I have to mention that a very similar graph property, which goes by the slightly alarming name of <em>agony</em>, can actually be computed in jus... | 141 |
graph theory | Proving Clique Number of a Regular Graph | https://cs.stackexchange.com/questions/90799/proving-clique-number-of-a-regular-graph | <p>I am very new to Graph Theory and I am trying to prove the following statement from a problem set for my class: </p>
<p>Prove that if G is a regular graph on n vertices $(n \ge 2)$, then $\omega(G) \in \{1, 2, 3,... \lfloor n / 2 \rfloor, n\}$</p>
<p>I am confused by the part where it places the clique number to... | <p>Let $G$ be a $d$-regular graph on $n$ vertices containing an $a$-clique $A$, and let $B$ denote the other $b:=n-a$ vertices. Suppose that $a>b$.</p>
<p>Let $e$ be the number of edges connecting $A$ to $B$. Every vertex in $A$ has $a-1$ edges going to the other vertices in $A$, and so $d-(a-1)$ edges going to ver... | 142 |
graph theory | determine Eulerian or Hamiltonian | https://cs.stackexchange.com/questions/140167/determine-eulerian-or-hamiltonian | <p><a href="https://i.sstatic.net/tzRlh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tzRlh.png" alt="enter image description here" /></a></p>
<p>I am a beginner in graph theory and just found this question in a book after completing few topics and I was wondering how you approach this questions.
For e... | <p>That's a very good question, and the easy answer is that checking whether a graph is Eulerian is much simpler than checking whether a graph is Hamiltonian. You're diving head-first into the field of complexity theory and the famous question <a href="https://en.wikipedia.org/wiki/P_versus_NP_problem" rel="noreferrer... | 143 |
graph theory | Find all combinations of adjacent records matching a graph template | https://cs.stackexchange.com/questions/145901/find-all-combinations-of-adjacent-records-matching-a-graph-template | <p>I have a graph theory or combinatorics problem that probably has a solution, but I haven't been able to find it. The problem can be simple: in the second figure below, choose one yellow block from each oval such that the blue edges between the blocks look like the edges in the first figure below. Find all possible s... | <p>If I understand your problem accurately, it is NP-hard. As such, there is no efficient solution.</p>
<p>I will show a reduction from 3SAT. In particular, suppose we have a 3SAT formula <span class="math-container">$\varphi$</span> with variables <span class="math-container">$x_1,\dots,x_m$</span> and <span class="... | 144 |
graph theory | Why does Skiena reserve space for n+1 adjacency lists? | https://cs.stackexchange.com/questions/57722/why-does-skiena-reserve-space-for-n1-adjacency-lists | <p>I am reading up on graph theory from the book <em>Algorithm Design Manual - Skiena</em>. And he shows a structure of a graph as follows : </p>
<pre><code>#define MAXV 100 /* maximum number of vertices */
#define MAXDEGREE 50 /* maximum outdegree of a vertex */
typedef struct {
int v; ... | <p>Note that the author uses 1 instead of 0 as the starting point of an array $A$. In other words, $A[0]$ is wasted. For example, to initialize a graph:</p>
<pre><code>for (i=1; i<=MAXV; i++) g->degree[i] = 0;
</code></pre>
<hr>
<p>By the way, in the <em>second edition</em> of this book, it is (Section 5.2):</... | 145 |
graph theory | What is theory behind graphs relations? | https://cs.stackexchange.com/questions/28135/what-is-theory-behind-graphs-relations | <p>I have been trying to understand, what is the actual meaning of 2 graphs being:</p>
<pre><code>Symmetric
Transitive
Reflexive
A graph being a subgraph of another graph
</code></pre>
<p>And other similar relations if let's say I have two graphs containing 1000's of nodes and edges. Then, what do these terms mean w.... | <p>I have never seen the first three properties applied to a graph in the way that you are asking, however the final property, sub graphs, is strait forward.</p>
<p>By definition: A subgraph of a graph G is a graph whose vertex set is a subset of that of G, and whose adjacency relation is a subset of that of G restric... | 146 |
graph theory | Decomposition of graph to subgraphs according to parallel edges | https://cs.stackexchange.com/questions/117696/decomposition-of-graph-to-subgraphs-according-to-parallel-edges | <p>I am supposed to calculate all-pair shortest path lengths of a graph. However, I first need the graph to be decomposed/expanded to a <strong>simple</strong> one based on the presence of parallel edges. </p>
<p>If N parallel edges exist between any two vertices <strong>A</strong> and <strong>B</strong>, I need to cr... | 147 | |
graph theory | How was the four color theorem proved using brute-force search? | https://cs.stackexchange.com/questions/118873/how-was-the-four-color-theorem-proved-using-brute-force-search | <p>I recently learned some graph theory in Discrete Structures for Computer Science, we learned about the Four Color theorem, I realize there is a mathematical proof for this topic, but how was it initially proved using computation 50 years ago?</p>
| 148 | |
graph theory | Prove that at least as many edges as vertices implies a cycle | https://cs.stackexchange.com/questions/66391/prove-that-at-least-as-many-edges-as-vertices-implies-a-cycle | <p>I am EXTREMELY confused on where to start with this problem. We recently just started learning about graph theory and I don't know where to begin.</p>
<blockquote>
<p>Prove that in a connected graph G with $p$ vertices, $q$ edges, and at least one cycle, $q \ge p$</p>
</blockquote>
<p>How do I begin with this qu... | <p>Graph has a cycle on $k$ vertices implies that those vertices are connected with $k$ edges. Also, the graph is connected so $p-k$ vertices which left should be connected to the cycle, that means extra $p-k$ edges (distinct end points). Totally the graph has more($\geq$) than $p$ edges. </p>
| 149 |
graph theory | Status on Naoki Katoh's "Rectangle Wiring Problem" (minimum length tree to cover a partitioned rectangle)? | https://cs.stackexchange.com/questions/119665/status-on-naoki-katohs-rectangle-wiring-problem-minimum-length-tree-to-cover | <p>I have found this interesting problem in graph theory and geometry which is allegedly an open problem but latest status seems to be from 01/25/02. I can't seem to find any more information about it, not even other papers describing it.</p>
<p><a href="https://i.sstatic.net/jT7Ub.png" rel="nofollow noreferrer"><img ... | <p>This problem has been studied since 2002, under the name <em>minimum-length corridor problem</em>. </p>
<p>The problem is known to be NP-complete[1,2], but there is a constant factor polynomial time approximation algorithm[3].</p>
<p>There is more work on this problem, which you can find by searching the citation ... | 150 |
graph theory | is it necessary to cover all the verticies in eular path? | https://cs.stackexchange.com/questions/92930/is-it-necessary-to-cover-all-the-verticies-in-eular-path | <p>I was going through graph theory and came across the term Euler path or some people prefer Euler trail as vertices can repeat.</p>
<p>According to the definition from wiki (<a href="https://en.wikipedia.org/wiki/Eulerian_path" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Eulerian_path</a>), Euler path is... | <p>It really comes down to your definition of an Euler trail. The one I'm familiar with is similar to the one on Wikipedia:</p>
<blockquote>
<p>An <em>Euler trail</em> is a trail (path that allows repeats) that uses every edge exactly once.</p>
</blockquote>
<p>With this definition, an Euler trail doesn't have to t... | 151 |
graph theory | Find all the ways to choose $k$ objects from a list of $n$ objects (using a graph?) | https://cs.stackexchange.com/questions/138207/find-all-the-ways-to-choose-k-objects-from-a-list-of-n-objects-using-a-grap | <p>I was playing around with graph theory and I noticed that a directed integer graph with unique vertices <span class="math-container">$V$</span> and edges <span class="math-container">$E$</span> such that each vertex only points to vertices with a higher value can be used to enumerate all <span class="math-container"... | <p>To generalize your approach to <span class="math-container">$k$</span>-subsets of an <span class="math-container">$n$</span>-set, you would need to build a hypergraph. Ordinary graph edges are relations between <em>pairs</em> of vertices. Hypergraphs allow relations between arbitrary sets of vertices. They are <em>e... | 152 |
graph theory | About computer science and category theory | https://cs.stackexchange.com/questions/23872/about-computer-science-and-category-theory | <p>I read that Category Theory has alot to do with how programs and information can be organised.Can Category theory simplify various programming strategies? If a specific Category is represented as a directed graph is this similar to flow charts used in programming?</p>
| 153 | |
graph theory | Is it possible to have a 2 by 2 rigid framework without having a corresponding connected bipartite graph? | https://cs.stackexchange.com/questions/159737/is-it-possible-to-have-a-2-by-2-rigid-framework-without-having-a-corresponding-c | <p>According to the theorem(see reference) on the rigidity of frameworks:</p>
<blockquote>
<p>A rectangular framework is rigid if and only if its associated bipartite graph is connected.</p>
</blockquote>
<p>Now consider the case for a 2-by-2 rectangular framework.</p>
<p><a href="https://i.sstatic.net/XPgX3s.png" rel=... | <p>The picture shows that the given framework is not a rigid framework since it can be skewed in the following manner:</p>
<p><a href="https://i.sstatic.net/KDGPO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KDGPO.png" alt="enter image description here" /></a></p>
| 154 |
graph theory | minimum number of edges that should be added to an undirected graph to make it a tree | https://cs.stackexchange.com/questions/134364/minimum-number-of-edges-that-should-be-added-to-an-undirected-graph-to-make-it-a | <p>Basically, it's this <a href="http://rosalind.info/problems/tree/" rel="nofollow noreferrer">rosalind</a> problem.</p>
<p>You're given a number of nodes and an adjacency list.
My initial guess was that the answer was the number of connected components minus 1, since by joining every connected component you would hav... | <p>Your first guess is correct. Sometimes there is more than one way to write the same solution.</p>
<p>Clearly, if there are <span class="math-container">$k$</span> connected components you'll need exactly <span class="math-container">$k-1$</span> edges to connect them (without forming any cycle).</p>
<p>On the other ... | 155 |
graph theory | I want to learn more about computer science. Where should I start? | https://cs.stackexchange.com/questions/131528/i-want-to-learn-more-about-computer-science-where-should-i-start | <p>Hello computer scientists,</p>
<p>I am a mathematician. I have taken some undergraduate courses in C++, Python, assembly language, boolean algebra, logic, graph theory, etc. I would like to learn more about computer science because I think it's cool. Could you give me some advice as to where to start? Thanks!</p>
| <p>This sounds like a better fit for say academia.stackexchange, as this is mostly subjective, so bear in mind this is mostly "just my opinion".</p>
<hr />
<p>My advice would be to start with Algorithms, at a high level: learning about the big algorithmic paradigms (greedy, dynamic, linear programming...), ru... | 156 |
graph theory | How to Prove NP-Completeness of Minimum Crossing Problem? | https://cs.stackexchange.com/questions/44296/how-to-prove-np-completeness-of-minimum-crossing-problem | <blockquote>
<p>In graph theory, the crossing number cr(G) of a graph G is the lowest
number of edge crossings of a plane drawing of the graph G.
(from wikipedia)</p>
</blockquote>
<p>I know that the problem of counting the <a href="https://en.wikipedia.org/wiki/Crossing_number_(graph_theory)" rel="nofollow">Cro... | <p>Here is a short summary of the <a href="http://epubs.siam.org/doi/abs/10.1137/0604033" rel="nofollow">original paper</a>. More modern treatments can be found in a <a href="http://arxiv.org/pdf/1204.0660.pdf" rel="nofollow">paper</a> of Cabello proving a hardness of approximation result. We are concerned with three d... | 157 |
graph theory | A criterion for the planar graph to have unique dual | https://cs.stackexchange.com/questions/54540/a-criterion-for-the-planar-graph-to-have-unique-dual | <p>I get stuck with the following two criteria both about the uniqueness of plane embeddings of a given planar graph. The first one says that a planar graph admits unique plane embedding iff it is a subdivision of 3-connected planar graph (e.g. from the book "Planar Graphs: Theory and Algorithms"). The second one (is f... | <p>First let me mention that the definition of being uniquely embeddable requires ANY graph isomorphism (e.g. just renaming symmetric vertices or any other automorphism permutation) to be (not necessary uniquely) extendable to topological (or combinatorial) one (see Diestel Graph Theory chapter about planar graphs for ... | 158 |
graph theory | Negative edge weight in Dijkstra | https://cs.stackexchange.com/questions/142844/negative-edge-weight-in-dijkstra | <p>Suppose given an un-directed graph <span class="math-container">$G$</span>, such that bridge edge of <span class="math-container">$G$</span> has negative weight.</p>
<p><a href="https://en.wikipedia.org/wiki/Bridge_(graph_theory)#:%7E:text=In%20graph%20theory%2C%20a%20bridge,can%20uniquely%20determine%20a%20cut." r... | 159 | |
graph theory | Connected but not adjacent vertex | https://cs.stackexchange.com/questions/112660/connected-but-not-adjacent-vertex | <p>Are there specific terms or adjectives in graph theory to name these two situations?</p>
<ul>
<li>Two vertices are non-adjacent (disjoint? I have seen that the term "disjoint" is rather used for paths with non-common vertices or edges).</li>
<li>Two connected non-adjacent vertices (the shortest path or pat... | <p>You've exactly described the first situation, i.e. we indeed say that <span class="math-container">$u$</span> and <span class="math-container">$v$</span> are non-adjacent. For the second we do the same, but we want to also specify they are in the same component of <span class="math-container">$G$</span> which contai... | 160 |
graph theory | Enumeration of tree vertices such that each vertex has unique neighbor appearing before it | https://cs.stackexchange.com/questions/156294/enumeration-of-tree-vertices-such-that-each-vertex-has-unique-neighbor-appearing | <p><em>(Diestel, Graph Theory)</em> <strong>Corollary 1.5.2:</strong> Every tree has an enumeration of the vertices <span class="math-container">$\{v_1, v_2\ldots v_n\}$</span> such that each vertex <span class="math-container">$v_i$</span>, with <span class="math-container">$i\geq 2$</span>, has a unique neighbour in... | <p>Pick an arbitrary root. Do a preorder traversal. Now, each vertex has a unique neighbour prior to it in the ordering, namely its parent.</p>
| 161 |
graph theory | Meaning of source here | https://cs.stackexchange.com/questions/144139/meaning-of-source-here | <p>In graph theory, a source of a directed graph <span class="math-container">$D = (V(D), E(D))$</span> is a vertex of it whose in-degree is zero.</p>
<p>The book CLRS makes these statements:</p>
<p>Given a graph <span class="math-container">$G = (V, E)$</span> and a distinguished source vertex <span class="math-contai... | <p>In that context <em>source</em> is just a way to give a specific name to the vertex <span class="math-container">$s$</span>.
It makes sense to use that word since it is the vertex from which all shortest-paths computed using BFS emanate.</p>
| 162 |
graph theory | algorithm to delete nodes that completely removes connectivity | https://cs.stackexchange.com/questions/70380/algorithm-to-delete-nodes-that-completely-removes-connectivity | <p>This is a distributed systems problem, but perhaps the graph theory gurus can help me.</p>
<p>I need an algorithm that that tells me which nodes to remove from the graph to completely remove connectivity. </p>
<p>See example:</p>
<p><a href="https://i.sstatic.net/eoLoF.png" rel="nofollow noreferrer"><img src="htt... | <p>Your problem is: given a graph, find a minimum-sized set of vertices whose removal disconnects the graph.</p>
<p>This is the "minimum vertex cut" problem. There are standard algorithms for this, based on network flow and the max-flow-min-cut theorem. You need to modify the graph slightly to make two copies of nod... | 163 |
graph theory | Optimizing order of graph reduction to minimize memory usage | https://cs.stackexchange.com/questions/1752/optimizing-order-of-graph-reduction-to-minimize-memory-usage | <p>Having extracted the data-flow in some rather large programs as directed, acyclic graphs, I'd now like to optimize the order of evaluation to minimze the maximum amount of memory used.</p>
<p>That is, given a graph {1 -> 3, 2 -> 3, 4 -> 5, 3 -> 5}, I'm looking for an algorithm that will decide the order of graph re... | 164 | |
graph theory | Planar Embedding with Some Nodes Constrained | https://cs.stackexchange.com/questions/79662/planar-embedding-with-some-nodes-constrained | <p>I've read about basic planar-graph embedding and about embedding a planar graph onto a set of fixed points, but I was wondering how one might constrain the locations of some nodes—perhaps to a set of points—while allowing others complete freedom.</p>
<p>Is this achievable with a current popular algorithm, or with m... | <p>This was meant to be a comment but it was a bit too long, sorry!</p>
<p>There is a well known algorithm to draw a planar graph, namely Tutte's drawing algorithm. The input graph is assumed to be 3-connected and planar. The idea of the algorithm is to fix the position of vertices of a face in convex position and fro... | 165 |
graph theory | Computing theory: can a single node be a subgraph? | https://cs.stackexchange.com/questions/41856/computing-theory-can-a-single-node-be-a-subgraph | <p>Can a single node be considered a subgraph?</p>
<p>For example, if I had this graph, G:</p>
<p><code>X</code>-----<code>Y</code> </p>
<p>and I deleted Y, leaving me with the graph</p>
<p><code>X</code></p>
<p>is this a subgraph (induced) of G?
<br><br><br><br>
What about the following argument? </p>
<p>Assume ... | <blockquote>
<p>What about the following argument?</p>
<p>Assume a single node can be considered a graph. Any graph is an induced subgraph of itself. Therefore, a single node graph has a single-node induced subgraph.</p>
<p>Though this is only valid if a single node can be considered a graph.</p>
</blockquo... | 166 |
graph theory | Textbook request for Linear Cellular Automata, if possible with an abstract algebraic approach | https://cs.stackexchange.com/questions/148713/textbook-request-for-linear-cellular-automata-if-possible-with-an-abstract-alge | <p>I am a final semester pure math undergrad, and I became interested in Linear Cellular Automatas.I became interested after reading Klaus Sutner's <a href="https://www.link.cs.cmu.edu/15859-s11/notes/sutner.pdf" rel="nofollow noreferrer">article</a>. In the article, a little abstract algebra is used, linear mappings, ... | 167 | |
algorithm complexity | How is algorithm complexity modeled for functional languages? | https://cs.stackexchange.com/questions/74494/how-is-algorithm-complexity-modeled-for-functional-languages | <p>Algorithm complexity is designed to be independent of lower level details but it is based on an imperative model, e.g. array access and modifying a node in a tree take O(1) time. This is not the case in pure functional languages. The Haskell list takes linear time for access. Modifying a node in a tree involves maki... | <p>If you assume that the $\lambda$-calculus is a good model of functional programming languages, then one may think: the $\lambda$-calculus has a
seemingly simple notion of
time-complexity: just count
the number of $\beta$-reduction
steps $(\lambda x.M)N \rightarrow M[N/x]$. </p>
<p>But is this a good complexity meas... | 168 |
algorithm complexity | Good text on algorithm complexity | https://cs.stackexchange.com/questions/3201/good-text-on-algorithm-complexity | <p>Where should I look for a good introductory text in algorithm complexity? So far, I have had an Algorithms class, and several language classes, but nothing with a theoretical backbone. I get the whole complexity, but sometimes it's hard for me to differentiate between O(1) and O(n) plus there's the whole theta notat... | <p>It is my very personal opinion that the book of <a href="http://www.aw-bc.com/info/kleinberg/" rel="noreferrer">Jon Kleinberg and Éva Tardos</a> is the best book for studying the design and analysis of efficient algorithms. It might be not as comprehensive as <em>Cormen et al.</em> but it is a great textbook. Let me... | 169 |
algorithm complexity | Recursive algorithm. Complexity | https://cs.stackexchange.com/questions/73690/recursive-algorithm-complexity | <p>I need your help with time complexity.</p>
<p>I have this recursive function:
$$
F(n) = \left\{
\begin{array}{l l}
F(n-2) + 10 F\big(\frac{n}{6}\big)^2 + 6 F\big(\frac{n}{7}\big) + \frac{n^4}{5} & \text{if } n > 1\\
2 & \text{otherwise}\\
\end{array} \right.
$$</p>
<p>and I had to do the same thing us... | 170 | |
algorithm complexity | Algorithmic Complexity of Statistical Estimators | https://cs.stackexchange.com/questions/65987/algorithmic-complexity-of-statistical-estimators | <p>This might be very basic but I am interested in evaluating the algorithmic complexity of an estimator of the form:</p>
<p>$$\hat{\theta} = \text{argmin}_{\theta} \;\; Q_n (\theta)$$</p>
<p>where $Q_n(\theta)$ denotes some objective function of interest (e.g. - log likelihood) computed on a sample of length $n$. $\... | <p>The bound $O(Q_n(θ) \cdot S(p))$ represents only the cost of evaluating $Q_n$ once per step in the "numerical optimization method"; you ignore all other cost that incurs.</p>
<p>Without looking at the whole algorithm, little more can be done.</p>
<p><em>Note:</em> I very deliberately replaced $S$ with $S(p)$. That... | 171 |
algorithm complexity | Algorithm complexity similar to Selection Sort | https://cs.stackexchange.com/questions/98523/algorithm-complexity-similar-to-selection-sort | <p>I'm working on an algorithm that takes an array of <span class="math-container">$N$</span> values and it will iterate through each of the values and in each of them iterate through the rest of the array to the right. So the first value will check <span class="math-container">$N-1$</span> positions, the next one will... | <p>You have to count. Intuition is necessary, but you must calculate.</p>
<p><span class="math-container">$$ 1+2+\cdots+N-1 = N(N-1)/2 \in \mathcal{O}(N^2)$$</span> by Gaussian summation rules.</p>
<p>In asymptotic notation, the constants are removed. For example.</p>
<p><span class="math-container">$\mathcal{O}(N/k... | 172 |
algorithm complexity | What is the algorithmic complexity of this? | https://cs.stackexchange.com/questions/121269/what-is-the-algorithmic-complexity-of-this | <p>I'm practicing leet code questions and want to understand more fully how to determine Big O notation. What is the algorithmic complexity of my solution to the following problem? </p>
<p><strong>O(n^2) ?</strong> For every item in n I could loop an additional n[i] times. Or is it <strong>O(n)</strong> ?</p>
<p>Give... | <p>Your algorithm has O(n^2) worst case complexity. You have a for loop of O(n). Inside your for loop you have a while loop which is O(currentNum). So if your currentNum is O(n) (ex nums[i] = length.nums for each i) then the complexity is O(n*n) = O(n^2).</p>
<p>Hint</p>
<p>Try not to recalculate things. You could us... | 173 |
algorithm complexity | The exact relation between complexity classes and algorithm complexities | https://cs.stackexchange.com/questions/9909/the-exact-relation-between-complexity-classes-and-algorithm-complexities | <p>Are all algorithms which have polynomial time complexity belong to P class ? And P class do not have any algorithm which does have not polynomial complexity ? </p>
<p>Are all algorithms which have non polynomial complexity belong to NP or NP-Hard or both ?</p>
<p>I am just trying to understand the basic relationsh... | <p>$P$ is defined as the class of (decision) problems that have an algorithm that solves them in polynomial time (in a TM, or a polynomially-equivalent model). Thus, $P$ contains exactly these problems, no more and no less.</p>
<p>As for $NP$- the situation is more delicate. A problem is in $NP$ if it has a nondetermi... | 174 |
algorithm complexity | algorithm with linear time complexity | https://cs.stackexchange.com/questions/152316/algorithm-with-linear-time-complexity | <p>We say that if an algorithm takes p time for an input size of n (here, p is a polynomial in n, and the degree of p is y), then the algorithm's complexity is O(n^y).</p>
<p>In the image, when n is very large it does not seem to matter much if it's x^2 or 2x^2. but, it clearly seems to matter if it's x or 2x. So, then... | 175 | |
algorithm complexity | Relationship of algorithm complexity and automata class | https://cs.stackexchange.com/questions/52748/relationship-of-algorithm-complexity-and-automata-class | <p>I have been unable to find a graph depicting or text answering the following question: Is there a direct relationship between the complexity of an algorithm (such as best / worst case of quick sort), and class of automata that can implement the algorithm. For example is there a range of complexity push down automata... | <p>Yes, there are relationships in many cases!</p>
<p>For example, it is known that any language which is accepted by reversal-bounded counter machines are in $P$ (see <a href="http://www.sciencedirect.com/science/article/pii/0022000081900283">here</a>).</p>
<p>Similarly, we know that all regular languages are in $P$... | 176 |
algorithm complexity | Algorithm complexity | https://cs.stackexchange.com/questions/70976/algorithm-complexity | <p>For example, we have $T(N) = T(N/2) + T(N/5) + O(N)$.
So:</p>
<p>$2T(N/2) + O(N) \leq T(N) \leq 2T(N/5) + O(N)$</p>
<p>$O(N) \leq T(N) \leq O(N)$. Thus, $T(N) = O(N)$. Is it correct?</p>
| 177 | |
algorithm complexity | Algorithm Complexity Question | https://cs.stackexchange.com/questions/150440/algorithm-complexity-question | <p>this is my first question on this site and I would like to preface this by saying I am not very savvy when it comes to Computer Science. So, I will try to ask this the best I can.</p>
<p>I was doing some research on Polynomial time because that is what I was told hashing algorithms run on, correct me if I am wrong. ... | 178 | |
algorithm complexity | Algorithmic Complexity of Recognizing Claw-Free Graphs | https://cs.stackexchange.com/questions/162703/algorithmic-complexity-of-recognizing-claw-free-graphs | <p>Let <span class="math-container">$H=\left(V_H, E_H\right)$</span> and <span class="math-container">$G=(V, E)$</span> be graphs. A <em>subgraph isomorphism</em> from <span class="math-container">$H$</span> to <span class="math-container">$G$</span> is a function <span class="math-container">$f: V_H \rightarrow V$</sp... | <p>A graph is, as you say, claw-free if and only if it does not contain <span class="math-container">$K_{1,3}$</span> as an induced subgraph.</p>
<p>This gives rise to the trivial <span class="math-container">$n^4$</span> algorithm: for every set of four vertices, is the degrees of the induced subgraph <span class="mat... | 179 |
algorithm complexity | Algorithmic complexity of a Maximum Capacity Representatives variant | https://cs.stackexchange.com/questions/77192/algorithmic-complexity-of-a-maximum-capacity-representatives-variant | <p>I have been trying to find the algorithmic complexity of a problem that I have. I am almost sure it is either NP-hard or NP-complete but I cannot find any proof. Recently, I found that my problem can be something similar to a special instance of the Maximum Capacity Representatives problem, which is NP-complete. How... | <p>I'm assuming that the goal of your optimization problem is to maximize $\min \{ c(x,y) : x,y \in T \}$. The decision problem is then:</p>
<blockquote>
<p>Given a system $S_1,\ldots,S_m$ of disjoint sets, a cost function $c\colon S \times S \to \mathbb{R}_+$ (where $S = S_1 \cup \cdots \cup S_m$) and a number $\ga... | 180 |
algorithm complexity | Improve algorithmic complexity | https://cs.stackexchange.com/questions/116916/improve-algorithmic-complexity | <p>We have an array of N size. We have to perform Q queries on it, in which each Query contains and Index I for which we do:</p>
<pre><code>for j=I+1 to N:
if A[j]<A[I]:
A[j]=0
</code></pre>
<p>The Queries are not independent of each other so we need to use the changed Array everytime.</p>
<p>I have given a... | <p>Solving this problem benefits from geometrical intuition. Think that for each index <span class="math-container">$i$</span>, the pair <span class="math-container">$(i, A[i])$</span> represents a point in 2D-space. Also we can think that assigning <span class="math-container">$A[j]=0$</span> is the same as removing t... | 181 |
algorithm complexity | Time complexity and space complexity in recursive algorithm | https://cs.stackexchange.com/questions/13055/time-complexity-and-space-complexity-in-recursive-algorithm | <pre><code>"The designer of an algorithm needs to balance between space complexity and time
complexity." - Comment on the validity of the statement in the context of recursive
algorithms.
</code></pre>
<p>This is a question from my university's previous paper. But i couldn't find a decent answer. Actually i am confuse... | <p>One thing comes in mind is <a href="http://en.wikipedia.org/wiki/Memoization" rel="nofollow noreferrer">memoization</a>. Simple well studied problem for this is Fibonacci numbers, simple recursion is as follow:</p>
<pre><code>fib(int n)
{
if (n < 3)
return 1;
return fib(n-1) + fib(n-2);
}
</code></pre>
... | 182 |
algorithm complexity | Is every algorithm's complexity $\Omega(1)$ and $O(\infty)$? | https://cs.stackexchange.com/questions/8998/is-every-algorithms-complexity-omega1-and-o-infty | <p>From what I've read, Big O is the absolute worst ever amount of complexity an algorithm will be given an input. On the side, Big Omega is the best possible efficiency, i.e. lowest complexity.</p>
<p>Can it be said then that every algorithm has a complexity of $O(\infty)$ since infinite complexity is the worst ever... | <p>To be clear, Big O and Big Omega are classes of functions. So if I have for example $\Omega(1)$, that's a set of a whole bunch of functions.</p>
<p>An algorithm's complexity is a function giving how many steps the algorithm takes on each input. This function may be in a class like $\Omega(1)$, or not.</p>
<p>$\Ome... | 183 |
algorithm complexity | Suffix Tree algorithm complexity | https://cs.stackexchange.com/questions/41199/suffix-tree-algorithm-complexity | <p>I really get confused by all the different complexities you find around. One is $O(n \log n)$, the next $O(n \cdot |\Sigma|)$. Personally I think it's the last one, but I'm really not that confident with it to say so. Well on average we go $\log n$ deep and need at max $|\Sigma|$ steps to find a corresponding node t... | <p>There is no one complexity for all suffix tree algorithms. There are multiple algorithms, with different running times. It is not helpful to talk about this as though there was only one complexity that applies to all algorithms for computing a suffix tree. If you want to ask what is the running time of an algorit... | 184 |
algorithm complexity | Algorithm Complexity Analysis on functional programming language implementations | https://cs.stackexchange.com/questions/63900/algorithm-complexity-analysis-on-functional-programming-language-implementations | <p>I've learned <a href="https://cs.stackexchange.com/questions/63889/is-there-a-decision-algorithm-with-time-complexity-of-%d3%a8n%c2%b2?noredirect=1#comment135296_63889">today</a> that algorithm analysis differs based on computational model. It is something I've never thought about or heard of. </p>
<p>An example gi... | <p>It depends on the semantics of your functional language. You can't do algorithm analysis on programming languages in isolation, because you don't know what the statements actually mean. The specification for your language needs to provide sufficiently detailed semantics. If your language specifies everything in term... | 185 |
algorithm complexity | Brute force Delaunay triangulation algorithm complexity | https://cs.stackexchange.com/questions/2400/brute-force-delaunay-triangulation-algorithm-complexity | <p>In the book <a href="http://www.cs.uu.nl/geobook/" rel="noreferrer">"Computational Geometry: Algorithms and Applications"</a> by Mark de Berg et al., there is a very simple brute force algorithm for computing Delaunay triangulations. The algorithm uses the notion of <em>illegal edges</em> -- edges that may... | <p>A Delaunay triangulation can be considered as the lower convex hull of the 2d point set lifted to the paraboloid. Thus, if you take your 2d point set and assign to every point $(x_i,y_i)$ a $z$-coordinate $z_i=x_i^2+y_1^2$, then the projection of the lower convex hull into the $xy$-plane gives you the Delaunay trian... | 186 |
algorithm complexity | A question about parallel algorithm complexity | https://cs.stackexchange.com/questions/7371/a-question-about-parallel-algorithm-complexity | <p>When in a Parallel algorithm we say:</p>
<blockquote>
<p>"This algorithm is done in $O(1)$ time using $O(n\log n)$ work, with $n$-exponential probability, or alternatively, in $O(\log n)$ time using $O(n)$ work, with $n$-exponential probability."</p>
</blockquote>
<p>Then Can we Implement this algorithm for a Qu... | <p>You are probably in the realm of asynchronous parallel computations where units of work are performed by processors at their pace and communication is performed explicitly. This model is a good approximation to many real life parallel computers such as PC clusters or multicore CPUs.</p>
<p>You have an algorithm tha... | 187 |
algorithm complexity | "Which complexity represents a majority of algorithms?" | https://cs.stackexchange.com/questions/95987/which-complexity-represents-a-majority-of-algorithms | <p>Student asked me this question. During lectures on algorithm complexity I've shown similar picture (<a href="https://towardsdatascience.com/linear-time-vs-logarithmic-time-big-o-notation-6ef4227051fb" rel="nofollow noreferrer">source</a>):</p>
<p><a href="https://i.sstatic.net/y4RLi.png" rel="nofollow noreferrer"><... | <p>My answer would be that there is no running time that represents the majority of algorithms. Some common algorithms (for example, BFS and DFS) run in linear time; some run in loglinear time (for example, sorting); dynamic programming algorithms run in superlinear polynomial time (for example, the standard algorithm ... | 188 |
algorithm complexity | Complexity of Search Algorithm | https://cs.stackexchange.com/questions/82340/complexity-of-search-algorithm | <p>I have an algorithm which searches a sorted int array for two elements which sum up to a searched value. First I thought that the complexity is $\mathcal{O}(n)$, but the interpolation search algorithm has a similar approach and has a $\mathcal{O}(\log(log(n)))$ complexity with uniform distributed elements. </p>
<p>... | <p>This method works in linear time, because <code>end - start</code> decreases by 1 on each iteration. It's $n - 1$ initially, hence the loop will make at most $n - 1$ iterations.</p>
| 189 |
algorithm complexity | approximation algorithm with polynomial complexity | https://cs.stackexchange.com/questions/75286/approximation-algorithm-with-polynomial-complexity | <p>It might be a silly question, I do take a carefully read about approximation algorithm through coursenotes, but when I saw the words "approximation algorithm with polynomial complexity", I can't understand what it means, I searched a lot and here is my assumption.</p>
<p>First, for some NPc or NP hard problem, we c... | <p>As you say, we believe there is no polynomial-time algorithm for solving an NP-hard problem. So if we wanted to have a polynomial-time algorithm, it seems like we need to give up the hope of always finding an optimal solution. So you are right: typically, we strive to find approximation algorithms that run in time p... | 190 |
algorithm complexity | Async Distributed Algorithm Time Complexity | https://cs.stackexchange.com/questions/90946/async-distributed-algorithm-time-complexity | <p>In theory of distributed systems, I understand message complexity and time complexity are common performance measures, with the first being the number of messages sent in the overall execution of the algorithm, and the time being the number of "steps" it takes to complete the algorithm. </p>
<p>My question is, with... | <p>In a distributed system, messages can be sent in parallel. Vertex #1 can send a message at the same time as vertex #2 is sending a message. So, the total amount of time to complete the algorithm might be much less than the total number of messages sent.</p>
| 191 |
algorithm complexity | Is "super-exponential" a precise definition of algorithmic complexity? | https://cs.stackexchange.com/questions/99605/is-super-exponential-a-precise-definition-of-algorithmic-complexity | <p>I cannot seem to find a precise definition of what "super-exponential" is supposed to refer to when one's talking about an algorithm's time complexity.</p>
<p>For instance, if an algorithm runs for <span class="math-container">$nC(n-1)$</span> steps, where <span class="math-container">$C(\cdot)$</span> is the Catal... | <p>"Super-exponential" just means more than exponential, so a function is super-exponential if it grows faster than any exponential function. More formally, this means that it is <span class="math-container">$\omega(c^n)$</span> for every constant <span class="math-container">$c$</span>, i.e., if <span class=... | 192 |
algorithm complexity | What would Dijkstra's shortest path algorithm complexity be with the following data structure? | https://cs.stackexchange.com/questions/85311/what-would-dijkstras-shortest-path-algorithm-complexity-be-with-the-following-d | <p>Considering $n$ number of pieces of data, what would Dijkstra's shortest path algorithm time complexity be if it was stored using a data structure with following properties? </p>
<p>• delete the record with the minimum value of the key (complexity $O(log n)$);</p>
<p>• decrease the key of some record (complexity ... | 193 | |
algorithm complexity | Complexity analysis of an unsolvable algorithmic problem? | https://cs.stackexchange.com/questions/56556/complexity-analysis-of-an-unsolvable-algorithmic-problem | <p>In my automata theory class, for our term project we are required to present a complexity analysis for our algorithmic problem. I have chosen an unsolvable problem, and he has off-the-cuff mentioned that any unsolvable problem would have a complexity of infinite.</p>
<p>However, this strikes me as strange. It feels... | <p>Basically, this is a degenerate case. We can adopt the convention that the running time of any algorithm is $\infty$ (so its complexity is $\infty$), or we can adopt the convention that it doesn't have a complexity. For informal conversation, probably it doesn't matter much what convention you adopt, as long as it... | 194 |
algorithm complexity | Time complexity for logarithmic algorithm | https://cs.stackexchange.com/questions/165211/time-complexity-for-logarithmic-algorithm | <p>I am trying to find complexity for following algorithm. It is from "The Algorithm Design Manual" book.</p>
<pre><code>for k = 1 to n:
x = k
while (x < n):
print ’*’
x = 2x
</code></pre>
<p>I simulated algorithm for some values. Each time inner loop operates on <code>n-k</code> value.</... | <p><span class="math-container">$\sum\limits_{k=1}^{n}\log \frac{n}{k} = \sum\limits_{k=1}^{n}\log n-\sum\limits_{k=1}^{n}\log k = \log n^n - \log n! = n \log n - (n \log n - n + O(\log n)) = n - O(\log n) = O(n)$</span></p>
| 195 |
algorithm complexity | Complexity class of an algorithm | https://cs.stackexchange.com/questions/122216/complexity-class-of-an-algorithm | <p>What is the complexity class of an algorithm that runs in <span class="math-container">$n^{\mathcal{O}(\sqrt{n}log(n))}$</span> time? </p>
<p>As <span class="math-container">$n$</span> gets large <span class="math-container">$\sqrt{n}log(n)$</span> increases at a very slow rate. Does this mean that the algorithm ha... | <p>No, <span class="math-container">$\sqrt{n}$</span> increases far faster than <span class="math-container">$O(1)$</span>, and <span class="math-container">$n^{\sqrt{n}}$</span> grows far faster than <span class="math-container">$n^{O(1)}$</span>. No, it certainly does not have the same runtime. See <a href="https:/... | 196 |
algorithm complexity | Algorithmic complexity of Sub-array with sum = target algorithm | https://cs.stackexchange.com/questions/63837/algorithmic-complexity-of-sub-array-with-sum-target-algorithm | <p>Question: Given an array of positive integers and a target total of X, find if there exists a contiguous subarray with sum = X </p>
<p>E.g: If array is [1, 3, 5, 18] and X = 8 Output: True, if X = 10, output is FALSE.</p>
<p>Approach I can think of is to expand sub-array window, until you hit an index such that ... | 197 | |
algorithm complexity | MST: Prim's algorithm complexity, why not $O(EV \lg V)$? | https://cs.stackexchange.com/questions/13608/mst-prims-algorithm-complexity-why-not-oev-lg-v | <p>According to CLRS, the Prim's algorithms is implemented as below -- </p>
<blockquote>
<p>$\mathtt{\text{MST-PRIM}}(G,w,r)$ </p>
<ul>
<li>for each $u \in V[G]$ do<br>
<ul>
<li>$\mathtt{\text{key}}[u] \leftarrow \infty$ </li>
<li>$\pi[u] \leftarrow \mathtt{\text{NIL}}$ </li>
</ul></li>
<li>$\math... | <p>The complexity is derived as follows. The initialization phase costs <span class="math-container">$O(V)$</span>. The <span class="math-container">$while$</span> loop is executed <span class="math-container">$\left| V \right|$</span> times. The <span class="math-container">$for$</span> loop nested within the <span cl... | 198 |
algorithm complexity | Algorithm Time complexity analysis for algorithm having two different time complexities | https://cs.stackexchange.com/questions/63361/algorithm-time-complexity-analysis-for-algorithm-having-two-different-time-compl | <p>I'm implementing an algorithm that analyze several properties on large set of integers, the time complexity is bound to $N$ (set length) and $M$ (bits to represent the numbers). I'm having some trouble to figure out how to express its time complexity because I don't know how to handle next situation:</p>
<p>The asy... | <p>No, you can't determine the asymptotic worst-case running time from these two graphs.</p>
<p>First, plotting empirical running times is not a reliable way to determine worst-case running time: <a href="https://cs.stackexchange.com/q/857/755">How to fool the plot inspection heuristic?</a>. So, the approach of graph... | 199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.