Skip to content

Instantly share code, notes, and snippets.

@worthless443
Created May 6, 2020 16:08
Show Gist options
  • Save worthless443/a9d178af851846f1edc63dcf46ffab0f to your computer and use it in GitHub Desktop.
Save worthless443/a9d178af851846f1edc63dcf46ffab0f to your computer and use it in GitHub Desktop.
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