Code Monkey home page Code Monkey logo

sscc's Introduction

Search for strongly-connected components

Kosaraju's algorithm:

  1. Perform a DFS of G and number the vertices in order of completion of the recursive calls.
  2. Construct a new directed graph Gr by reversing the direction of every arc in G.
  3. Perform a DFS on Gr starting the search from the highest numbered vertex according to the numbering assigned at step 1. If the DFS does not reach all vertices, start the next DFS from the highest numbered remaining vertex.
  4. Each tree in the resulting spanning forest is a strong component of G.

Structure of writing code for console version:

  • Reading the graph: we use adjacency matrix for assignment graph
  • Loop in the deph for original graph with topologigal sorted output list
  • Reverse original graph
  • Loop in the deph for reversion graph in toplological sorted order
  • Output components from step (1.4)- strongly-connected components

Structure of writing code for version with graphic interface:

  1. Interface part (JavaScript | OpenLayers3 | HTML | CSS):
    • Making the html page with certain design and sizes
    • Using OpenLayers3 as a library for creating graphs
    • Create empty sheet instead for the original map for recieving an ability to input the graph
    • The complexity of creating graphical dynamic objects is assumed by OpenLayers3- JS library
    • Creating the arrow and choosing the suitable design are our purposes
    • Final unit of the interface part is making the adjacent matrix for transfering to the server
  2. Server part (Python | CGI | Windows):
    • ///App--->cgi-bin/script.py-----index.html-----code.js----style.css----start.py//
    • start.py for starting the web-server on localhost:8000
    • index.html, code.js, style.css -frontend part
    • cgi-bin/script.py/ -server part
    • when user clicks the "Run button", JavaScript part sends AJAX request with adjacent matrix in JSON format to the server and then receives the answer-list of strongly-connected components and alert it

Testing the app:

For checking the correct working of our app we will use these pages with undeniable true examples:

As practice shows, the application is working correctly

Screenshots

Image alt Image alt Image alt Image alt

Links for better understanding algorithm and code:

sscc's People

Contributors

denisplusplus avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.