Created
May 6, 2020 16:08
-
-
Save worthless443/a9d178af851846f1edc63dcf46ffab0f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import numpy as np | |
import networkx as nx | |
lst = ['a','b','c', 'd'] | |
g_dst={} | |
i=0 | |
def check(graph:list)->str: | |
for k in range(len(graph)): | |
g=[] | |
for l in range(len(graph)): | |
l+=k*l | |
if l>=len(lst): | |
break | |
g.append(lst[l]) | |
g_dst[lst[k]] = g | |
arr=np.array([g_dst[val] for val in g_dst]) | |
for e in range(len(arr)): | |
graph = nx.complete_graph(arr[e]) | |
#print(nx.pagerank(graph)) | |
ranks = nx.pagerank(graph) | |
for node in ranks: | |
rank=ranks[node] | |
uni = (np.unique(rank)) | |
if uni.size == 1: | |
return ("simple structure") | |
if uni.size>1: | |
return ("complex structure") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment