igraph

Retrieving node coordinates from ggraph network chart

跟風遠走 提交于 2019-12-02 17:28:23
问题 Let's say I produce this chart: library(ggraph) library(igraph) my_chart <- graph_from_data_frame(highschool) set.seed(2017) ggraph(my_chart, layout = "nicely") + geom_edge_link() + geom_node_point() How would one retrieve the x and y coordinates of the nodes from this chart? 回答1: Using ggplot_build library(ggraph) library(igraph) my_chart <- graph_from_data_frame(highschool) set.seed(2017) p <- ggraph(my_chart, layout = "nicely") + geom_edge_link() + geom_node_point() pg <- ggplot_build(p)

How to find membership of vertices using Graphframes or igraph or networx in pyspark

自作多情 提交于 2019-12-02 15:10:28
问题 my input dataframe is df valx valy 1: 600060 09283744 2: 600131 96733110 3: 600194 01700001 and I want to create the graph treating above two columns are edgelist and then my output should have list of all vertices of graph with its membership . I have tried Graphframes in pyspark and networx library too, but not getting desired results My output should look like below (its basically all valx and valy under V1 (as vertices) and their membership info under V2) V1 V2 600060 1 96733110 1

R is not taking the parameter hgap in layout_with_sugiyama

眉间皱痕 提交于 2019-12-02 12:34:57
问题 I'm working on R on a graph and I'd like to have a hierarchical plot, based on the values in the vector S (a value for each node). lay2 <- layout_with_sugiyama(grafo, attributes="all", layers = S, hgap=10, vgap=10) plot(lay2$extd_graph, vertex.label.cex=0.5) However, the paramaters hgap e vgap are not taken and the graph is really confused (even because I've got 162 nodes). I'm doing something wrong or there is another way in which I can do a hierarchical graph? 回答1: I believe that layout

How to find membership of vertices using Graphframes or igraph or networx in pyspark

强颜欢笑 提交于 2019-12-02 12:06:39
my input dataframe is df valx valy 1: 600060 09283744 2: 600131 96733110 3: 600194 01700001 and I want to create the graph treating above two columns are edgelist and then my output should have list of all vertices of graph with its membership . I have tried Graphframes in pyspark and networx library too, but not getting desired results My output should look like below (its basically all valx and valy under V1 (as vertices) and their membership info under V2) V1 V2 600060 1 96733110 1 01700001 3 I tried below import networkx as nx import pandas as pd filelocation = r'Pathtodataframe df csv'

error importing igraph

跟風遠走 提交于 2019-12-02 11:48:42
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 * '' ImportError: dlopen(/Users/claushaslauer/anaconda/lib/python2.7/site-packages/igraph/_igraph.so, 2):

Cumulative value of an edge or node attribute while descending an igraph object

二次信任 提交于 2019-12-02 11:16:11
问题 I have an igraph object g made from dataframe df : df <- data.frame(c(0,1,2,2,4), c(1,2,3,4,5), c(0.01, 0.03, 0.05, 0.01, 0.02)) colnames(df) <- c('parent_id', 'id', 'dt') g <- graph_from_data_frame(df) Edges are made between parent_id and id . > g IGRAPH DN-- 6 5 -- + attr: name (v/c), dt (e/n) + edges (vertex names): [1] 0->1 1->2 2->3 2->4 4->5 Change in thickness dt is the edge attribute. This can be thought of as the change in thickness between a 'parent' and 'child' iceberg (this is my

igraph's Gomory–Hu tree not working?

我是研究僧i 提交于 2019-12-02 10:51:26
问题 When I try the following with python-igraph : from igraph import * g= Graph() g.add_vertices(3) g.vs["name"] = ["0", "1", "3"] g.add_edge("0", "1", weight=0.0) g.add_edge("1", "3", weight=10.0) g.add_edge("0", "3", weight=10.0) t = g.gomory_hu_tree(capacity="weight") print t I get the output: IGRAPH UNW- 3 2 -- + attr: name (v), flow (e), weight (e) + edges (vertex names): 0--1, 1--3 This makes no sense as vertex "3" is connected to the other vertices through edges with high weight. Therefor

No package called igraph0 R

匆匆过客 提交于 2019-12-02 09:58:14
I'm trying to use "gspan" algorithm using R. I installed and loaded igraph . But when I call "gspan", I get this error: > results = subdue(graph1); Error in library(igraph0) : there is no package called ‘igraph0’ Could any one give me a solution, thanks in advance. From the CRAN repo : Package ‘igraph0’ was removed from the CRAN repository. Formerly available versions can be obtained from the archive . This was a transitional package from Mar 2012 to Sept 2013. Packages depending on it ought to have changed to igraph long ago. Consider using package ‘igraph’ instead. So this package is no

Graphml parse error

我只是一个虾纸丫 提交于 2019-12-02 09:36:21
问题 I tried to create a graphml file using python and igraph library. I can construct igraph's graph object and wrote it to a file using: g.write_graphml("mygraph.graphml") Everything seems to be successful but when I tried to read the file back to python using: g = Graph.Read_GraphML('mygraph.graphml') I got this error: igraph.core.InternalError: Error at .\src\foreign-graphml.c:1024: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA0 0x3C 0x2F 0x64 How can I solve this, please? Thank

Order of treechart entries not correct in R igraph package

你。 提交于 2019-12-02 08:22:21
This is a follow-up question from : Creating treechart from tabbed text in R I am using following function: treechart = function(){ library(psych) fields <- max(count.fields(textConnection(readClipboard()), sep = "\t")) dat = read.table(text = readClipboard(), sep="\t",col.names = paste0("V", sequence(fields)), header=FALSE, fill=TRUE, strip.white=TRUE, stringsAsFactors=FALSE, na.strings="") library(zoo) library(igraph) # To prepare the data # carry forward the last value in columns if lower level (col to the right) # is non-missing dat[1] <- na.locf(dat[1], na.rm=FALSE) for(i in ncol(dat):2)