Last active
January 27, 2021 11:28
-
-
Save davidADSP/35648e480685c6b57ce1efad50170c26 to your computer and use it in GitHub Desktop.
Revisions
-
davidADSP revised this gist
Jun 23, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ #GET THE SUBGRAPH THAT CONTAINS TENSORFLOW for s in subgraphs: if 'tensorflow' in s: break pruned_EG = EG.subgraph(s) -
davidADSP revised this gist
Jun 19, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ EG = nx.ego_graph(G, 'tensorflow', distance = 'distance', radius = 22) #FIND THE 2-CONNECTED SUBGRAPHS subgraphs = nx.algorithms.connectivity.edge_kcomponents.k_edge_subgraphs(EG, k = 3) #GET THE SUBGRAPH THAT CONTAINS TENSORFLOW for s in subgraphs: -
davidADSP revised this gist
Jun 19, 2020 . 1 changed file with 15 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ import networkx as nx # SAMPLE DATA FORMAT #nodes = [('tensorflow', {'count': 13}), # ('pytorch', {'count': 6}), # ('keras', {'count': 6}), @@ -13,11 +14,22 @@ # ('opencv', 'tensorflow', {'weight': 7, 'distance': 4}), # ('spark', 'tensorflow', {'weight': 1, 'distance': 10}), ...] #BUILD THE INITIAL FULL GRAPH G=nx.Graph() G.add_nodes_from(nodes) G.add_edges_from(edges) #BUILD THE EGO GRAPH FOR TENSORFLOW EG = nx.ego_graph(G, 'tensorflow', distance = 'distance', radius = 22) #FIND THE 2-CONNECTED SUBGRAPHS subgraphs = nx.algorithms.connectivity.edge_kcomponents.k_edge_subgraphs(EG, k = 2) #GET THE SUBGRAPH THAT CONTAINS TENSORFLOW for s in subgraphs: if SEED in s: break pruned_EG = EG.subgraph(s) ego_nodes = pruned_EG.nodes() ego_edges = pruned_EG.edges() -
davidADSP revised this gist
Jun 19, 2020 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,4 +17,7 @@ G.add_nodes_from(nodes) G.add_edges_from(edges) EG = nx.ego_graph(G, 'tensorflow', distance = 'distance', radius = 18) ego_nodes = EG.nodes() ego_edges = EG.edges() -
davidADSP created this gist
Jun 19, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ import networkx as nx #nodes = [('tensorflow', {'count': 13}), # ('pytorch', {'count': 6}), # ('keras', {'count': 6}), # ('scikit', {'count': 2}), # ('opencv', {'count': 5}), # ('spark', {'count': 13}), ...] #edges = [('pytorch', 'tensorflow', {'weight': 10, 'distance': 1}), # ('keras', 'tensorflow', {'weight': 9, 'distance': 2}), # ('scikit', 'tensorflow', {'weight': 8, 'distance': 3}), # ('opencv', 'tensorflow', {'weight': 7, 'distance': 4}), # ('spark', 'tensorflow', {'weight': 1, 'distance': 10}), ...] G=nx.Graph() G.add_nodes_from(nodes) G.add_edges_from(edges) EG = nx.ego_graph(G, 'tensorflow', distance = 'distance', radius = 18)