-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate duplicate nodes for files #22
Comments
@HickeyHsu Thanks for the nice feedback 👍. This also relates to the issue #23 that you've described? If not - could you give me a detailed example (and maybe even post a small screenshot of the graph/issue)? Thanks for your help! |
It's a more common problem than #23 . Almost every self-defined class would be duplicated. First node would be generated from files that defined the class, likes:
The second node would be generated from the import at another class, likes:
with an edge:
In fact, by looking at the edge collection, we can see that each edge starts with a file and ends with a class entity:
I also tried to fix it by using Classpaths instead of absolute paths: def calculate_dependency_graph_from_results_file_merged(self, results: Dict[str, Any]) -> None:
"""Constructs a dependency graph from a list of abstract file results.
merge same nodes
Args:
results (List[AbstractFileResult]): A list of objects that subclass AbstractFileResult.
"""
LOGGER.debug('creating dependency graph...')
result:FileResult
for _, result in results.items():
# node_name = result.unique_name
absolute_name = result.absolute_name
display_name = result.display_name
node_name=result.module_name+"."+Path(display_name).stem
self._digraph.add_node(node_name, absolute_name=absolute_name, display_name=display_name)
dependencies = result.scanned_import_dependencies
for dependency in dependencies:
self._digraph.add_node(dependency, display_name=dependency)
self._digraph.add_edge(node_name, dependency) |
This is a very exciting tool.
I try to use it to generate the FILE_RESULT_DEPENDENCY_GRAPH of Java project, and then found a problem.
For each Java file, the tool will generate two nodes: 1) file node (with absolute_name) and 2) class node (only with display name)
for example, node<D:\idea_workspace\ACPG4J\src\main\java\analyser4J\graph\AbstractVertex.java> and node<analyser4J.graph.AbstractVertex>
In my opinion, they should be regarded as one single node.
Wondering if there is a solution.
Again, this project is pretty amazing. Thanks!
The text was updated successfully, but these errors were encountered: