I'm really happy to see bipartite network support being added. Most network tools & APIs have only rudimentary support at best.
The following seems to work for me for copying the vertex names.
a <- 0
b <- 0
for ( i in 0:( length( V( graph ) ) - 1 ) ) {
if ( V( graph )[ i ]$type ) {
V( part[[2]] )[ a ]$name <- V( graph )[ i ]$name
a <- a + 1
} else {
V( part[[1]] )[ b ]$name <- V( graph )[ i ]$name
b <- b + 1
}
}
The only weighting that I'd propose to be "natural" would be the number of shared nodes, from multiplying a network's adjacency matrix by it's transpose. I'll post a reference if I can dig one up. I certainly agree, however, there are a number of ways to calculate weights, especially normalized ones (e.g. Jaccard Index), so perhaps it's outside of the scope of igraph as an API.
I'm really happy to see bipartite network support being added. Most network tools & APIs have only rudimentary support at best.
The following seems to work for me for copying the vertex names.
a <- 0
b <- 0
for ( i in 0:( length( V( graph ) ) - 1 ) ) {
if ( V( graph )[ i ]$type ) {
V( part[[2]] )[ a ]$name <- V( graph )[ i ]$name
a <- a + 1
} else {
V( part[[1]] )[ b ]$name <- V( graph )[ i ]$name
b <- b + 1
}
}
The only weighting that I'd propose to be "natural" would be the number of shared nodes, from multiplying a network's adjacency matrix by it's transpose. I'll post a reference if I can dig one up. I certainly agree, however, there are a number of ways to calculate weights, especially normalized ones (e.g. Jaccard Index), so perhaps it's outside of the scope of igraph as an API.