Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions jupyter/PathFindingJava.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
"id": "ec6baa64",
"metadata": {},
"source": [
"## What GPT-4 has to say about it\n",
"\n",
"### All pairs shortest path\n",
"\n",
"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",
Expand Down Expand Up @@ -95,7 +93,9 @@
"\n",
"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",
"\n",
"By focusing on the longest paths in your dependency graph, you can uncover areas requiring attention for optimization, maintenance, and improved system architecture."
"By focusing on the longest paths in your dependency graph, you can uncover areas requiring attention for optimization, maintenance, and improved system architecture.\n",
"\n",
"(Text adapted from ChatGPT 4)"
]
},
{
Expand Down Expand Up @@ -568,6 +568,18 @@
" plot.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "04a4a930",
"metadata": {},
"outputs": [],
"source": [
"# Small function to convert nan to zero in general\n",
"def nan_to_zero(value: float) -> float:\n",
" return 0 if np.isnan(value) else value"
]
},
{
"cell_type": "markdown",
"id": "0b42163d",
Expand Down Expand Up @@ -618,7 +630,10 @@
"outputs": [],
"source": [
"# Create the directed and unweighted projection with the parameters defined directly above\n",
"is_package_data_available=create_directed_unweighted_projection(package_path_finding_parameters)"
"is_package_data_available=create_directed_unweighted_projection(package_path_finding_parameters)\n",
"\n",
"if not is_package_data_available:\n",
" print(\"No projected data for path finding available for Package nodes.\")"
]
},
{
Expand Down Expand Up @@ -677,7 +692,7 @@
"metadata": {},
"outputs": [],
"source": [
"package_dependencies_graph_diameter=all_pairs_shortest_paths_distribution_per_artifact['distance'].max()\n",
"package_dependencies_graph_diameter=nan_to_zero(all_pairs_shortest_paths_distribution_per_artifact['distance'].max())\n",
"print('The diameter (longest shortest path) of the projected package dependencies Graph is:', package_dependencies_graph_diameter)"
]
},
Expand Down Expand Up @@ -942,7 +957,7 @@
"metadata": {},
"outputs": [],
"source": [
"package_dependencies_max_longest_path=longest_paths_distribution_per_artifact['distance'].max()\n",
"package_dependencies_max_longest_path=nan_to_zero(longest_paths_distribution_per_artifact['distance'].max())\n",
"print('The max. longest path of the projected package dependencies is:', package_dependencies_max_longest_path)"
]
},
Expand Down Expand Up @@ -1210,7 +1225,10 @@
"outputs": [],
"source": [
"# Create the directed and unweighted projection with the parameters defined directly above\n",
"is_artifact_data_available=create_directed_unweighted_projection(artifact_path_finding_parameters)"
"is_artifact_data_available=create_directed_unweighted_projection(artifact_path_finding_parameters)\n",
"\n",
"if not is_artifact_data_available:\n",
" print(\"No projected data for path finding available for Artifact nodes.\")"
]
},
{
Expand All @@ -1228,6 +1246,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"Projection data available: \" + str(is_artifact_data_available))\n",
"artifact_projection_statistics=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", artifact_path_finding_parameters)\n",
"artifact_projection_statistics"
]
Expand Down Expand Up @@ -1280,7 +1299,7 @@
"metadata": {},
"outputs": [],
"source": [
"artifact_dependencies_graph_diameter=all_pairs_shortest_paths_distribution_for_artifacts['distance'].max()\n",
"artifact_dependencies_graph_diameter=nan_to_zero(all_pairs_shortest_paths_distribution_for_artifacts['distance'].max())\n",
"print('The diameter (longest shortest path) of the projected artifact dependencies Graph is:', artifact_dependencies_graph_diameter)"
]
},
Expand Down Expand Up @@ -1358,7 +1377,7 @@
"outputs": [],
"source": [
"# Execute algorithm \"longest path (for directed acyclic graphs)\" and query overall and artifact specific results\n",
"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)"
"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)"
]
},
{
Expand All @@ -1376,7 +1395,7 @@
"metadata": {},
"outputs": [],
"source": [
"artifact_dependencies_max_longest_path=longest_artifact_paths_distribution['distance'].max()\n",
"artifact_dependencies_max_longest_path=nan_to_zero(longest_artifact_paths_distribution['distance'].max())\n",
"print('The max. longest path of the projected artifact dependencies is:', artifact_dependencies_max_longest_path)"
]
},
Expand Down
42 changes: 30 additions & 12 deletions jupyter/PathFindingTypescript.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
"id": "ec6baa64",
"metadata": {},
"source": [
"## What GPT-4 has to say about it\n",
"\n",
"### All pairs shortest path\n",
"\n",
"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",
Expand Down Expand Up @@ -95,7 +93,9 @@
"\n",
"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",
"\n",
"By focusing on the longest paths in your dependency graph, you can uncover areas requiring attention for optimization, maintenance, and improved system architecture."
"By focusing on the longest paths in your dependency graph, you can uncover areas requiring attention for optimization, maintenance, and improved system architecture. \n",
"\n",
"(Text adapted from ChatGPT 4)"
]
},
{
Expand Down Expand Up @@ -651,6 +651,18 @@
" return result_data_frame.sort_values(ascending=False);"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ab378355",
"metadata": {},
"outputs": [],
"source": [
"# Small function to convert nan to zero in general\n",
"def nan_to_zero(value: float) -> float:\n",
" return 0 if np.isnan(value) else value"
]
},
{
"cell_type": "markdown",
"id": "0b42163d",
Expand Down Expand Up @@ -701,7 +713,10 @@
"outputs": [],
"source": [
"# Create the directed and unweighted projection with the parameters defined directly above\n",
"is_module_data_available=create_directed_unweighted_projection(module_path_finding_parameters)"
"is_module_data_available=create_directed_unweighted_projection(module_path_finding_parameters)\n",
"\n",
"if not is_module_data_available:\n",
" print(\"No projected data for path finding available for Module nodes.\")"
]
},
{
Expand All @@ -719,6 +734,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"Projection data available: \" + str(is_module_data_available))\n",
"module_projection_statistics=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", module_path_finding_parameters)\n",
"module_projection_statistics"
]
Expand Down Expand Up @@ -759,7 +775,7 @@
"metadata": {},
"outputs": [],
"source": [
"module_dependencies_graph_diameter=all_pairs_shortest_paths_distribution_per_project_and_root_project['distance'].max()\n",
"module_dependencies_graph_diameter=nan_to_zero(all_pairs_shortest_paths_distribution_per_project_and_root_project['distance'].max())\n",
"print('The diameter (longest shortest path) of the projected module dependencies Graph is:', module_dependencies_graph_diameter)"
]
},
Expand Down Expand Up @@ -996,12 +1012,14 @@
"metadata": {},
"outputs": [],
"source": [
"all_pairs_shortest_paths_distribution_per_root_project_isolated=all_pairs_shortest_paths_distribution_per_project_and_root_project.query('isDifferentTargetRootProject == False')\n",
"\n",
"all_pairs_shortest_paths_distribution_per_root_project_isolated.\\\n",
" groupby([\"sourceRootProject\", \"distance\"], as_index=False)\\\n",
" [[\"pairCount\", \"sourceNodeCount\",\"targetNodeCount\"]].\\\n",
" apply(max).head(20)"
"all_pairs_shortest_paths_distribution_per_root_project_isolated = all_pairs_shortest_paths_distribution_per_project_and_root_project.query('isDifferentTargetRootProject == False')\n",
"if all_pairs_shortest_paths_distribution_per_root_project_isolated.empty:\n",
" print(\"No data for all pairs shortest paths per root project available.\")\n",
"else:\n",
" display(all_pairs_shortest_paths_distribution_per_root_project_isolated.\n",
" groupby([\"sourceRootProject\", \"distance\"], as_index=False)\n",
" [[\"pairCount\", \"sourceNodeCount\", \"targetNodeCount\"]].\n",
" apply(max).head(20))"
]
},
{
Expand Down Expand Up @@ -1159,7 +1177,7 @@
"metadata": {},
"outputs": [],
"source": [
"module_dependencies_max_longest_path=longest_paths_distribution_per_project['distance'].max()\n",
"module_dependencies_max_longest_path=nan_to_zero(longest_paths_distribution_per_project['distance'].max())\n",
"print('The max. longest path of the projected module dependencies is:', module_dependencies_max_longest_path)"
]
},
Expand Down
Loading