Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3238147.3240484acmconferencesArticle/Chapter ViewAbstractPublication PagesaseConference Proceedingsconference-collections
short-paper

Code2graph: automatic generation of static call graphs for Python source code

Published: 03 September 2018 Publication History

Abstract

A static call graph is an imperative prerequisite used in most interprocedural analyses and software comprehension tools. However, there is a lack of software tools that can automatically analyze the Python source-code and construct its static call graph. In this paper, we introduce a prototype Python tool, named code2graph, which automates the tasks of (1) analyzing the Python source-code and extracting its structure, (2) constructing static call graphs from the source code, and (3) generating a similarity matrix of all possible execution paths in the system. Our goal is twofold: First, assist the developers in understanding the overall structure of the system. Second, provide a stepping stone for further research that can utilize the tool in software searching and similarity detection applications. For example, clustering the execution paths into a logical workflow of the system would be applied to automate specific software tasks. Code2graph has been successfully used to generate static call graphs and similarity matrices of the paths for three popular open-source Deep Learning projects (TensorFlow, Keras, PyTorch). A tool demo is available at https://youtu.be/ecctePpcAKU.

References

[1]
Barbara Ryder. 1979. Constructing the Call Graph of a Program. IEEE Transactions on Software Engineering, SE-5, 3 (1979), 216–226.
[2]
Michael Burch. 2016. The dynamic call graph matrix. In Proceedings of the 9th International Symposium on Visual Information Communication and Interaction. ACM. 1-8.
[3]
Gail Murphy, et. al. 1996. An empirical study of static call graph extractors. In Proceedings of the 18th international conference on Software engineering (ICSE ‘96). 90-99.
[4]
Kareem Ali, et. al. 2015. Type-Based Call Graph Construction Algorithms for Scala. ACM Transactions on Software Engineering and Methodology, 25, 1, Article 9, 1-43.
[5]
Demitry Petrashko, et. al. 2016. Call graphs for languages with parametric polymorphism. ACM SIGPLAN Notices, 51, 10, 394-409.
[6]
Inspect, Python 3.6.5 documentation. 2018.
[7]
Retrieved from: docs.python.org/3/library/inspect.html.
[8]
Construct_Call_Graph. 2018. Retrieved from: blog.prashanthellina.com.
[9]
Pyan – Constructing static call-graphs. 2018. Retrieved from: github.com/DavidFraser/pyan.
[10]
Abstract Syntax Trees – Python 3.6.5 documentation. 2018. Retrieved from: docs.python.org/3/library/ast.html.
[11]
NetworkX – Software for complex networks. 2018. Retrieved from: etworkx.github.io.
[12]
Eleftherios Koutsofios and Stephanie North. 1991. Drawing graphs with dot. Technical Report 910904-59113-08TM, AT&T Bell Laboratories, Murray Hill, NJ.
[13]
Ellson, John, et. al. Graphviz and dynagraph—static and dynamic graph drawing tools. 2004. In Graph drawing software, Springer, Berlin, Heidelberg, 127-148.
[14]
Susan Garavaglia and Asha Sharma. A smart guide to dummy variables: Four applications and a macro. 1998. In Proceedings of the Northeast SAS Users Group Conference, 43.
[15]
Niwattanakul Suphakit, et al. Using of Jaccard coefficient for keywords similarity. 2013. In Proceedings of the International MultiConference of Engineers and Computer Scientists, 1, 6.
[16]
TensorFlow – AI Python platform. 2018.
[17]
Retrieved from: github.com/tensorflow/tensorflow.
[18]
Keras – Python AI Library. 2018. Retrieved from: github.com/kerasteam/keras.
[19]
PyTorch. Advanced AI platform. 2018. Retrieved from: github.com/pytorch.
[20]
Website of Code2graph – Constructing static call graphs. 2018. Retrieved from: https://info.umkc.edu/UDIC_Research/index.php/code2graph/.

Cited By

View all
  • (2024)Efficient Construction of Practical Python Call Graphs with Entity Knowledge BaseInternational Journal of Software Engineering and Knowledge Engineering10.1142/S021819402450010434:07(999-1024)Online publication date: 22-May-2024
  • (2024)PyVisVue3D3: Python visualization from hierarchy tree to call graphSoftwareX10.1016/j.softx.2024.10168926(101689)Online publication date: May-2024
  • (2023)An Analytical Review of the Source Code Models for Exploit AnalysisInformation10.3390/info1409049714:9(497)Online publication date: 8-Sep-2023
  • Show More Cited By

Index Terms

  1. Code2graph: automatic generation of static call graphs for Python source code

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ASE '18: Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering
    September 2018
    955 pages
    ISBN:9781450359375
    DOI:10.1145/3238147
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 03 September 2018

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Python
    2. Static code analysis
    3. call graph construction

    Qualifiers

    • Short-paper

    Conference

    ASE '18
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 82 of 337 submissions, 24%

    Upcoming Conference

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)60
    • Downloads (Last 6 weeks)2
    Reflects downloads up to 12 Sep 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Efficient Construction of Practical Python Call Graphs with Entity Knowledge BaseInternational Journal of Software Engineering and Knowledge Engineering10.1142/S021819402450010434:07(999-1024)Online publication date: 22-May-2024
    • (2024)PyVisVue3D3: Python visualization from hierarchy tree to call graphSoftwareX10.1016/j.softx.2024.10168926(101689)Online publication date: May-2024
    • (2023)An Analytical Review of the Source Code Models for Exploit AnalysisInformation10.3390/info1409049714:9(497)Online publication date: 8-Sep-2023
    • (2023)Incremental Call Graph Construction in Industrial PracticeProceedings of the 45th International Conference on Software Engineering: Software Engineering in Practice10.1109/ICSE-SEIP58684.2023.00048(471-482)Online publication date: 17-May-2023
    • (2023)The Landscape of Source Code Representation Learning in AI-Driven Software Engineering Tasks2023 IEEE/ACM 45th International Conference on Software Engineering: Companion Proceedings (ICSE-Companion)10.1109/ICSE-Companion58688.2023.00098(342-343)Online publication date: May-2023
    • (2023)Towards understanding bugs in Python interpretersEmpirical Software Engineering10.1007/s10664-022-10239-x28:1Online publication date: 1-Jan-2023
    • (2022)GitQ- towards using badges as visual cues for GitHub projectsProceedings of the 30th IEEE/ACM International Conference on Program Comprehension10.1145/3524610.3527876(157-161)Online publication date: 16-May-2022
    • (2022)Supporting program comprehension by generating abstract code summary treeProceedings of the ACM/IEEE 44th International Conference on Software Engineering: New Ideas and Emerging Results10.1145/3510455.3512793(81-85)Online publication date: 21-May-2022
    • (2022)A lightweight approach for sound call graph approximationProceedings of the 37th ACM/SIGAPP Symposium on Applied Computing10.1145/3477314.3507126(1837-1844)Online publication date: 6-May-2022
    • (2022)Supporting program comprehension by generating abstract code summary tree2022 IEEE/ACM 44th International Conference on Software Engineering: New Ideas and Emerging Results (ICSE-NIER)10.1109/ICSE-NIER55298.2022.9793515(81-85)Online publication date: May-2022
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media