Skip to main content

Create Graph DataStructure

Project description

Author : Amit Singh Sansoya (@amit3200) Github : library : graphqt

# Import

`import graphqt`

# Introduction This is test library for the python which lets you create graph using some functions. This library will allow you to create undirected graphs and also provides some of the other functionalities. This library is for the beginner programmer who wants to get started at the programming with the graphs and want to visualize it easily. It is highly recommended to learn the actual code so that one can implement them without using this library at the interviews, and competition. This library was designed for the programmers who are studying graph currently. This will allow them to have the idea and brute force solution to them which they can further optimize. This libary also allow’s you to do following things

  • Create Graph [Undirected]
  • Detect Cycle [Undirected]
  • Check Path [Undirected]
  • Disconnected Components [Undirected]

# Create Graph

### Description:

This function allow you to add the edge between two nodes. The use of this function is very simple. One only needs to pass the dictionary so called graph,node u and node v where edge will exist between u and v. Moreover the edge v and u will be automatically created as this is undirected graph.

Function Use : insertuv(dictionary_name,node1,node2) Example : graphqt.insert_uv(d,1,2) Return Type : None In above example d is the dictionary (so called graph)

# Detect Cycle

### Description:

As the name suggests, this function will allow you to detect if there is a cycle in graph Return type is Boolean [True or False] where True tells that graph has cycle and False depicts there is no cycle. This will detect as per the undirected graph.

Function use : detect_cycle(dictionary_name) Example : graphqt.detect_cycle(d) Return Type : Boolean In above example d is the dictionary (so called graph)

# Check Path

### Description:

As the name says this function will tell you if there exists the path between two nodes. One only needs to pass dictionary_name (so called graph), the node u and node v. This function returns boolean value. True if there is path between u and v else False

Function use : check_path(dictionary_name,node1,node2) Example : graphqt.check_path(d,2,8) Return Type : Boolean In above example d is the dictionary (so called graph)

# Disconnected Components

### Description:

As the name says this function will detect the disconnected components and this will return a dictionary having keys as: ‘dis_count’: This will give you the values of count of disconnected components in a graph. If the value returned is 1 then there is no disconnected component. [ Makes Sense ;) ] ‘components’: Gives the list of containing nodes which are connected together

Function use : graphqt.get_disconnected_components(d) graphqt.get_disconnected_components(d)[‘dis_count’] graphqt.get_disconnected_components(d)[‘components’] Return Type : Dict

# Note

##### Remember

This library resembles undirected graph Also Get the logic behind function that is very important

# Do Support Author : ### Amit Singh Sansoya (@amit3200) ### Github :

## Keep Coding and Smiling

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for graphqt, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size graphqt-0.2.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View
Filename, size graphqt-0.2-py3-none-any.whl (8.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page