Skip to content

Instantly share code, notes, and snippets.

@albertogiunta
Last active January 20, 2019 21:29
Show Gist options
  • Save albertogiunta/15677cd161c47c5f959a64dba3cc0aaf to your computer and use it in GitHub Desktop.
Save albertogiunta/15677cd161c47c5f959a64dba3cc0aaf to your computer and use it in GitHub Desktop.
def do_aut_distance(data, sse, aut):
rec_do_aut_distance(sse.coauthor_network(aut), sse, [aut])
def rec_do_aut_distance(graph, sse, already_expanded_list):
for co_aut in graph.nodes():
if co_aut not in already_expanded_list:
already_expanded_list.append(co_aut)
new_level = sse.coauthor_network(co_aut)
rec_do_aut_distance(graph, sse, already_expanded_list)
# if is_subgraph(new_level, graph):
# return
for edge in new_level.edges():
graph.add_edge(co_aut, edge[1])
# def is_subgraph(small, big):
# for edge in small.edges_iter():
# if not big.has_edge(edge):
# return False
# return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment