unable to get the below logic The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraDoes the greedy method guarantee max flow in a directed tree?What is the definition of a network in graph theoryWhy $f^+(v)-f^-(v) =val(f)$ if $v$ is the source?Shortest path in a graph with weighted edges and verticesMaximum and Sets of vertex-disjoint paths in a not-directed graphOptimizing flow within graph, for gossip protocol optimizationStrongly connected graph: equivalent formulationDid I find a max-flow min-cut theorem contradiction?Proof. Given a DAG $G$, for every vertex $v$ in $G$, there is a path from $v$ to some sink in $G$.A directed complete graph with equal number of incoming and outgoing edges

Variable with quotation marks "$()"

Do ℕ, mathbbN, BbbN, symbbN effectively differ, and is there a "canonical" specification of the naturals?

Do warforged have souls?

How to make Illustrator type tool selection automatically adapt with text length

How to determine omitted units in a publication

Windows 10: How to Lock (not sleep) laptop on lid close?

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

Do working physicists consider Newtonian mechanics to be "falsified"?

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

What information about me do stores get via my credit card?

Are there continuous functions who are the same in an interval but differ in at least one other point?

What was the last x86 CPU that did not have the x87 floating-point unit built in?

What other Star Trek series did the main TNG cast show up in?

Store Dynamic-accessible hidden metadata in a cell

Didn't get enough time to take a Coding Test - what to do now?

Button changing its text & action. Good or terrible?

"... to apply for a visa" or "... and applied for a visa"?

Huge performance difference of the command find with and without using %M option to show permissions

A phrase ”follow into" in a context

Would an alien lifeform be able to achieve space travel if lacking in vision?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Why did Peik Lin say, "I'm not an animal"?

Circular reasoning in L'Hopital's rule

"is" operation returns false with ndarray.data attribute, even though two array objects have same id



unable to get the below logic



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraDoes the greedy method guarantee max flow in a directed tree?What is the definition of a network in graph theoryWhy $f^+(v)-f^-(v) =val(f)$ if $v$ is the source?Shortest path in a graph with weighted edges and verticesMaximum and Sets of vertex-disjoint paths in a not-directed graphOptimizing flow within graph, for gossip protocol optimizationStrongly connected graph: equivalent formulationDid I find a max-flow min-cut theorem contradiction?Proof. Given a DAG $G$, for every vertex $v$ in $G$, there is a path from $v$ to some sink in $G$.A directed complete graph with equal number of incoming and outgoing edges










-1












$begingroup$


I stuck at a problem Flawed flow



I am not getting how F[u]=0 guarantees acyclic graph in below approach
I found a comment in editorial But it is not very clear



comment -> if there's no vertex v that f[v]=0 then we have an cycle in graph, because every vertex in graph have at least one incoming edge. (Consider longest simple path in remain graph, we know that head vertex in path has an incoming edge and the head of that edge is also in path).



Please someone explain what is the correct reason for above mentioned statement ?



The key element to solving the task is the following observation: if we know all the incoming edges of a vertex, all the remaining edges must be outgoing. The source has no incoming edges, so we already know that all its edges are outgoing. For all other vertices except the sink the amount of incoming and outcoming flow is the same, and is equal to half of the sum of the flow along its incident edges. The algorithm then is to repeatedly direct all the flow from the vertices for which all the incoming edges are known. This can be done with a single BFS:



for all v from 2 to n-1
f[v] := sum(flow(v,u))/2;
put source in queue
while queue is not empty
v := pop(queue)
for all edges (v, u)
if (v, u) is not directed yet
direct v -> u
f[u] = f[u] - flow(v,u)
if u not sink and f[u] = 0
push(queue, u)


As the flow contains no cycles, we can sort the vertices topologically. Then



we can be sure that, until all edge directions are known, we can put at least the first vertex with unknown edges in the queue, as all of its incoming edges will be from vertices with lower indices, but we took the first vertex with unknown edges.



Time: O(n + m)



Memory: O(n + m)



Implementation: c++










share|cite|improve this question









$endgroup$







  • 1




    $begingroup$
    Hello, this is the mathematics site so please ask your question on a programming site, not here.
    $endgroup$
    – Stallmp
    Mar 31 at 7:30















-1












$begingroup$


I stuck at a problem Flawed flow



I am not getting how F[u]=0 guarantees acyclic graph in below approach
I found a comment in editorial But it is not very clear



comment -> if there's no vertex v that f[v]=0 then we have an cycle in graph, because every vertex in graph have at least one incoming edge. (Consider longest simple path in remain graph, we know that head vertex in path has an incoming edge and the head of that edge is also in path).



Please someone explain what is the correct reason for above mentioned statement ?



The key element to solving the task is the following observation: if we know all the incoming edges of a vertex, all the remaining edges must be outgoing. The source has no incoming edges, so we already know that all its edges are outgoing. For all other vertices except the sink the amount of incoming and outcoming flow is the same, and is equal to half of the sum of the flow along its incident edges. The algorithm then is to repeatedly direct all the flow from the vertices for which all the incoming edges are known. This can be done with a single BFS:



for all v from 2 to n-1
f[v] := sum(flow(v,u))/2;
put source in queue
while queue is not empty
v := pop(queue)
for all edges (v, u)
if (v, u) is not directed yet
direct v -> u
f[u] = f[u] - flow(v,u)
if u not sink and f[u] = 0
push(queue, u)


As the flow contains no cycles, we can sort the vertices topologically. Then



we can be sure that, until all edge directions are known, we can put at least the first vertex with unknown edges in the queue, as all of its incoming edges will be from vertices with lower indices, but we took the first vertex with unknown edges.



Time: O(n + m)



Memory: O(n + m)



Implementation: c++










share|cite|improve this question









