Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct import of Excel adjacency matrix format data #1143

Closed
maxfreund opened this issue Oct 4, 2015 · 17 comments
Closed

Direct import of Excel adjacency matrix format data #1143

maxfreund opened this issue Oct 4, 2015 · 17 comments

Comments

@maxfreund
Copy link

Unless I'm missing something, the "Excel import" really just seems to be a character-delimited text file import with a requirement that the edges be set up in the usual source,target format. As far as I can tell, Gephi does not actually import .xls or .xlsx files. Also, the source,target format is inconvenient since data collected via surveys usually comes through as a source x target matrix. I have found no easy way to convert matrix format data to a list of edges.

It would make Gephi much more user friendly if it were possible to:
(a) import data as an adjacency matrix (whether in Excel or csv format)
(b) import data as .xls and .xlsx files

If this is already possible, then it needs to be added to the documentation. I can't find any instruction in the tutorials, and a search of the documentation on Github for "xls" and "xlsx" does not return any results.

@eduramiba
Copy link
Member

I think you are using the spreadsheet format, Gephi also supports a CSV format.
Check http://gephi.github.io/users/supported-graph-formats

To import matrix csv format use File - Open menu item.

For xls files, you can just export them to csv from excel.

@maxfreund
Copy link
Author

Thanks for the tip, but that does not answer my question about importing a CSV in an adjacency matrix format rather than an edge list.

Is that possible?

—Max

Sent from my phone, so please enjoy the autocorrect errors and uncharacteristic brevity.

On Oct 5, 2015, at 14:30, Eduardo Ramos [email protected] wrote:

I think you are using the spreadsheet format, Gephi also supports a CSV format.
Check http://gephi.github.io/users/supported-graph-formats

To import matrix csv format use File - Open menu item.

For xls files, you can just export them to csv from excel.


Reply to this email directly or view it on GitHub.

@eduramiba
Copy link
Member

The CSV importer supports Matrix formatting, isn't this what you need? http://gephi.github.io/users/supported-graph-formats/csv-format/

@maxfreund
Copy link
Author

That seems to be incorrect.

When I import an adjacency matrix CSV in the Data Laboratory window, I get the attached error.

When I try to open it under File:Open, it still reads it as just an edge list in source—>target format. (see second attached screenshot)

Can you be more precise how I would access the functionality you are describing? The documentation page you linked to is not at all clear. I'm attaching the CSV in case it helps.

—Max

Max Freund • [email protected] • (909) 632-1624

On Oct 8, 2015, at 11:15 AM, Eduardo Ramos [email protected] wrote:

The CSV importer supports Matrix formatting, isn't this what you need? http://gephi.github.io/users/supported-graph-formats/csv-format/ http://gephi.github.io/users/supported-graph-formats/csv-format/

Reply to this email directly or view it on GitHub #1143 (comment).

@eduramiba
Copy link
Member

Hi Max,
Could you share a sample of your file?

I am able to correctly import a matrix CSV formatted like the example in that page:
;A;B;C;D;E
A;0;1;0;1;0
B;1;0;0;0;0
C;0;0;1;0;0
D;0;1;0;1;0
E;0;0;0;0;0

@maxfreund
Copy link
Author

Hi Eduardo,

I sent my file as an attachment to my last message (sent Oct 9). Here it is again.

My last message also included screenshots of the errors I got when I tried to import it.

—Max

Max Freund • [email protected] • (909) 632-1624

On Oct 21, 2015, at 2:17 PM, Eduardo Ramos [email protected] wrote:

Hi Max,
Could you share a sample of your file?

I am able to correctly import a matrix CSV formatted like the example in that page:
;A;B;C;D;E
A;0;1;0;1;0
B;1;0;0;0;0
C;0;0;1;0;0
D;0;1;0;1;0
E;0;0;0;0;0


Reply to this email directly or view it on GitHub #1143 (comment).

@eduramiba eduramiba self-assigned this Oct 22, 2015
@eduramiba
Copy link
Member

It seems mail attachments are not processed by github, so they are not available here.
Please try to comment directly in github.

@maxfreund
Copy link
Author

Ah, good to know.

Since Github doesn't allow me to attach a csv or xlsx, here's a link to download the data file:
https://www.dropbox.com/s/78aqxbt8wyngzrn/Communication.csv?dl=0

Here are the screenshots from when I tried to import it.
screen shot 2015-10-09 at 11 31 42 am-1
screen shot 2015-10-09 at 11 34 53 am-1

@eduramiba
Copy link
Member

The file is not found, but that kind of CSV file has to be imported with menu File - Open, instead of import spreadhseet.

CSV format is different than spreadsheet format, we will clarify this in the next release.

@maxfreund
Copy link
Author

Ah yes, that is very confusing. Also, the documentation does not say that the matrix has to be just the edges, without any node labels or numbering to identify the node. If you later import the edge attributes, that could complicate things if the nodes listed in the matrix are not in exactly the same order as the edge attributes.

In the short term, it would be great if the documentation wiki were clarified.

@eduramiba
Copy link
Member

Yes, import spreadsheet is aimed at directly importing tabular data into data laboratory tables, meaning
that you are populating either nodes or edges table at each import.

We will improve the explanation of this import.

@mrichey17
Copy link

So then... how does one go about importing attributes (node names, lat/long, etc.) to the nodes found in the adjacency matrix? So far, I can only get it to import if all my nodes are labeled 1, 2, 3, 4, 5... which is not helpful. I need the attributes.

@njss
Copy link

njss commented May 31, 2017

Maybe I am wrong...
But a good way to achieve what you want is to import the matrix into R (you can use RStudio).
Then you can use the library "reshape2" and the command melt...to melt the matrix into a regular table...
Then you export the results to csv...and use it in excel if you want :)
Is it something like this, that you are looking for?

@eduramiba
Copy link
Member

Actually this should now be possible in Gephi 0.9.2 (nightly build available at https://github.com/gephi/gephi/#nightly-builds). CSV and XLS import is unified in a single importer with auto-detection of format and other improvements.

Marking as implemented in #1282

@Anirban2020
Copy link

Hi,
I am new user to gephi. I am trying it out for fMRI data which is in the form of correlation matrix. I am not able to find sufficient tutorial for how to load data in correlation matrix form/adjacency form. Attached is the excel file that I want to make a graph of. Can you let me know how to arrange it and how to load the data ? Thanks...
DataSet2_Edges.xlsx
DataSet2_Node.xlsx

@mrichey17
Copy link

mrichey17 commented Oct 18, 2021 via email

@Aristotle1992
Copy link

How can i import correaltion matrix into Gephi. I had already plot my network co-corrence on gephi but i want my edges to be based on positive and negative correlation and not on weight. Please how can i go about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants