An open API service indexing awesome lists of open source software.

https://github.com/phaniteja5789/graph_pandas

Implementation of Graph which contain cycle and its Traversal from Pandas DataFrame
https://github.com/phaniteja5789/graph_pandas

datastructures-algorithms python3

Last synced: 7 months ago
JSON representation

Implementation of Graph which contain cycle and its Traversal from Pandas DataFrame

Awesome Lists containing this project

README

          

# Graph_Pandas
Implementation of Graph from Pandas DataFrame

**Requirement :**

Get the Traversal Path to reach any Node that is present in the data frame.

**Input**

The below is the dataframe

image


**Implementation Approach**

1.) Based on the data frame given, sorted the dataframe based on the Level Column in the dataframe
2.) From Level-0, Implemented a BFS Traversal with using Queue DataStructure and construct the graph
3.) From the input node, with the help of Parents column, traverse the path from given node till root node

**Installed Modules**

1.) Pandas
2.) Numpy
3.) re
4.) random

**Data Structures Used**
1.) List
2.) Queue using List
3.) Set

**Sample Input & Output**
Input - N2
give the traversal to reach N2 Node

Output -
image

Similarly based on the data frame, we can build the N-Ary Graph with n number of children and n number of parents.