$endgroup$







  • 1




    $begingroup$
    Hello, this is the mathematics site so please ask your question on a programming site, not here.
    $endgroup$
    – Stallmp
    Mar 31 at 7:30













-1












-1








-1





$begingroup$


I stuck at a problem Flawed flow



I am not getting how F[u]=0 guarantees acyclic graph in below approach
I found a comment in editorial But it is not very clear



comment -> if there's no vertex v that f[v]=0 then we have an cycle in graph, because every vertex in graph have at least one incoming edge. (Consider longest simple path in remain graph, we know that head vertex in path has an incoming edge and the head of that edge is also in path).



Please someone explain what is the correct reason for above mentioned statement ?



The key element to solving the task is the following observation: if we know all the incoming edges of a vertex, all the remaining edges must be outgoing. The source has no incoming edges, so we already know that all its edges are outgoing. For all other vertices except the sink the amount of incoming and outcoming flow is the same, and is equal to half of the sum of the flow along its incident edges. The algorithm then is to repeatedly direct all the flow from the vertices for which all the incoming edges are known. This can be done with a single BFS:



for all v from 2 to n-1
f[v] := sum(flow(v,u))/2;
put source in queue
while queue is not empty
v := pop(queue)
for all edges (v, u)
if (v, u) is not directed yet
direct v -> u
f[u] = f[u] - flow(v,u)
if u not sink and f[u] = 0
push(queue, u)


As the flow contains no cycles, we can sort the vertices topologically. Then



we can be sure that, until all edge directions are known, we can put at least the first vertex with unknown edges in the queue, as all of its incoming edges will be from vertices with lower indices, but we took the first vertex with unknown edges.



Time: O(n + m)



Memory: O(n + m)



Implementation: c++










share|cite|improve this question









$endgroup$




I stuck at a problem Flawed flow



I am not getting how F[u]=0 guarantees acyclic graph in below approach
I found a comment in editorial But it is not very clear



comment -> if there's no vertex v that f[v]=0 then we have an cycle in graph, because every vertex in graph have at least one incoming edge. (Consider longest simple path in remain graph, we know that head vertex in path has an incoming edge and the head of that edge is also in path).



Please someone explain what is the correct reason for above mentioned statement ?



The key element to solving the task is the following observation: if we know all the incoming edges of a vertex, all the remaining edges must be outgoing. The source has no incoming edges, so we already know that all its edges are outgoing. For all other vertices except the sink the amount of incoming and outcoming flow is the same, and is equal to half of the sum of the flow along its incident edges. The algorithm then is to repeatedly direct all the flow from the vertices for which all the incoming edges are known. This can be done with a single BFS:



for all v from 2 to n-1
f[v] := sum(flow(v,u))/2;
put source in queue
while queue is not empty
v := pop(queue)
for all edges (v, u)
if (v, u) is not directed yet
direct v -> u
f[u] = f[u] - flow(v,u)
if u not sink and f[u] = 0
push(queue, u)


As the flow contains no cycles, we can sort the vertices topologically. Then



we can be sure that, until all edge directions are known, we can put at least the first vertex with unknown edges in the queue, as all of its incoming edges will be from vertices with lower indices, but we took the first vertex with unknown edges.



Time: O(n + m)



Memory: O(n + m)



Implementation: c++







graph-theory network-flow






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Mar 31 at 7:19









aka1234aka1234

62




62







  • 1




    $begingroup$
    Hello, this is the mathematics site so please ask your question on a programming site, not here.
    $endgroup$
    – Stallmp
    Mar 31 at 7:30












  • 1




    $begingroup$
    Hello, this is the mathematics site so please ask your question on a programming site, not here.
    $endgroup$
    – Stallmp
    Mar 31 at 7:30







1




1




$begingroup$
Hello, this is the mathematics site so please ask your question on a programming site, not here.
$endgroup$
– Stallmp
Mar 31 at 7:30




$begingroup$
Hello, this is the mathematics site so please ask your question on a programming site, not here.
$endgroup$
– Stallmp
Mar 31 at 7:30










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3169134%2funable-to-get-the-below-logic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3169134%2funable-to-get-the-below-logic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Triangular numbers and gcdProving sum of a set is $0 pmod n$ if $n$ is odd, or $fracn2 pmod n$ if $n$ is even?Is greatest common divisor of two numbers really their smallest linear combination?GCD, LCM RelationshipProve a set of nonnegative integers with greatest common divisor 1 and closed under addition has all but finite many nonnegative integers.all pairs of a and b in an equation containing gcdTriangular Numbers Modulo $k$ - Hit All Values?Understanding the Existence and Uniqueness of the GCDGCD and LCM with logical symbolsThe greatest common divisor of two positive integers less than 100 is equal to 3. Their least common multiple is twelve times one of the integers.Suppose that for all integers $x$, $x|a$ and $x|b$ if and only if $x|c$. Then $c = gcd(a,b)$Which is the gcd of 2 numbers which are multiplied and the result is 600000?

Ingelân Ynhâld Etymology | Geografy | Skiednis | Polityk en bestjoer | Ekonomy | Demografy | Kultuer | Klimaat | Sjoch ek | Keppelings om utens | Boarnen, noaten en referinsjes Navigaasjemenuwww.gov.ukOffisjele webside fan it regear fan it Feriene KeninkrykOffisjele webside fan it Britske FerkearsburoNederlânsktalige ynformaasje fan it Britske FerkearsburoOffisjele webside fan English Heritage, de organisaasje dy't him ynset foar it behâld fan it Ingelske kultuergoedYnwennertallen fan alle Britske stêden út 'e folkstelling fan 2011Notes en References, op dizze sideEngland

Հադիս Բովանդակություն Անվանում և նշանակություն | Դասակարգում | Աղբյուրներ | Նավարկման ցանկ