I am doing something like the below in one of my plots:

library(igraph)

message("Select the edges list")

el=read.csv(file.choose(),sep="|")

el=as.matrix(el)

g = graph.edgelist(el[,1:2],directed=FALSE)

E(g)$Entries_Count = as.numeric(el[,4])

E(g)$Entry_Type = el[,3]

E(g)$color = E(g)$Entry_Type

E(g)$color = gsub("164","EType1",E(g)$color)

E(g)$color = gsub("165","EType1",E(g)$color)

E(g)$color = gsub("EType1","deepskyblue",E(g)$color)

E(g)$color = gsub("EType2","orange",E(g)$color)

E(g)$color = gsub("EType3","gray",E(g)$color)

E(g)$color = gsub("EType4","green",E(g)$color)

E(g)$color = gsub("EType5","red",E(g)$color)

E(g)$color = gsub("EType6","blue",E(g)$color)

E(g)$color = gsub("EType7","black",E(g)$color)

message("Select the vertices list")

nodeinfo=read.csv(file.choose(),sep="|")

V(g)$Actor_Type =
as.character(nodeinfo$Type[match(V(g)$name,nodeinfo$Name)])

V(g)$Actor_Status =
as.character(nodeinfo$status[match(V(g)$name,nodeinfo$Name)])

V(g)$shape = V(g)$Actor_Type

V(g)$shape =gsub("NType1","none",V(g)$shape)

V(g)$shape =gsub("NType2","sphere",V(g)$shape)

V(g)$shape =gsub("NType3","pie",V(g)$shape)

V(g)$color=V(g)$Actor_Status

V(g)$color=gsub("FormNType1","green",V(g)$color)

V(g)$color=gsub("FormNType2","gray",V(g)$color)

V(g)$color=gsub("FormNType3","orange",V(g)$color)

mySize = V(g)$Actor_Type

mySize = gsub("NType1","20",mySize)

mySize = gsub("NType2","0",mySize)

mySize = gsub("NType3","0",mySize)

V(g)$size = as.numeric(mySize)

V(g)$label.cex = 20

tkplot.fit.to.screen(tkplot(g, vertex.shape=V(g)$shape,
layout=layout.fruchterman.reingold,vertex.label=NA),width = NULL, height =
NULL)



I will be happy to learn any possible optimization of this.

Regards


On Thu, Dec 4, 2014 at 12:33 PM, lookman sanni <[email protected]> wrote:

> Sure...Will be doing that by the end of the day. No access at the moment
> to the hosting machine.
>
> On Thu, Dec 4, 2014 at 12:16 PM, Gábor Csárdi <[email protected]>
> wrote:
>
>> Can you please show the code that is slow?
>>
>> Gabor
>>
>> On Thu, Dec 4, 2014 at 6:07 AM, lookman sanni <[email protected]>
>> wrote:
>>
>>> I have been using the default plot, and also Tkplot for a graph of 1K
>>> nodes, but with very low density (Less than 10 nodes having a significant
>>> local density actually). It takes between 3 and 5 minutes. I should however
>>> recognize that I am not using the appropriate material for that (an HP
>>> Envy).
>>>
>>> On Thu, Dec 4, 2014 at 11:45 AM, Gábor Csárdi <[email protected]>
>>> wrote:
>>>
>>>> So subgraph.edges is slow for you? How long does it take?
>>>>
>>>> Gabor
>>>>
>>>> On Thu, Dec 4, 2014 at 5:09 AM, lookman sanni <[email protected]>
>>>> wrote:
>>>>
>>>>> I was not meaning, but rather fearing it may be. I will be dealing
>>>>> with networks of 20K nodes and 7 layers(subgraphs). I just need to make
>>>>> sure that I am making the most from the optimization opportunities that 
>>>>> may
>>>>> exist.
>>>>>
>>>>> Thank you Fatemeh for the links. I will be looking into that as well.
>>>>>
>>>>> Regards,
>>>>>
>>>>> On Mon, Dec 1, 2014 at 5:25 PM, Fatemeh a <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I searched a little some times ago on Multilayered network : you may
>>>>>> find them helpful :
>>>>>>
>>>>>> http://arxiv.org/pdf/1309.7233v4.pdf
>>>>>>
>>>>>> http://arxiv.org/pdf/1407.0742.pdf
>>>>>>
>>>>>> and here : http://muxviz.net/ a framework  is developed to deal with
>>>>>> multilayered network : I didn't work with it and I have no idea whether 
>>>>>> you
>>>>>> could combine these two package or not.
>>>>>>
>>>>>> Regards,
>>>>>> Fatemeh
>>>>>>
>>>>>>
>>>>>> On Sat, Nov 29, 2014 at 1:52 AM, lookman sanni <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello everyone. I am new to SNA and learning how to use the igraph
>>>>>>> package. I have built a multiplex network from some flat file and would
>>>>>>> like to compute couple of metrics on top of that network:
>>>>>>>
>>>>>>>    - The number of edge types by node (multiplexity)
>>>>>>>    - A metric (matrix, contingent table) of edge types association
>>>>>>>    between the same nodes (e.g: money transfer + good transfer: 20 
>>>>>>> pairs of
>>>>>>>    nodes; money transfer + kinship: 120 pairs of nodes)
>>>>>>>
>>>>>>> I have not seen any likely metrics in my web searches. Would I need
>>>>>>> to write them ? If yes, is there any available guideline on how to
>>>>>>> contribute to igraph ?
>>>>>>>
>>>>>>> --
>>>>>>> Best Regards
>>>>>>>
>>>>>>> Lookman SANNI
>>>>>>> http://blog.lookouster.org
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> igraph-help mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> regards
>>>>>> F..A
>>>>>>
>>>>>> _______________________________________________
>>>>>> igraph-help mailing list
>>>>>> [email protected]
>>>>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards
>>>>>
>>>>> Lookman SANNI
>>>>> http://blog.lookouster.org
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> Best Regards
>>>
>>> Lookman SANNI
>>> http://blog.lookouster.org
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
> Best Regards
>
> Lookman SANNI
> http://blog.lookouster.org
>



-- 
Best Regards

Lookman SANNI
http://blog.lookouster.org
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to