igraph

generating a community graph in igraph

笑着哭i 提交于 2019-12-03 07:36:51
问题 I have been searching for an answer to this question but could not find any mention, so I decided to post here. I am trying to see if igraph or any packages provide a simple way to create a "community graph" where each node represents a community in the network and the ties represent ties between the communities. I can get the community detection algorithm to work fine in igraph, but I could not find a way to collapse the results to just show connections between each community. Any assistance

Community detection in Networkx

本小妞迷上赌 提交于 2019-12-03 05:38:23
I'm studying about detection communities in networks. I'm use igraph and Python For the optimal number of communities in terms of the modularity measure: from igraph import * karate = Nexus.get("karate") cl = karate.community_fastgreedy() cl.as_clustering().membership For supply the desired number of communities: from igraph import * karate = Nexus.get("karate") cl = karate.community_fastgreedy() k=2 cl.as_clustering(k).membership However, I like to do this using networkx. I know get optimal number of communities in terms of the modularity measure: import community # --> http://perso.crans.org

igraph add to geographic map

▼魔方 西西 提交于 2019-12-03 03:59:10
I'm using R for networks. I've used the 'network' package, but now using 'igraph'. I can plot the igraph using geographic coords. I can plot a map using 'maptools'(readShapePoly). How can I plot the igraph on top of the map? I have tried new=FALSE and add=TRUE but it doesn't work, plotting the igraph object always overwrites. greece <- readShapePoly.("Z:/GeoData/World_data/Basemaps/Greece/GRC_adm1.shp") df<-data.frame("from" = c.("Athens", "Iraklio", "Thessaloniki", "Patra"), "to"= c("Thessaloniki", "Thessaloniki", "Athens", "Iraklio")) meta <- data.frame("name"=c("Athens", "Iraklio",

How to mine for motifs in R with iGraph

我们两清 提交于 2019-12-03 03:20:51
I'm trying to mine for 3-node motifs in R using the package igraph . I would like to retrieve the number of motifs for each individual vertex in the graph, which does not appear possible from the graph.motifs() function. So, for the example graph: testGraph = barabasi.game(10, m = 5, power = 2, out.pref = TRUE, zero.appeal = 0.5, directed = TRUE) I can use graph.motifs() to count the total number of each 3-node motif in the entire graph: graph.motifs(testGraph, size = 3) [1] 0 0 26 0 16 0 2 58 0 0 0 0 0 0 0 0 But I would like to know the individual vertex participation. So, how many motifs

Using iGraph in python for community detection and writing community number for each node to CSV

隐身守侯 提交于 2019-12-03 02:35:09
I have an network that I would like to analyze using the edge_betweenness community detection algorithm in iGraph. I'm familiar with NetworkX, but am trying to learning iGraph because of it's additional community detection methods over NetworkX. My ultimate goal is to run edge_betweenness community detection and find the optimal number of communities and write a CSV with community membership for each node in the graph. Below is my code as it currently stands. Any help figuring out community membership is greatly appreciated. input data ('network.txt'): 1 2 2 3 2 7 3 1 4 2 4 6 5 4 5 6 7 4 7 8 8

R: igraph, community detection, edge.betweenness method, count/list members of each community?

ぃ、小莉子 提交于 2019-12-02 22:37:40
I've a relatively large graph with Vertices: 524 Edges: 1125, of real world transactions. The edges are directed and have a weight (inclusion is optional). I'm trying investigate the various communities within the graph and essentially need a method which: -Calculates all possible communities -Calculates the optimum number of communities -Returns the members/# of members of each (optimum) community So far I've managed to pull together the following code which plots a color coded graph corresponding to the various communities, however I've no idea how to control the number of communities (i.e

error importing igraph

拈花ヽ惹草 提交于 2019-12-02 22:36:18
问题 On importing igraph in python, I get an error (see below). Since igraph is not part of anaconda, I executed the below outlined steps for installation. What is libglpk.35.dylib, how should I load it, and why is this problem occurring? igraph cannot be imported '' import igraph '' Traceback (most recent call last): '' File "<stdin>", line 1, in <module> '' File "/Users/claushaslauer/anaconda/lib/python2.7/site-packages/igraph/__init__.py", line 34, in <module> '' from igraph._igraph import * ''

generating a community graph in igraph

一笑奈何 提交于 2019-12-02 21:06:19
I have been searching for an answer to this question but could not find any mention, so I decided to post here. I am trying to see if igraph or any packages provide a simple way to create a "community graph" where each node represents a community in the network and the ties represent ties between the communities. I can get the community detection algorithm to work fine in igraph, but I could not find a way to collapse the results to just show connections between each community. Any assistance would be appreciated. You can simply use the contract.vertices() function. This contracts groups of

Creating Variables with Group in R igraph

早过忘川 提交于 2019-12-02 19:31:27
问题 below are my reproductive sample codes. sender_code <- c(12 ,1 ,6 ,19 ,7 ,8 ,3 ,17 ,13 ,10 ,4 ,9 ,2 ,5 ,15 ,11 ,16 ,20 ,14 ,18) receiver_code <- c( 20 ,16 ,7 ,3 ,4 ,11 ,8 ,2 ,10 ,12 ,17 ,5 ,1 ,18 ,13 ,9 ,6 ,15 ,19 ,14) sender_country <- ifelse(sender_code<6,"Phil", ifelse(sender_code<10,"Japan", ifelse(sender_code<16,"Brazil", "Norway" ) ) ) receiver_country <- ifelse(receiver_code<6,"Phil", ifelse(receiver_code<10,"Japan", ifelse(receiver_code<16,"Brazil", "Norway" ) ) ) message<- data.frame

R color vertex igraph

浪子不回头ぞ 提交于 2019-12-02 18:56:19
问题 I have a database with all the users and their roles, i've made a table that has usera, role, userb. i'm trying to give each user a color based on their team. the SQL code below can be used to create a similar dataset select concat('H',ABS(Checksum(NewID()) % 999999)) acentralacc, CONCAT('Role_',CHAR( FLOOR(65 + (RAND() * 25))))role,concat('H',ABS(Checksum(NewID()) % 999999))bcentralacc select concat('H',ABS(Checksum(NewID()) % 999999)) centralaccountname, CONCAT('Team_',CHAR( FLOOR(65 +