-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ajosh0504
committed
Feb 5, 2025
1 parent
4d8e8b6
commit b5f53ef
Showing
82 changed files
with
5,928 additions
and
4,804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ node_modules | |
#Ignore PDF Files | ||
PDF_KG | ||
.sass-cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
from collections import defaultdict | ||
def addEdge(graph,u,v): | ||
graph[u].append(v) | ||
def generate_edges(graph): | ||
edges = [] | ||
|
||
# for each node in graph | ||
for node in graph: | ||
|
||
# for each neighbour node of a single node | ||
for neighbour in graph[node]: | ||
|
||
# if edge exists then append | ||
edges.append((node, neighbour)) | ||
from collections import defaultdict | ||
|
||
|
||
def addEdge(graph, u, v): | ||
graph[u].append(v) | ||
|
||
|
||
def generate_edges(graph): | ||
edges = [] | ||
|
||
# for each node in graph | ||
for node in graph: | ||
# for each neighbour node of a single node | ||
for neighbour in graph[node]: | ||
# if edge exists then append | ||
edges.append((node, neighbour)) | ||
return edges | ||
|
||
|
||
def build_graph(level_dict): | ||
graph = defaultdict(list) | ||
relationship_names = defaultdict(set) | ||
for level in level_dict.keys(): | ||
#print(f'Level is {level}') | ||
for source,targets in level_dict[level].items(): | ||
#print(f'Source is {source} and targets are {targets}') | ||
for _,relationships in targets.items(): | ||
#print(f'Target Node {target_node} and relationships {relationships}') | ||
# print(f'Level is {level}') | ||
for source, targets in level_dict[level].items(): | ||
# print(f'Source is {source} and targets are {targets}') | ||
for _, relationships in targets.items(): | ||
# print(f'Target Node {target_node} and relationships {relationships}') | ||
for target_node, edges in relationships.items(): | ||
addEdge(graph,source,target_node) | ||
relationship_key = (source,target_node) | ||
addEdge(graph, source, target_node) | ||
relationship_key = (source, target_node) | ||
for edge in edges: | ||
relationship_names[relationship_key].add(edge) | ||
return graph,relationship_names | ||
return graph, relationship_names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.