|
29 | 29 | "id": "ec6baa64", |
30 | 30 | "metadata": {}, |
31 | 31 | "source": [ |
32 | | - "## What GPT-4 has to say about it\n", |
33 | | - "\n", |
34 | 32 | "### All pairs shortest path\n", |
35 | 33 | "\n", |
36 | 34 | "Interpreting the results of the \"all pairs shortest path\" algorithm on a graph of statically analyzed code modules and their dependencies involves understanding the structure and implications of the paths between nodes (modules) in the graph. Here are some specific steps and insights to consider:\n", |
|
95 | 93 | "\n", |
96 | 94 | "8. **Documentation & Knowledge Transfer**: If certain modules consistently appear in the longest paths, they may require better documentation. Ensuring that their roles and the reasons for their lengthy dependencies are well understood can facilitate knowledge transfer among team members.\n", |
97 | 95 | "\n", |
98 | | - "By focusing on the longest paths in your dependency graph, you can uncover areas requiring attention for optimization, maintenance, and improved system architecture." |
| 96 | + "By focusing on the longest paths in your dependency graph, you can uncover areas requiring attention for optimization, maintenance, and improved system architecture.\n", |
| 97 | + "\n", |
| 98 | + "(Text adapted from ChatGPT 4)" |
99 | 99 | ] |
100 | 100 | }, |
101 | 101 | { |
|
568 | 568 | " plot.show()" |
569 | 569 | ] |
570 | 570 | }, |
| 571 | + { |
| 572 | + "cell_type": "code", |
| 573 | + "execution_count": null, |
| 574 | + "id": "04a4a930", |
| 575 | + "metadata": {}, |
| 576 | + "outputs": [], |
| 577 | + "source": [ |
| 578 | + "# Small function to convert nan to zero in general\n", |
| 579 | + "def nan_to_zero(value: float) -> float:\n", |
| 580 | + " return 0 if np.isnan(value) else value" |
| 581 | + ] |
| 582 | + }, |
571 | 583 | { |
572 | 584 | "cell_type": "markdown", |
573 | 585 | "id": "0b42163d", |
|
618 | 630 | "outputs": [], |
619 | 631 | "source": [ |
620 | 632 | "# Create the directed and unweighted projection with the parameters defined directly above\n", |
621 | | - "is_package_data_available=create_directed_unweighted_projection(package_path_finding_parameters)" |
| 633 | + "is_package_data_available=create_directed_unweighted_projection(package_path_finding_parameters)\n", |
| 634 | + "\n", |
| 635 | + "if not is_package_data_available:\n", |
| 636 | + " print(\"No projected data for path finding available for Package nodes.\")" |
622 | 637 | ] |
623 | 638 | }, |
624 | 639 | { |
|
677 | 692 | "metadata": {}, |
678 | 693 | "outputs": [], |
679 | 694 | "source": [ |
680 | | - "package_dependencies_graph_diameter=all_pairs_shortest_paths_distribution_per_artifact['distance'].max()\n", |
| 695 | + "package_dependencies_graph_diameter=nan_to_zero(all_pairs_shortest_paths_distribution_per_artifact['distance'].max())\n", |
681 | 696 | "print('The diameter (longest shortest path) of the projected package dependencies Graph is:', package_dependencies_graph_diameter)" |
682 | 697 | ] |
683 | 698 | }, |
|
942 | 957 | "metadata": {}, |
943 | 958 | "outputs": [], |
944 | 959 | "source": [ |
945 | | - "package_dependencies_max_longest_path=longest_paths_distribution_per_artifact['distance'].max()\n", |
| 960 | + "package_dependencies_max_longest_path=nan_to_zero(longest_paths_distribution_per_artifact['distance'].max())\n", |
946 | 961 | "print('The max. longest path of the projected package dependencies is:', package_dependencies_max_longest_path)" |
947 | 962 | ] |
948 | 963 | }, |
|
1210 | 1225 | "outputs": [], |
1211 | 1226 | "source": [ |
1212 | 1227 | "# Create the directed and unweighted projection with the parameters defined directly above\n", |
1213 | | - "is_artifact_data_available=create_directed_unweighted_projection(artifact_path_finding_parameters)" |
| 1228 | + "is_artifact_data_available=create_directed_unweighted_projection(artifact_path_finding_parameters)\n", |
| 1229 | + "\n", |
| 1230 | + "if not is_artifact_data_available:\n", |
| 1231 | + " print(\"No projected data for path finding available for Artifact nodes.\")" |
1214 | 1232 | ] |
1215 | 1233 | }, |
1216 | 1234 | { |
|
1228 | 1246 | "metadata": {}, |
1229 | 1247 | "outputs": [], |
1230 | 1248 | "source": [ |
| 1249 | + "print(\"Projection data available: \" + str(is_artifact_data_available))\n", |
1231 | 1250 | "artifact_projection_statistics=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", artifact_path_finding_parameters)\n", |
1232 | 1251 | "artifact_projection_statistics" |
1233 | 1252 | ] |
|
1280 | 1299 | "metadata": {}, |
1281 | 1300 | "outputs": [], |
1282 | 1301 | "source": [ |
1283 | | - "artifact_dependencies_graph_diameter=all_pairs_shortest_paths_distribution_for_artifacts['distance'].max()\n", |
| 1302 | + "artifact_dependencies_graph_diameter=nan_to_zero(all_pairs_shortest_paths_distribution_for_artifacts['distance'].max())\n", |
1284 | 1303 | "print('The diameter (longest shortest path) of the projected artifact dependencies Graph is:', artifact_dependencies_graph_diameter)" |
1285 | 1304 | ] |
1286 | 1305 | }, |
|
1358 | 1377 | "outputs": [], |
1359 | 1378 | "source": [ |
1360 | 1379 | "# Execute algorithm \"longest path (for directed acyclic graphs)\" and query overall and artifact specific results\n", |
1361 | | - "longest_artifact_paths_distribution=query_if_data_available(is_package_data_available, \"../cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", artifact_path_finding_parameters)" |
| 1380 | + "longest_artifact_paths_distribution=query_if_data_available(is_artifact_data_available, \"../cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", artifact_path_finding_parameters)" |
1362 | 1381 | ] |
1363 | 1382 | }, |
1364 | 1383 | { |
|
1376 | 1395 | "metadata": {}, |
1377 | 1396 | "outputs": [], |
1378 | 1397 | "source": [ |
1379 | | - "artifact_dependencies_max_longest_path=longest_artifact_paths_distribution['distance'].max()\n", |
| 1398 | + "artifact_dependencies_max_longest_path=nan_to_zero(longest_artifact_paths_distribution['distance'].max())\n", |
1380 | 1399 | "print('The max. longest path of the projected artifact dependencies is:', artifact_dependencies_max_longest_path)" |
1381 | 1400 | ] |
1382 | 1401 | }, |
|
0 commit comments