Hi,
What type of non-square matrix? There are two types AFAIK:
1. two mode network, i.e. rows and cols are different nodes
2. missing data, i.e. rows or cols are missing.
In either case, I don't know of a way to do this in igraph specifically. Are
you working in python or R?
In python, you would simply read in the rows and create an edge list in two for
loops. It also depends on whether the first row / col is named. If it is, then
here is a very dirty way to do that. The code below should work for both.
matrix = YOURDATA #consider reading in using csvreader
edgetups = []
collabels = rows[0] # there will be a blank first entry, but that's no matter
rowlabels = [rows[0] for rows in YOURDATA] #again, first entry blank but no
matter
#removing first entry here creates off-by-one errors below, so keep for now.
for c,i in enumerate(rows):
for d,j in enumerate(i):
if c > 0 and d > 0 and j > 0: #don't want first row, col, or j
if j is 0
edgetups.append(collabels[c],collabels[d])
#Edgetups is now your edgelist. Insert as normal.
Take care,
BERNiE
Dr Bernie Hogan
Research Fellow, Oxford Internet Institute
University of Oxford
http://www.oii.ox.ac.uk/people/hogan/
On 24 Mar 2012, at 17:39, Tamás Nepusz wrote:
> Hi,
>
> How should a non-square adjacency matrix be converted to an edge list? As far
> as I know, an adjacency matrix should be square by definition.
>
> --
> T.
>
>
> On Saturday, 24 March 2012 at 17:42, Pankaj Barah wrote:
>
>> Hi All,
>>
>> Can anyone help me with how to convert an Non square adjacency matrix to
>> edge list ?
>>
>> Thanks,
>>
>> --
>> Pankaj
>> _______________________________________________
>> igraph-help mailing list
>> [email protected] (mailto:[email protected])
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
>
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help