[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Does igraph support node ports/records?
From: |
Justin McCann |
Subject: |
Re: [igraph] Does igraph support node ports/records? |
Date: |
Fri, 20 Jan 2012 17:48:36 -0500 |
On Fri, Jan 20, 2012 at 5:43 PM, Tamás Nepusz <address@hidden> wrote:
>> In my case, it's not the visualization I need so much as the concept.
> Oh, right, sorry, I misunderstood what you want then.
>
> In this case, you can probably simply use node and edge attributes to achieve
> what you want. For instance, you can attach a node attribute called
> "counters" to every node. The attribute value could be a Python dict for
> every node that maps the name of the port to its corresponding counter. (If
> you use a defaultdict(int) then you don't even have to worry about
> nonexistent port names, they will be created automagically). Besides that,
> you can add a tuple named "ports" to every edge, which contains the name of
> the source and the target port the edge is connected to. The downside of this
> solution is that you cannot save your graph into GraphML or DOT format
> without losing the attributes since most igraph exporters handle string and
> numeric attributes only -- the only exception being the "pickled" format,
> which saves everything in Python's native pickle format so it preserves all
> the attributes.
That makes sense. If I need it, I can always extend the graphml and
dot importers/exporters. Thanks for your help!
Justin