Gephi - generate graph using matrix data

浪尽此生 提交于 2019-12-20 07:07:34

问题


Can you help me visualise an undirected graph?

I have about 500 strings that look like this:

;javascript;java;tapestry;d;design;jquery;css;html;com;air;testing;events;crm;soa;documentation;.a;email;iso;dynamic;mobile;this;project;resolution;s;automation;web;like;e-commerce;profile;commerce;out;jobs;inventory;operators;environment;system;include;integration;relationship;field;implementation;key;.profile;planning;knockout.js;sun;packaging;collaboration;report;public;virtual;communication;send;state;member;execution;solution;provider;members;continuous;writing;e;cuba;required;transactional;subject;manual;capacity;portfolio;.so;leader;take


;c;python;java;.a;basic;equivalent;cad;requirements;catia;.x;nx;self;communication;selected;base;summary


;javascript;c;python;java;rest;android;security;linux;sql;git;design;perl;css;html;svn;yaml;architecture;ios;json;api;ubuntu;pyramid;deployment;bash;documentation;configuration;frameworks;module;object;.a;multitasking;centos;hosting;project;fluent;administrator;monitoring;control;specifications;web;version;platform;admin;components;out;minimum;environment;system;include;using;key;falcon;communication;migrate;deadlines;ansible;back;cycle;production;red;analysis;administration;graphic;maintenance;autonomy;french;required;environments;hat;lead;arch;take

and what I would like to do with them is calculate and visualise the edges between the shared elements of the strings. Like if in the first two strings we find javascript and python, then the edge would be thicker between them for every match occurence in all strings in the final graph.

What I've done so far is to parse out the strings and separate each one in a 1/0 matrix, with the string names as column names (in a csv file) but that did not seem to work because I don't know if the labels could be seen in Gelphi as column names.

           javascript java tapestry
--------------------------------------- 
    Row 1   1          0    1
    Row 2   0          1    0
    Row 3   1          1    1

So I transposed the matrix to get the strings all in a column, but those columns enumerated by number don't mean much to me.

name      Col1  Col2 Col3 Col4
-------  ------------------------
javascript  1   0   0   0   1
java        0   1   1   0   0
tapestry    1   0   1   0   1

I am thinking a matrix multiplied by its transverse might help, although Im not sure how the math works for the result interpretation.


回答1:


what I would like to do with them is calculate and visualise the edges between the shared elements of the strings.

Gephi just visualizes what is created manually, or selected for import.

Can you help me visualise an undirected graph?

Graph as .csv

Turning associations into a static graph (as Gephi-compatible .csv file):

Nodes

  • List unique names, save to .csv like:

    id,label
    0,"node #1"
    1,"node #2"
    2,"node #3"
    
  • Optionally, add additional columns as required.

Edges

  • Enumerate associations, add to weight for each occurrence, save to .csv, like:

    id,source,target,label,weight
    0,0,1,"edge #1",1
    1,0,2,"edge #2",3
    

    Alternatively, create new edge per association-occurrence and merge them after import.

  • Do not create edges for 0 -weight values (no connection).
  • source and target -column reference node id.
  • label -column is optional.
  • May contain type -column (allows for Directed or Undirected -value).
  • Optionally, convert to weight (0.0 - 1.0 as opposed to amount) by recalculating weight as:

    weight = weight / highest_weight
    


来源:https://stackoverflow.com/questions/45617182/gephi-generate-graph-using-matrix-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!