igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] R: vertex attributes in bipartite graphs for only one verte


From: Dan Suthers
Subject: Re: [igraph] R: vertex attributes in bipartite graphs for only one vertex type
Date: Tue, 26 Nov 2019 01:07:51 -1000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

Hi all,

The blind trust in V(g)$type is something that can trip you up. I have a large network (constructed outside of igraph) in which I had used a character vertex attribute 'type' to encode the entity type of nodes in the network (representing actors, chat rooms, files, discussion forums ...). Igraph summary prints it as "bipartite" because it sees a 'type' attribute: does not even check that this attribute is logical.

> summary(ti)
IGRAPH e7dc05c D-WB 40490 229072 --
+ attr: label (v/c), type (v/c), data1 (v/c), data2 (v/c), data3
| (v/c), id (v/c), Edge Label (e/c), weight (e/n), Edge Id (e/c)
> head(V(ti)$type)
[1] "ACTOR" "ACTOR" "ROOM"  "ACTOR" "ACTOR" "ROOM"

No problem: we can supply a 'types' vector when calling bipartite_projection. I used it with V(g)$type == "ACTOR" to separate the human actors from the media types. But here is the 'gotcha': bipartite_projection has default remove.type = TRUE, so my data on the different media types is removed from the media object projection! One can set remove.type = FALSE, or to avoid future problems rename 'type' to something like 'entity'.

I deliberately left this in a homework problem I gave students, to give them practice with identifying and solving issues, as data cleaning will always be with us.

Your other issue is also illustrated with this network. Actors, Rooms, Discussions, and Files all have different attributes, but if we put an attribute such as 'gender' in your example (mine were different) on ACTOR, then the other nodes all get this attribute too. Similarly all nodes would have a MIME type attribute even though they only apply to files. This is because the underlying representation is tabular. The same is true of Gephi, which I usually use to inspect results of analyses. As you can see in the summary above, we avoided the proliferation of columns in Gephi Data Laboratory by re-using generic 'data1', 'data2' and 'data3' columns, the contents of which depend on 'type'. This was OK for visual inspection in Gephi data laboratory, but is not optimal.

Dan Suthers

On 11/25/19 8:04 PM, Michael Gastner wrote:
Dear Tamas,

Many thanks for your reply! Also thank you for explaining that igraph
does not check whether the topology is really bipartite. I had been
wondering about that too.

Michael

Is there some way to create a vertex attribute that is only attached
to one vertex type in a bipartite graph (in this example the vertices
for which V(g)$type == FALSE)?

Unfortunately there's no way to do that; this is because bipartite graphs
in igraph are simply "normal" graphs with a "type" vertex attribute and an
additional property that edges never go between vertices of the same type.
(But this is not even enforced; you can create such an edge if you really
want to). So, for the time being you need to settle with having NA as the
"gender" for the company vertices. Try to think about NA as "not
applicable", which actually sort-of-makes sense for companies :)
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help

--
Dan Suthers

Professor and Graduate Program Chair
Dept. of Information and Computer Sciences
University of Hawaii at Manoa
1680 East West Road, POST 309, Honolulu, HI 96822
(808) 956-3890 office
Personal: http://www2.hawaii.edu/~suthers/
Lab: http://lilt.ics.hawaii.edu/
Department: http://www.ics.hawaii.edu/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]