Skip to main content

Extension for colcon to support support generating gexf files which can be inspected in Gephi

Project description

colcon_gephi

Colcon plugin to generate a rich dependency graph for packages in a ROS 2 workspace. Resulting graph is intended for viewing in Gephi, but should be usable in other graph viewing tools like GraphViz or Graphia, although these have not been verified.

Below is an example graph of the workspace for the ros2 rolling repos. For details on what the graph actually is showing, see Example Graph. ros2_rolling.png

Features

Currently supports exporting in:

  • DOT (default, for Graphviz and other generic graph tools)
  • GML (human-readable text format, supported by many graph libraries)
  • GEXF (ideal for Gephi, preserves complex attributes)

Unlike colcon graph, this extension preserves extra package metadata (e.g., maintainers, repository info, build type) as node attributes. This makes it easier to analyze dependency relationships visually in Gephi.

  • Generates a graph file from your ROS 2 workspace using the same package descriptors as colcon graph.
  • Automatically includes the following as node attributes:
    • Package path
    • Build type
    • Maintainers
    • Version
    • Git repository name and remote URL (if applicable)
    • Lines of Code (LOC) stats (see Optional Dependencies)
  • Includes edges for build, run, and test dependencies between packages in the workspace.
  • Produces output ready to open in Gephi — no manual attribute editing required.

Install from PyPI

python3 -m pip install colcon_gephi

Usage

cd ros2_rolling/
colcon gephi_graph

The generated .dot file will have the name of the directory the command was run in. So in this case, it is ros2_rolling.dot.

To change the file format, pass the --format flag.

colcon gephi_graph --format gml

Optional Dependencies

This package optionally depends on cloc to LOC-related node attributes. If cloc is not found on the system, a warning is printed, and the LOC-related attributes are not added.

Gephi Tips

Gephi can be quite complex to use. It is recommended to read a few tutorials on usage.

Node Size Based on Attribute

For whatever reason, when networkx exports a graph, the resulting (by default) .dot file will not respect data types. Everything will be a string. This means that you cannot do things like change the size of nodes based on attributes like lines_of_code by default. You need to make a new column, and copy the data over to this new column with the appropriate data type.

Example Graph

The graph generated at the top of this README was laid out by following this video. Larger nodes are nodes with more "in-degree" edges (i.e. edges pointing into them), which gives a visual representation of how many packages depend on them. Finally, the colors are based on the package build_type (i.e. ros.ament_cmake, ros.ament_python, etc).

graph_legend.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colcon_gephi-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

colcon_gephi-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file colcon_gephi-0.1.0.tar.gz.

File metadata

  • Download URL: colcon_gephi-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for colcon_gephi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8fd934e46489d59872eba4aa4a0b56310e2074a2632f36ddceb2481567b3285
MD5 2cab00d3bc7608f58f038ed307114914
BLAKE2b-256 fd3044359f2535e7e6fd496c165d25c1b91d8ba756fc45043faf70d62cb88fa9

See more details on using hashes here.

File details

Details for the file colcon_gephi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: colcon_gephi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for colcon_gephi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c95e4218d98fabc16247ad1b1ede5a2960e7d71ca23bdea0fbc4e7694e1af4a
MD5 fa9c93b8335d478d707cfe6a24835973
BLAKE2b-256 9a67efdba73d3f6285e404073aed0ec753d71f52d322c535c3cf5b2d0fe064bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page