Skip to content

EliahKagan/codegraph

Repository files navigation

codegraph - graphs in software engineering

Graphs have many applications in computer science and software engineering, because they are a general model of relatedness. This repository is a collection of examples where something in software engineering has a useful and interesting graph structure that is straightforward—and fun—to visualize programmatically. Graphs are extremely versatile, so these examples are necessarily incomplete in the extreme.

These graphs should not be confused with the other thing called a graph, nor with plots (which relate to that other thing).

License

0BSD. See LICENSE.

The examples

Currently all examples are in Python, with all the code in Jupyter notebooks.

Installation

Clone the repository and go into the cloned directory:

git clone https://github.com/EliahKagan/codegraph
cd codegraph

Then you can install dependencies using conda or using pipenv.

conda

To use conda, make sure conda is installed (if not, I suggest Miniforge). Then run:

conda env create

pipenv

To use pipenv, make sure pipenv is installed.

Also install Graphviz on your system (conda takes care of that but pipenv doesn't). Graphviz 3.0.0 or higher is recommended, to avoid scaling problems. (Using conda instead of pipenv may be the easiest way to get a new version of Graphviz on some systems.)

Then run:

pipenv install -d

If you already have an application for running code in Jupyter notebooks that you want to use, such as VS Code with the Jupyter extension, then you can omit the -d.

As for installing Graphviz, most systems' package managers will install it, and the package name is usually Graphviz. If you can't find it, look into what package provides the dot command. On Windows, if you want to install Graphviz via a package manager, you can use scoop.

Usage

Way 1: JupyterLab

First, go to the directory where you ran conda or pipenv before and activate the environment you created.

If you used conda, run:

conda activate codegraph

If you used pipenv, run:

pipenv shell

Then run JupyterLab:

jupyter lab

Way 2: Another application

If you already have another application you prefer for opening and running code in Jupyter notebooks, you can use that.

In particular, you can use VS Code with the Jupyter Notebooks extension. If you do, make sure the environment you created (with conda or pipenv) is selected. If VS Code offers to install ipykernel or any other dependency, you should decline and select the appropriate environment.

A simpler version

An old, simpler version of some parts of this project is available on the simple branch, and may be of some interest.

Acknowledgements

Some parts of this project were tested by, and were improved based on input from, David Vassallo. Furthermore, significant parts were inspired by code I wrote for our project palgoviz, and some code to create nested tuple structures is derived from code there.

See also

About

graphs in software engineering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published