diff --git a/algorithm.py b/algorithm.py index 0ca4377733c44c031f17a3a6ed80d6e865f06015..f4df8dc06ea884e8e849f7afec085826c8ede0f1 100644 --- a/algorithm.py +++ b/algorithm.py @@ -29,7 +29,6 @@ class Algorithm(): copy_list = list(node_list_by_edge_count) copy_list.pop(0) - node_list_by_edge_count[0].rank = [[],[],[]] vis_list = [] neig_list = [] @@ -129,7 +128,8 @@ class Algorithm(): # Get parent of current node. Defined as node with smallest "index" and valid connection to current node. # TODO: Is "index" defined as index in edge_count list, or index of overall graph?? Does it even matter? - current_node.parent = current_node.edges_in[0] # First node should have the lowest respective index. + if current_node.edges_in is not None and current_node.edges_in != []: + current_node.parent = current_node.edges_in[0] # First node should have the lowest respective index. # Return original nodelist. Each node should now have the associated data as determined by this algorithm. return ranking diff --git a/data_mapping.py b/data_mapping.py index 3d7831c290d85c7660812dfea2ad780c0feead68..957681ecc11bdac5bddce0e94c74b869b0aef7d9 100644 --- a/data_mapping.py +++ b/data_mapping.py @@ -4,6 +4,7 @@ Maps graphs data to visual representation. # System Imports. from matplotlib import pyplot +from matplotlib.axes import Axes import networkx # User Class Imports. @@ -144,6 +145,9 @@ class DataMapping(): node_size=1500, alpha=0.6, linewidths=2, + + vmin=0, + vmax=0, ) networkx.draw_networkx_labels( self.nx_graph_1, @@ -233,6 +237,7 @@ class DataMapping(): label_dict[node['attr_dict']['node'].identifier] = node['attr_dict']['node'].data + # pyplot.subplot(122) # Create graph with new labels. networkx.draw_networkx_edges( self.nx_graph_2, @@ -240,12 +245,42 @@ class DataMapping(): # Edge settings. edge_color='black', + width=2, alpha=0.5, ) networkx.draw_networkx_nodes( self.nx_graph_2, self.nx_graph_2_position, + # Node settings. + cmap=pyplot.get_cmap('gray'), + node_color=[1,1,1,1,1,], + node_size=1500, + alpha=1, + linewidths=2, + ) + networkx.draw_networkx_labels( + self.nx_graph_2, + self.nx_graph_2_position, + + # Font settings. + with_labels=True, + font_weight='bold', + font_color='white', + # font_size=24, + labels=label_dict, + ) + pyplot.axis('off') + pyplot.show() + + + + # pyplot.subplot(122) + # Create graph with new labels. + networkx.draw_networkx_nodes( + self.nx_graph_2, + self.nx_graph_2_position, + # Node settings. cmap=pyplot.get_cmap('plasma'), node_color=value_map, @@ -253,6 +288,16 @@ class DataMapping(): alpha=0.6, linewidths=2, ) + networkx.draw_networkx_edges( + self.nx_graph_2, + self.nx_graph_2_position, + + # Edge settings. + edge_color='black', + # width=5, + alpha=0.5, + arrows=True, + ) networkx.draw_networkx_labels( self.nx_graph_2, self.nx_graph_2_position, @@ -261,6 +306,7 @@ class DataMapping(): with_labels=True, font_weight='bold', font_color='black', + # font_size=24, labels=label_dict, ) pyplot.axis('off') diff --git a/documents/Ppt_Images/greatest_first_01.png b/documents/Ppt_Images/greatest_first_01.png new file mode 100644 index 0000000000000000000000000000000000000000..fba0e6d1b1b2115daf00e8187ffd699703f09616 Binary files /dev/null and b/documents/Ppt_Images/greatest_first_01.png differ diff --git a/documents/Ppt_Images/greatest_first_01_crop.png b/documents/Ppt_Images/greatest_first_01_crop.png new file mode 100644 index 0000000000000000000000000000000000000000..ef44a51e40c1eef2cc767aa4948e0e00f62bcf03 Binary files /dev/null and b/documents/Ppt_Images/greatest_first_01_crop.png differ diff --git a/documents/Project_Showcase.odp b/documents/Project_Showcase.odp index 4e8c7c5ad19b1e00ab83cb0db7922abf9861a2a1..f158a6507e92deb812deb0b1b967b918d6a8aa73 100644 Binary files a/documents/Project_Showcase.odp and b/documents/Project_Showcase.odp differ diff --git a/main.py b/main.py index 701698049f630f6649a2d1c9dd77bf2e024a62c2..3ab956900aad10098d7b4117a88310c2e83454ae 100644 --- a/main.py +++ b/main.py @@ -27,8 +27,8 @@ node_4 = test_graph_1.add_node(edges_in=[node_3, ], edges_out=[node_0, ]) test_graph_1.sort_node_edge_lists() # Map graph to visual representation. -mapper = data_mapping.DataMapping(test_graph_1, None) -mapper.draw_map() +# mapper = data_mapping.DataMapping(test_graph_1, None) +# mapper.draw_map() # Reset graph connections. @@ -41,6 +41,8 @@ node_1 = test_graph_2.add_node(edges_in=[node_0, ]) node_2 = test_graph_2.add_node(edges_in=[node_1, ]) node_3 = test_graph_2.add_node(edges_in=[node_1, node_2, ], edges_out=[node_2, ]) node_4 = test_graph_2.add_node(edges_in=[node_3, ], edges_out=[node_0, node_2, ]) +# node_5 = test_graph_2.add_node(edges_in=[node_4], edges_out=[node_0, node_3], ) +# node_6 = test_graph_2.add_node(edges_in=[node_4, node_5], edges_out=[node_1], ) # Map graph to visual representation. test_graph_2.sort_node_edge_lists()