network-analysis

Perform Centrality Functions on all Nodes using Cytoscape.js

跟風遠走 提交于 2019-12-25 08:01:28
问题 I need to calculate degree, closeness and betweenness centrality for every node on a graph. I'm currently using the functions built into Cytoscape.js on each node after the cy.ready() event. However, as the graphs are quite large (250+ Nodes, 650+ Connections) it's taking too long to compute. Can anyone suggest a more efficient method? var calculateSNA = function() { // Don't run if already set... if(data.sna) return false console.log('Running SNA') _.map(nodes, function(node) { var target =

Usage of forEdges iterator in networkit (python)

不打扰是莪最后的温柔 提交于 2019-12-23 22:12:47
问题 I carefully read the docs, but it still is unclear to me how to use G.forEdges(), described as an "experimental edge iterator interface". Let's say that I want to decrease the density of my graph. I have a sorted list of weights, and I want to remove edges based on their weight until the graph splits into two connected components. Then I'll select the minimum number of links that keeps the graph connected. I would do something like this: cc = components.ConnectedComponents(G).run() while cc

Show only specific labels on network graph using igraph in R

风格不统一 提交于 2019-12-23 09:57:59
问题 I'm trying to plot a graph that only displays the labels for certain vertices. In this case, I want to only display labels for vertices with a certain number of edges. I'm reading vertices and edges into the graph object like so: nodes <- read.csv("path_to_file.csv") edges <- read.csv("path_to_file.csv") g <- graph_from_data_frame(edges,directed=TRUE,vertices=nodes) I use the following command to plot the graph and vary the width of the edge based on number of connections (the $rels attribute

Explain Mike Bostock Node-Parsing Loop [duplicate]

感情迁移 提交于 2019-12-20 02:15:44
问题 This question already has answers here : variable declaration conditional syntax (3 answers) Closed 2 years ago . I'm relatively new to JavaScript and d3, but I'm really interested in force-directed layouts. In Mike Bostock's force-directed visualizations, he tends to parse nodes from a list of links using the following code (or similar): var links = [ {source: "A", target: "B"}, {source: "B", target: "C"}, {source: "C", target: "A"}]; var nodes = {}; links.forEach(function(link) { link

build word co-occurence edge list in R

余生颓废 提交于 2019-12-18 04:18:06
问题 I have a chunk of sentences and I want to build the undirected edge list of word co-occurrence and see the frequency of every edge. I took a look at the tm package but didn't find similar functions. Is there some package/script I can use? Thanks a lot! Note: A word doesn't co-occur with itself. A word which appears twice or more co-occurs with other words for only once in the same sentence. DF: sentence_id text 1 a b c d e 2 a b b e 3 b c d 4 a e 5 a 6 a a a OUTPUT word1 word2 freq a b 2 a c

Using geo-coordinates as vertex coordinates in the igraph r-package

牧云@^-^@ 提交于 2019-12-18 01:19:46
问题 In the igraph package for R, I am struggling to plot a social network using latitude/longitude coordinates as the layout of the graph. Imagine this simple example: a network with 4 nodes of which you know the geographical location and the connections: df<-data.frame("from" = c("Bob", "Klaus", "Edith", "Liu"), "to"= c("Edith", "Edith", "Bob", "Klaus")) Here you have the meta-data for the nodes, so that Bob lives in NY, Klaus in Berlin, Edith in Paris and Liu in Bejing: meta <- data.frame("name

subset igraph object to just 2nd order ego graph of certain vertices

杀马特。学长 韩版系。学妹 提交于 2019-12-12 05:27:58
问题 Building off this question here, is there a way to extend this subgraph to include vertices connected by two degrees to a subset of vertices? I'm thinking of a command similar to the functions in make_ego_graph() where order=2 and mode="in". I'm working with a directed graph object. Thus far, I've come up with the following, but it's not producing the graph I'm looking for. first_degree <- V(graph)$condition == "something" second_degree <- V(graph)[to(first_degree)] edges_subset <- E(graph)

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 =

iGraph + Plotly creates random connections

你说的曾经没有我的故事 提交于 2019-12-11 07:36:26
问题 I'm trying to use the example code here for doing iGraph network graphs in plotly and shoehorn in my own data.frames instead of using the example karate club data. When the graph is plotted, it seems to ignore the edge list and a bunch of random connections are being made. I think either the labels or edges are wrong but I can't tell. library(igraph) library(plotly) setwd('C:/Users/Andrew Riffle/Documents/MEGAsync/code/R/link_analysis') ID <- c(1:50) nodes <- data.frame(ID) Source <- c(23, 24

Why is there a time span between different network requests?

◇◆丶佛笑我妖孽 提交于 2019-12-11 03:33:19
问题 I'm optimizing the loading times in a web app and I don't know what's the problem. Firebug's Net panel is showing time holes between requests. Can someone explain me this chart? 回答1: The gap between the requests can have two reasons: Time needed to parse the requested page When you request a URL, the browser needs to parse the returned contents to check whether they contain URLs to other ressources like JavaScripts, CSS files, images, etc. Subsequently requested ressources need to be parsed,