Code Examples
  Home arrow Code Examples arrow Page 2 - 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 Edges: Code Snippet


    (Page 2 of 4 )

    How will all this look in a programming language? Here is the answer:

    int DFS_Articulation_edge(int vertex, int level)

    {

    color[vertex] = GRAY;

    topological_order[vertex] = level;

    int sTMinLevBaPE = INT_MAX;

    int sTMinLevBaPECur = 0;

    pListIt p;

     

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

    {

    if (!color[p -> value])

    {

    ancient[p->value] = vertex;

     

    sTMinLevBaPECur =

    DFS_Articulation_edge(p->value, level + 1);

    }

    if (sTMinLevBaPECur < level)

    {

    if (sTMinLevBaPECur < sTMinLevBaPE)

    {

    sTMinLevBaPE = sTMinLevBaPECur;

    }

    }

    else

    {

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

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

    {

    sTMinLevBaPE = topological_order[p->value];

     

    }

    }

    }

     

    color[vertex] = BLACK;

     

    if (ancient[vertex] && sTMinLevBaPE == INT_MAX)

    {

    printf(" %d - %dn", ancient[vertex], vertex);

    }

     

    return sTMinLevBaPE;

     

    }

    Let there be the following graph as input:

    -->Image Courtesy of Kátai Zoltán- Introduction to Graphs<--

    If we execute our application we will get as a result the following edges, what are indeed correct. It's a job well done!

    Cutting edges

    5 - 7

    16 - 21

    14 - 17

    1 - 4

    More Code Examples Articles
    More By Gabor Bernat


     

    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-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek