Scherk surface: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Luckas-bot
m r2.7.1) (Robot: Adding sl:Scherkova ploskev
 
en>Addbot
m Bot: Migrating 2 interwiki links, now provided by Wikidata on d:q3505307
Line 1: Line 1:
Hi there, I am Yoshiko Villareal but I never truly favored that title. Bottle tops gathering is the only hobby his wife doesn't approve of. Managing individuals is how she makes cash and she will not change it anytime soon. Her family life in Idaho.<br><br>Here is my blog post [http://st-augustinecoastalproperties.com/realestate/UserProfile/tabid/43/userId/4236/Default.aspx st-augustinecoastalproperties.com]
{{Infobox algorithm
|class=
|image=[[File:Tarjan's Algorithm Animation.gif|thumb|Tarjan's Algorithm Animation]]
|caption = Tarjan's Algorithm.
|data=[[Graph (data structure)|Graph]]
|time= <math>O(|V|+|E|)</math>
|best-time=
|average-time=
|space=
|optimal=
|complete=
}}
'''Tarjan's Algorithm''' (named for its discoverer, [[Robert Tarjan]]<ref>{{citation|first=R. E.|last=Tarjan|authorlink=Robert Tarjan|title=Depth-first search and linear graph algorithms|journal=[[SIAM Journal on Computing]]|volume=1|year=1972|issue=2|pages=146–160|doi=10.1137/0201010}}</ref>) is a [[graph theory]] [[algorithm]] for finding the [[strongly connected component]]s of a [[Graph (data structure)|graph]]. Although it precedes it chronologically, it can be seen as an improved version of [[Kosaraju's algorithm]], and is comparable in efficiency to the [[path-based strong component algorithm]].
 
== Overview ==
 
The algorithm takes a [[directed graph]] as input, and produces a [[Partition of a set|partition]] of the graph's [[Vertex (graph theory)|vertices]] into the graph's strongly connected components. Each vertex of the graph appears in exactly one of the strongly connected components.  Any vertex that is not on a directed cycle forms a strongly connected component all by itself: for example, a vertex whose in-degree or out-degree is 0, or any vertex of an acyclic graph.
 
The basic idea of the algorithm is this: a depth-first search begins from an arbitrary start node (and subsequent depth-first searches are conducted on any nodes that have not yet been found).  As usual with depth-first search, the search visits every node of the graph exactly once, declining to revisit any node that has already been explored. Thus, the collection of search trees is a [[spanning forest]] of the graph.  The strongly connected components will be recovered as certain subtrees of this forest.  The roots of these subtrees are called the "roots" of the strongly connected components.  Any node of a strongly connected component might serve as the root, if it happens to be the first node of the component that is discovered by the search.
 
=== Stack invariant ===
 
The nodes are placed on a [[Stack (data structure)|stack]] in the order in which they are visited.  When the depth-first search recursively explores a node <tt>v</tt> and its descendants, those nodes are not all necessarily popped from the stack before this recursive call returns.  The crucial [[Invariant (computer science)|invariant property]] is that a node remains on the stack after exploration if and only if it has a path to some node earlier on the stack. 
 
At the end of the call that explores <tt>v</tt> and its descendants, we know whether <tt>v</tt> itself has a path to any node earlier on the stack.  If so, the call returns, leaving <tt>v</tt> on the stack to preserve the invariant.  If not, then <tt>v</tt> must be the root of its strongly connected component, which consists of <tt>v</tt> together with any later nodes on the stack (such nodes all have paths back to <tt>v</tt> but not to any earlier node).  This entire component is then popped from the stack and returned, again preserving the invariant.
 
=== Bookkeeping ===
 
Each node v is assigned a unique integer <tt>v.index</tt>, which numbers the nodes consecutively in the order in which they are discovered.  It also maintains a value <tt>v.lowlink</tt> that represents (roughly speaking) the smallest index of any node known to be reachable from <tt>v</tt>, including <tt>v</tt> itself. Therefore <tt>v</tt> must be left on the stack if <tt>v.lowlink < v.index</tt>, whereas v must be removed as the root of a strongly connected component if <tt>v.lowlink == v.index</tt>.  The value <tt>v.lowlink</tt> is computed during the depth-first search from <tt>v</tt>, as this finds the nodes that are reachable from <tt>v</tt>.
 
== The algorithm in pseudocode ==
'''algorithm''' tarjan '''is'''
  '''input:''' graph ''G'' = (''V'', ''E'')
  '''output:''' set of strongly connected components (sets of vertices)
  ''index'' := 0
  ''S'' := empty
  '''for each''' ''v'' '''in''' ''V'' '''do'''
    '''if''' (''v''.index is undefined) '''then'''
      strongconnect(''v'')
    '''end if'''
  '''end for'''
  '''function''' strongconnect(''v'')
    ''// Set the depth index for v to the smallest unused index''
    ''v''.index := ''index''
    ''v''.lowlink := ''index''
    ''index'' := ''index'' + 1
    ''S''.push(''v'')
    ''// Consider successors of v''
    '''for each''' (''v'', ''w'') '''in''' ''E'' '''do'''
      '''if''' (''w''.index is undefined) '''then'''
        ''// Successor w has not yet been visited; recurse on it''
        strongconnect(''w'')
        ''v''.lowlink  := min(''v''.lowlink, ''w''.lowlink)
      '''else if''' (''w'' is in ''S'') '''then'''
        ''// Successor w is in stack S and hence in the current SCC''
        ''v''.lowlink  := min(''v''.lowlink, ''w''.index)
      '''end if'''
    '''end for'''
    ''// If v is a root node, pop the stack and generate an SCC''
    '''if''' (''v''.lowlink = ''v''.index) '''then'''
      start a new strongly connected component
      '''repeat'''
        ''w'' := ''S''.pop()
        add ''w'' to current strongly connected component
      '''until''' (''w'' = ''v'')
      output the current strongly connected component
    '''end if'''
  '''end function'''
 
The <tt>index</tt> variable is the depth-first search node number counter. <tt>S</tt> is the node stack, which starts out empty and stores the history of nodes explored but not yet committed to a strongly connected component. Note that this is not the normal depth-first search stack, as nodes are not popped as the search returns up the tree; they are only popped when an entire strongly connected component has been found.
 
The outermost loop searches each node that has not yet been visited, ensuring that nodes which are not reachable from the first node are still eventually traversed. The function <tt>strongconnect</tt> performs a single depth-first search of the graph, finding all successors from the node <tt>v</tt>, and reporting all strongly connected components of that subgraph.
 
When each node finishes recursing, if its lowlink is still set to its index, then it is the root node of a strongly connected component, formed by all of the nodes above it on the stack. The algorithm pops the stack up to and including the current node, and presents all of these nodes as a strongly connected component.
 
== Remarks ==
# Complexity: The Tarjan procedure is called once for each node; the forall statement considers each edge at most twice.  The algorithm's running time is therefore linear in the number of edges and nodes in G, i.e. <math>O(|V|+|E|)</math>.
# The test for whether <tt>w</tt> is on the stack should be done in constant time, for example, by testing a flag stored on each node that indicates whether it is on the stack. 
# While there is nothing special about the order of the nodes within each strongly connected component, one useful property of the algorithm is that no strongly connected component will be identified before any of its successors. Therefore, the order in which the strongly connected components are identified constitutes a reverse [[Topological sorting|topological sort]] of the [[Directed acyclic graph|DAG]] formed by the strongly connected components.<ref>{{cite web|last=Harrison|first=Paul|title=Robust topological sorting and Tarjan's algorithm in Python|url=http://www.logarithmic.net/pfh/blog/01208083168|accessdate=9 February 2011}}</ref>
 
== References ==
<references />
 
== External links ==
*[http://www.ics.uci.edu/~eppstein/161/960220.html#sca Description of Tarjan's Algorithm]
*[http://stackoverflow.com/questions/6643076/tarjan-cycle-detection-help-c#sca Implementation of Tarjan's Algorithm in .NET]
*[https://github.com/danielrbradley/CycleDetection Implementation of Tarjan's Algorithm in .NET (GitHub)]
*[https://github.com/bwesterb/py-tarjan/ Another implementation of Tarjan's Algorithm in Python]
*[https://gist.github.com/1440602 Implementation of Tarjan's Algorithm in Javascript]
 
[[Category:Graph algorithms]]
[[Category:Graph connectivity]]
[[Category:Articles with example pseudocode]]

Revision as of 11:57, 16 March 2013

Template:Infobox algorithm Tarjan's Algorithm (named for its discoverer, Robert Tarjan[1]) is a graph theory algorithm for finding the strongly connected components of a graph. Although it precedes it chronologically, it can be seen as an improved version of Kosaraju's algorithm, and is comparable in efficiency to the path-based strong component algorithm.

Overview

The algorithm takes a directed graph as input, and produces a partition of the graph's vertices into the graph's strongly connected components. Each vertex of the graph appears in exactly one of the strongly connected components. Any vertex that is not on a directed cycle forms a strongly connected component all by itself: for example, a vertex whose in-degree or out-degree is 0, or any vertex of an acyclic graph.

The basic idea of the algorithm is this: a depth-first search begins from an arbitrary start node (and subsequent depth-first searches are conducted on any nodes that have not yet been found). As usual with depth-first search, the search visits every node of the graph exactly once, declining to revisit any node that has already been explored. Thus, the collection of search trees is a spanning forest of the graph. The strongly connected components will be recovered as certain subtrees of this forest. The roots of these subtrees are called the "roots" of the strongly connected components. Any node of a strongly connected component might serve as the root, if it happens to be the first node of the component that is discovered by the search.

Stack invariant

The nodes are placed on a stack in the order in which they are visited. When the depth-first search recursively explores a node v and its descendants, those nodes are not all necessarily popped from the stack before this recursive call returns. The crucial invariant property is that a node remains on the stack after exploration if and only if it has a path to some node earlier on the stack.

At the end of the call that explores v and its descendants, we know whether v itself has a path to any node earlier on the stack. If so, the call returns, leaving v on the stack to preserve the invariant. If not, then v must be the root of its strongly connected component, which consists of v together with any later nodes on the stack (such nodes all have paths back to v but not to any earlier node). This entire component is then popped from the stack and returned, again preserving the invariant.

Bookkeeping

Each node v is assigned a unique integer v.index, which numbers the nodes consecutively in the order in which they are discovered. It also maintains a value v.lowlink that represents (roughly speaking) the smallest index of any node known to be reachable from v, including v itself. Therefore v must be left on the stack if v.lowlink < v.index, whereas v must be removed as the root of a strongly connected component if v.lowlink == v.index. The value v.lowlink is computed during the depth-first search from v, as this finds the nodes that are reachable from v.

The algorithm in pseudocode

algorithm tarjan is
  input: graph G = (V, E)
  output: set of strongly connected components (sets of vertices)

  index := 0
  S := empty
  for each v in V do
    if (v.index is undefined) then
      strongconnect(v)
    end if
  end for

  function strongconnect(v)
    // Set the depth index for v to the smallest unused index
    v.index := index
    v.lowlink := index
    index := index + 1
    S.push(v)

    // Consider successors of v
    for each (v, w) in E do
      if (w.index is undefined) then
        // Successor w has not yet been visited; recurse on it
        strongconnect(w)
        v.lowlink  := min(v.lowlink, w.lowlink)
      else if (w is in S) then
        // Successor w is in stack S and hence in the current SCC
        v.lowlink  := min(v.lowlink, w.index)
      end if
    end for

    // If v is a root node, pop the stack and generate an SCC
    if (v.lowlink = v.index) then
      start a new strongly connected component
      repeat
        w := S.pop()
        add w to current strongly connected component
      until (w = v)
      output the current strongly connected component
    end if
  end function

The index variable is the depth-first search node number counter. S is the node stack, which starts out empty and stores the history of nodes explored but not yet committed to a strongly connected component. Note that this is not the normal depth-first search stack, as nodes are not popped as the search returns up the tree; they are only popped when an entire strongly connected component has been found.

The outermost loop searches each node that has not yet been visited, ensuring that nodes which are not reachable from the first node are still eventually traversed. The function strongconnect performs a single depth-first search of the graph, finding all successors from the node v, and reporting all strongly connected components of that subgraph.

When each node finishes recursing, if its lowlink is still set to its index, then it is the root node of a strongly connected component, formed by all of the nodes above it on the stack. The algorithm pops the stack up to and including the current node, and presents all of these nodes as a strongly connected component.

Remarks

  1. Complexity: The Tarjan procedure is called once for each node; the forall statement considers each edge at most twice. The algorithm's running time is therefore linear in the number of edges and nodes in G, i.e. O(|V|+|E|).
  2. The test for whether w is on the stack should be done in constant time, for example, by testing a flag stored on each node that indicates whether it is on the stack.
  3. While there is nothing special about the order of the nodes within each strongly connected component, one useful property of the algorithm is that no strongly connected component will be identified before any of its successors. Therefore, the order in which the strongly connected components are identified constitutes a reverse topological sort of the DAG formed by the strongly connected components.[2]

References

  1. Many property agents need to declare for the PIC grant in Singapore. However, not all of them know find out how to do the correct process for getting this PIC scheme from the IRAS. There are a number of steps that you need to do before your software can be approved.

    Naturally, you will have to pay a safety deposit and that is usually one month rent for annually of the settlement. That is the place your good religion deposit will likely be taken into account and will kind part or all of your security deposit. Anticipate to have a proportionate amount deducted out of your deposit if something is discovered to be damaged if you move out. It's best to you'll want to test the inventory drawn up by the owner, which can detail all objects in the property and their condition. If you happen to fail to notice any harm not already mentioned within the inventory before transferring in, you danger having to pay for it yourself.

    In case you are in search of an actual estate or Singapore property agent on-line, you simply should belief your intuition. It's because you do not know which agent is nice and which agent will not be. Carry out research on several brokers by looking out the internet. As soon as if you end up positive that a selected agent is dependable and reliable, you can choose to utilize his partnerise in finding you a home in Singapore. Most of the time, a property agent is taken into account to be good if he or she locations the contact data on his website. This may mean that the agent does not mind you calling them and asking them any questions relating to new properties in singapore in Singapore. After chatting with them you too can see them in their office after taking an appointment.

    Have handed an trade examination i.e Widespread Examination for House Brokers (CEHA) or Actual Property Agency (REA) examination, or equal; Exclusive brokers are extra keen to share listing information thus making certain the widest doable coverage inside the real estate community via Multiple Listings and Networking. Accepting a severe provide is simpler since your agent is totally conscious of all advertising activity related with your property. This reduces your having to check with a number of agents for some other offers. Price control is easily achieved. Paint work in good restore-discuss with your Property Marketing consultant if main works are still to be done. Softening in residential property prices proceed, led by 2.8 per cent decline within the index for Remainder of Central Region

    Once you place down the one per cent choice price to carry down a non-public property, it's important to accept its situation as it is whenever you move in – faulty air-con, choked rest room and all. Get round this by asking your agent to incorporate a ultimate inspection clause within the possibility-to-buy letter. HDB flat patrons routinely take pleasure in this security net. "There's a ultimate inspection of the property two days before the completion of all HDB transactions. If the air-con is defective, you can request the seller to repair it," says Kelvin.

    15.6.1 As the agent is an intermediary, generally, as soon as the principal and third party are introduced right into a contractual relationship, the agent drops out of the image, subject to any problems with remuneration or indemnification that he could have against the principal, and extra exceptionally, against the third occasion. Generally, agents are entitled to be indemnified for all liabilities reasonably incurred within the execution of the brokers´ authority.

    To achieve the very best outcomes, you must be always updated on market situations, including past transaction information and reliable projections. You could review and examine comparable homes that are currently available in the market, especially these which have been sold or not bought up to now six months. You'll be able to see a pattern of such report by clicking here It's essential to defend yourself in opposition to unscrupulous patrons. They are often very skilled in using highly unethical and manipulative techniques to try and lure you into a lure. That you must also protect your self, your loved ones, and personal belongings as you'll be serving many strangers in your home. Sign a listing itemizing of all of the objects provided by the proprietor, together with their situation. HSR Prime Recruiter 2010
  2. Template:Cite web

External links