igraph

No Graph is Being Displayed in IGraph

泪湿孤枕 提交于 2019-12-11 17:59:57
问题 I have been trying to make graphs using the igraph library in c. I have even reinstalled it but i am unable to understand the problem. The whole program is compiled successfully but i get no graph as an output. All the printf's are executed and are shown in the output only the graph seems to be missing. Please help i am stuck in this problem. #include <igraph.h> int main(void) { igraph_real_t diameter; igraph_t graph; igraph_erdos_renyi_game(&graph, IGRAPH_ERDOS_RENYI_GNP, 1000, 5.0/1000,

rotate a tripartite network graph

谁说胖子不能爱 提交于 2019-12-11 15:13:27
问题 I'm using a tripartite graph to visualize the overlapping club memberships among selected students in a given class, but since the output looks quite "long," I am wondering if there's a way to rotate this graph to put "Class" on top, the more numerous "Club" layer in the middle, and the "student" layer on the bottom? Below is my code for this. It will be really appreciated if someone could share their thoughts on this. require(igraph) df <- read.csv2(text="Class;Club;Student Class;Club 1

R / igraph : any call to get/set vertex attribute within a depth-first-search callback causes a segfault

前提是你 提交于 2019-12-11 14:05:26
问题 I'm finding that any call to get/set vertex attribute using the igraph library within callback causes a segfault in R. For example, the trivial callback from a segment of code: dfsCallBack <- function(graph, data, extra) { cat("in:", paste(collapse=", ", data), "\n") distFromRoot <- data[2] vertexID <- data[1] set.vertex.attribute(graph, 0, name = 'color', value = 'blue') FALSE } graph.dfs(g, 1, in.callback = dfsCallBack) Produces this error: graph.dfs(g, 1, in.callback = dfsCallBack) in: 0,

NetworkX / Python_igraph: All paths between two nodes, limited by list of nodes

ぃ、小莉子 提交于 2019-12-11 12:50:38
问题 I am using the function from here : def find_all_paths(graph, start, end, mode = 'OUT', maxlen = None): def find_all_paths_aux(adjlist, start, end, path, maxlen = None): path = path + [start] if start == end: return [path] paths = [] if maxlen is None or len(path) <= maxlen: for node in adjlist[start] - set(path): paths.extend(find_all_paths_aux(adjlist, node, end, path, maxlen)) return paths adjlist = [set(graph.neighbors(node, mode = mode)) \ for node in xrange(graph.vcount())] all_paths =

Plot edges based on weight using R igraph

不打扰是莪最后的温柔 提交于 2019-12-11 11:56:26
问题 I'm trying to plot a network with igraph in R where the edges are sorted by weight. I have assigned colors, but I want weak edges on the back and strong edges in front. Is there a way of doing this? thanks 回答1: Here's a possible solution. It really depends on what you're working with, so with a code sample I could improve this. Basically, edges are plotted in the order they appear. So we need to sort edges based on their weight attribute. This doesn't seem possible to do within the same graph

In R, is there a similar function to heatmap() to visualize groups in a large matrix?

痴心易碎 提交于 2019-12-11 10:32:38
问题 I currently have a 1000 by 1000 matrix in R. There are 100 groups/communities in the matrix, and I wish to somehow verify if these 100 groups are appearing. For example, the first 10 columns/rows define a group, with the second 10 columns/rows defining another group, and so forth. Is there a way in which I can visualize such a grouping is actually there? Ideally, I would have a heatmap that can show diagonal blocks of 10 by 10 . I tried the heatmap function but it doesn't appear to do that.

igraph package in RStudio: Bipartite graph projection error

纵饮孤独 提交于 2019-12-11 09:54:24
问题 In an attempt to learn the "nuts-and-bolts" of social network theory within the igraph package in R, I created a basic toy example of a bipartite graph of terror attacks during a single year of the Algerian Civil War. The vertices consist of terror perpetrators and targets, while the edges represent which group attacked which target. I can plot the general unipartite graph of this relationship (as well as basic analyses of network centrality), but am having problems creating a bipartite

Is there an argument to force UTF8 in igraph functions?

这一生的挚爱 提交于 2019-12-11 09:48:01
问题 I am trying to use an adjacency matrix that has labels in UTF-8. Is there a way to make sure iGraph functions use UTF8, something along the line of "encoding = "UTF8""? This is to avoid the following result (French text on a japanese system shows kanji instead of french diacritics). Thanks for any pointers. > m1 <- graph_from_adjacency_matrix(m, mode = "directed", weighted = TRUE) > m1 > IGRAPH 7a99453 DNW- 391 1454 -- + attr: name (v/c), weight (e/n) + edges from 7a99453 (vertex names): [1]

I can't import igraph on mac 10.6

天大地大妈咪最大 提交于 2019-12-11 08:57:15
问题 I installed igraph for python in my mac but I can't import it. First I installed C core library, then I proceeded with the instalation for python, by doing: python setup.py build python setup.py install Everything seemed to work fine but I can't import igraph from python shell. Just to clear up, I'm not inside igraph source code's folder. And I got this error: import igraph Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.macosx-10.3-fat/egg/igraph/_

How to draw graph corresponding with its attributes in ggraph [R]

↘锁芯ラ 提交于 2019-12-11 08:38:16
问题 I am trying to draw following graph in ggraph . igraph class object is obtained from a data frame below: edge <- data.frame(from=c(0,0,0,0,1,2,3), to=c(0,1,2,3,0,0,0), weight=c(1,3,1,1,3,1,1)) node <- data.frame(id=c(0,1,2,3), p=c(9,1,0,0), w=c(0,2,0,0), s=c(0,0,1,1), size=c(9,3,1,1), gr=c(0,1,1,2)) # Convert data frame into igraph class object net <- graph_from_data_frame(d=edge,vertices=node,directed=TRUE) However, when I draw the graph in the following scripts, it produces unexpected width