Search code examples
gephigraph-visualization

Change weights to integers


I have a project that has weighted edges between nodes. The edges have been imported as floats and have too many values after the decimal to be presentable.

For example, I may have three edges of weights 3.4785949828, 5.2828181992, and 2.4249882928. If I'm showing the weight between nodes, the graph could begin to look very cluttered if I keep all of those values after the decimal. I would like to be able to automatically change them to integer values of 3, 5, and 2 respectively

Is there any way I can automatically change all those floats to integers in the existing project?


Solution

  • ... [edges] have too many values after the decimal to be presentable.

    Data Laboratory

    For edge labels, create new column (where 1.234567890 becomes [1.]) by using a regular expression like \d*\. via:

    Data Laboratory > Data Table > Edges > Create column with list of regex matching groups

    Overview

    A Hide non-selected -option is available via:

    Overview > Labels -tab > Hide non-selected

    Preview

    Edge label-display can be adjusted via:

    Preview > Preview Settings > Settings > Edge Labels > Shorten Label

    and

    Preview > Preview Settings > Settings > Edge Labels > Max Characters

    Example:

    Steps to reach Gephi's edge label-shortening settings.