Code Examples
  Home arrow Code Examples arrow Page 4 - Articulation Edges and Vertexes
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

Articulation Edges and Vertexes
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-05-21

    Table of Contents:
  • Articulation Edges and Vertexes
  • Articulation Edges: Code Snippet
  • Articulation Vertexes: Theory
  • Articulation Vertexes: Code Snippet

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Articulation Edges and Vertexes - Articulation Vertexes: Code Snippet


    (Page 4 of 4 )

    Now that we know how it should work in theory, we shall implement it in simple C code.

    int DFS_Articulation_vertex(int vertex, int szint)

    {

    color[vertex] =GRAY;

    topological_order[vertex] = szint;

    int sTMinLevBaPE = INT_MAX;

    int sTMinLevBaPECur = 0;

    int dropOffChilds = 0;

    int childs = 0;

    pListIt p;

     

    for (p = adjacencyList[vertex]; p != NULL; p = p -> p_next)

    {

    if (!color[p -> value])

    {

    ancient[p->value] = vertex ;

    ++childs;

    sTMinLevBaPECur =

    DFS_Articulation_vertex(p->value, szint + 1);

     

    if (sTMinLevBaPECur < szint)

    {

    if( sTMinLevBaPECur < sTMinLevBaPE)

    {

    sTMinLevBaPE = sTMinLevBaPECur;

    }

    }

     

    else

    {

    ++dropOffChilds;

    }

    }

    else

    {

    if (color[p->value] == 1 &&

    topological_order[p->value] < szint -1 && topological_order[p->value] < sTMinLevBaPE )

    {

    sTMinLevBaPE = topological_order[p->value];

     

    }

    }

    }

     

     

    color[vertex] = BLACK;

     

    if (ancient[vertex])

    {

    if (dropOffChilds)

    {

    printf(" %d -> %dn", vertex, dropOffChilds);

    }

    else

    {

    if (childs > 1)

    {

    printf(" %d -> %dn", vertex, childs);

    }

     

    }

     

    }

     

    return sTMinLevBaPE;

     

    }

    The solution for the graph on the previous page:

    Articulation vertexes

    5 -> 1

    15 -> 2

    16 -> 1

    13 -> 1

    14 -> 1

    11 -> 2

    6 -> 2

    3 -> 1

    -->BDF.zip<--

    We made it to the end of this article. The source file you may download from the above link contains everything we did during our last three articles, including how the Depth First Search works and how we may use the additional information generated during the search. We also saw how, by refining the search a little and making minimal modifications, we turned it into a complex problem-solving technique.

    I am honored to catch your attention for the time you read this article, and I would like to remind you of the rating possibilities you have by simply giving a mark to the article or expressing your thoughts in the blog dedicated to this article. Eventually you may also join the DevHardware forum and act in the same manner there. During the next article, the subject will be spanning trees with minimal cost. Until next time Live With Passion!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    CODE EXAMPLES ARTICLES

    - Bipartite Graphs
    - Connectivity in Graphs
    - The Ford-Fulkerson Algorithm
    - Critical Paths
    - The Bellman-Ford and Roy-Floyd Algorithms
    - Shortest Path Algorithms in Graphs
    - Minimum Spanning Tree
    - Articulation Edges and Vertexes
    - Circles and Connectivity in Graphs
    - Depth-First Search in Graphs
    - Breadth-First Search in Graphs
    - The Prufer Code and the Floyd-Warshall Algor...
    - An Insight into Graphs
    - Coding a Custom Object with WSC
    - Creating a Custom Object with WSC





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek