Git Product home page Git Product logo

cycles-detector's Introduction

Cycles-Detector

This program is used to detect cycles in an undirected graph using matplotlib and networkx libraries in python. It checks each node of the given graph and recursively check cycles with each unvisited neighboring node. If a given node has a neighbor that is connected to a visited ancestor node which is not the parent node (given node) as this is an undirected graph, then a cycle is detected and held in the cycles array. Once all nodes are visited, we proceed with the cycles array to draw a graph showing only the cycles found in the network. Also, an additional graph of the main given network is drawn to the user to show the differences between the main graph and the cycles graph. If no cycles were found in the network, then an empty graoh will be displayed with no cycles in it.

How to use:

First add the rows of your graph in an excel file in csv form. The first column should contain the letter of the source node and the second column should contain the destination node of each edge. Name the file as "edges" and make sure it is in csv form and put it in the same directory as your python file. Run the python file and check the shown graphs to see the cycles found in the graph.

Sample run:

edges.csv file containing edges of the graph

Screenshot 2023-07-20 021641

Main network graph

Screenshot 2023-07-20 021619

Detected cycle graph

Screenshot 2023-07-20 021608

cycles-detector's People

Contributors

seifbassiounyy 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.