[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] vertex order
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] vertex order |
Date: |
Tue, 14 Dec 2010 16:45:51 +0100 |
Dear Prof Freeman,
One solution is that you specify the names in a character vector, when
reading the file:
g <- read.graph(filename, format="ncol", predef=myvertexnames)
But you need to know the vertex names vertices beforehand. Here is how
to find them from the file itself:
myvertexnames <- unique(sort(scan(filename, what="")))
Or, if you have numbers as vertex names:
myvertexnames <- unique(as.character(sort(scan(filename))))
I hope this helps. Best Regards,
Gabor
On Tue, Dec 14, 2010 at 4:20 PM, Lin Freeman <address@hidden> wrote:
> Hi,
> Because of the ordering of edges presented in an "ncol" edgelist data entry,
> I get an output in which my vertices are not in order:
>
> Vertex sequence:
> [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "11" "12" "13" "14" "18"
> "20"
> [16] "22" "32" "31" "10" "28" "29" "33" "17" "34" "15" "16" "19" "21" "23"
> "24"
> [31] "26" "30" "25" "27"
>
>
> I would very much like to have the vertices and their memberships (in the
> membership vector) presented in their natural order. How can I accomplish
> that?
>
> Lin
> --
> Linton C. Freeman
> Institute for Mathematical Behavioral Sciences and
> Department of Sociology
> School of Social Sciences SSPA 2143
> University of California
> Irvine, CA 92697-5100
>
> Office: (949) 824-6698
> Home (CA): (949) 494-6139
> (FL): (941) 778-1074
> Secretary: (949) 824-3663
> FAX: (949) 824-3733
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
--
Gabor Csardi <address@hidden> UNIL DGM