Code Examples
  Home arrow Code Examples arrow Page 3 - Circles and Connectivity in Graphs
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

Circles and Connectivity in Graphs
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2009-05-19

    Table of Contents:
  • Circles and Connectivity in Graphs
  • Circles and the Base Circle System
  • Strong connective components
  • Show it in C

  • 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


    Circles and Connectivity in Graphs - Strong connective components


    (Page 3 of 4 )

    Here is the solution: build the inverse order of the DFS search for the vertexes. Make an inverse of the direction (by reversing the direction of the edges). Call the DFS on the vertexes in the inverse DFS order of the vertexes on the inverse graph. Each call will show you another strong connective component of the graph.

    Now we need to understand why this is a solution. You can agree that, within a graph inside a strong connective component, there can be only vertexes that are on a circle, as otherwise there would not be a road between one and any of the other vertexes. Therefore, the points that are not in any of the circles will create a strong connective sub-graph on their own.

    In the last article, we learned that the topological sort would place the items into an order such that all edges coming out from the vertexes point toward vertexes in the right direction.  Now, inside graphs that contain circles, we can hardly talk about topological order, as by definition, topological order can be made only from circle-free graphs. However, we ignore this fact and build this so-called topological order (the inverse order of how we leave the vertexes during a Depth-First Search). Now we will reverse the direction of the edges inside the graph.  

    This way the edges that build the topological order are reversed, and all that will remain as edges pointing from left to right are those that, until now, were against the topological order, pointing from right to left. These edges formed the base circle system of the graph.

    Now if we call the DFS in the so-called “topological order,” each DFS will sense a strong connective component. On the inverse graph, the search can go ahead on those edges that were on a circle, and show those vertexes that are on a circle, and in the end it will drop by at each of the vertexes that maintain the circle.

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